From e0a9d10d3d6b488ed3a3b00050b34d9faee4a6f8 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Fri, 22 Jan 2021 12:04:03 +1000 Subject: [PATCH] Pass the builder type to verify jobs The default builder type must be passed to packer verify jobs. For packer jobs build on aws, set the `packer-builder: aws` in downstream CI-management. Change-Id: I599d167a957189584ef5b796c049d82e5a85ec7a Signed-off-by: Anil Belur --- docs/jjb/lf-macros.rst | 2 ++ jjb/lf-ci-jobs.yaml | 1 + jjb/lf-macros.yaml | 1 + .../pass-packer-builder-type-to-verify-jobs-396e0f450143f6c1.yaml | 8 ++++++++ shell/packer-build.sh | 1 + shell/packer-validate.sh | 1 + 6 files changed, 14 insertions(+) create mode 100644 releasenotes/notes/pass-packer-builder-type-to-verify-jobs-396e0f450143f6c1.yaml diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index 1ea2cfaf..955e224c 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -127,6 +127,7 @@ Run `packer build` to build system images. :packer-version: Version of packer to use. :platform: Build platform as found in the vars directory. :template: Packer template to build as found in the templates directory. + :packer-builder: builder type to use. ex: aws, openstack (default: openstack) :Optional parameters: @@ -145,6 +146,7 @@ Run ``packer validate`` to verify packer configuration. :packer-cloud-settings: Cloud configuration file. Loaded on the build server as CLOUDENV environment variable. :packer-version: Version of packer to use. + :packer-builder: builder type to use. ex: aws, openstack (default: openstack) lf-infra-push-gerrit-patch -------------------------- diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index 39ebc8f2..689892bf 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -1781,6 +1781,7 @@ openstack: "{openstack}" openstack-cloud: "{openstack-cloud}" packer-cloud-settings: "{packer-cloud-settings}" + packer-builder: "{packer-builder}" packer-version: "{packer-version}" - job-template: diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index f5021d26..9f740462 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -158,6 +158,7 @@ variable: CLOUDENV - inject: properties-content: | + PACKER_BUILDER={packer-builder} PACKER_VERSION={packer-version} - shell: !include-raw-escape: - ../shell/packer-install.sh diff --git a/releasenotes/notes/pass-packer-builder-type-to-verify-jobs-396e0f450143f6c1.yaml b/releasenotes/notes/pass-packer-builder-type-to-verify-jobs-396e0f450143f6c1.yaml new file mode 100644 index 00000000..530506e5 --- /dev/null +++ b/releasenotes/notes/pass-packer-builder-type-to-verify-jobs-396e0f450143f6c1.yaml @@ -0,0 +1,8 @@ +--- +fixes: + - | + Pass the builder type to verify jobs + + The default builder type must be passed to packer verify jobs. For + packer jobs to run on aws, set the `packer-builder: aws` in downstream + CI-management repositories. diff --git a/shell/packer-build.sh b/shell/packer-build.sh index 1a44e4fd..4cb3df32 100644 --- a/shell/packer-build.sh +++ b/shell/packer-build.sh @@ -21,6 +21,7 @@ PACKER_LOGS_DIR="$WORKSPACE/archives/packer" PACKER_BUILD_LOG="$PACKER_LOGS_DIR/packer-build.log" mkdir -p "$PACKER_LOGS_DIR" export PATH="${WORKSPACE}/bin:$PATH" +export PACKER_BUILDER=${PACKER_BUILDER:-openstack} cd packer diff --git a/shell/packer-validate.sh b/shell/packer-validate.sh index 61e14313..af766c3c 100644 --- a/shell/packer-validate.sh +++ b/shell/packer-validate.sh @@ -19,6 +19,7 @@ set -eu -o pipefail PACKER_LOGS_DIR="$WORKSPACE/archives/packer" mkdir -p "$PACKER_LOGS_DIR" export PATH="${WORKSPACE}/bin:$PATH" +export PACKER_BUILDER=${PACKER_BUILDER:-openstack} cd packer varfiles=(vars/*.json common-packer/vars/*.json) -- 2.16.6