From: Thanh Ha Date: Fri, 14 Aug 2020 14:09:35 +0000 (-0400) Subject: Run packer against a specific builder X-Git-Tag: v0.57.0~2^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=90dd675df482a8;p=releng%2Fglobal-jjb.git Run packer against a specific builder As preparation to enable the ability to configure multiple builders in a single packer template, we need to enable the ability in the job to select which builder to run. This patch sets up a new variable "packer-builder" which is used to select the builder definition in the templates file. Defaulting to "openstack" as that's the most common use case at the moment. Issue: RELENG-1052 Change-Id: Ib33a00f38a0005af69d52e7697322a2e84f6c674 Signed-off-by: Thanh Ha --- diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index fd463299..a7d2ceda 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -28,6 +28,7 @@ submodule-recursive: true submodule-timeout: 10 submodule-disable: false + packer-builder: openstack packer-cloud-settings: packer-cloud-env packer-version: 1.4.2 @@ -1479,6 +1480,7 @@ - lf-infra-packer-build: openstack: "{openstack}" openstack-cloud: "{openstack-cloud}" + packer-builder: "{packer-builder}" packer-cloud-settings: "{packer-cloud-settings}" packer-version: "{packer-version}" platform: "{platforms}" diff --git a/jjb/lf-macros.yaml b/jjb/lf-macros.yaml index b1875d2a..87267603 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -128,6 +128,7 @@ variable: CLOUDENV - inject: properties-content: | + PACKER_BUILDER={packer-builder} PACKER_PLATFORM={platform} PACKER_TEMPLATE={template} PACKER_VERSION={packer-version} diff --git a/releasenotes/notes/packer-specify-builder-9911c0cf4dfb493d.yaml b/releasenotes/notes/packer-specify-builder-9911c0cf4dfb493d.yaml new file mode 100644 index 00000000..b68a8735 --- /dev/null +++ b/releasenotes/notes/packer-specify-builder-9911c0cf4dfb493d.yaml @@ -0,0 +1,12 @@ +--- +features: + - | + Packer CI jobs now have the ability to specify which "builder" to use in + the job. Default configuration is the for the "openstack" builder. +upgrade: + - | + Requires common-packer v0.7.0 if using packer CI jobs. + - | + If your project is in AWS and uses the Packer CI jobs to build AMIs you + must set ``packer-builder: aws`` when upgrading to this version of + global-jjb or your jobs will default to openstack and fail. diff --git a/shell/packer-build.sh b/shell/packer-build.sh index 1a44e4fd..73e74965 100644 --- a/shell/packer-build.sh +++ b/shell/packer-build.sh @@ -63,6 +63,7 @@ fi set +x packer.io build -color=false \ + -only "${PACKER_BUILDER}" \ -var-file="$CLOUDENV" \ -var-file="$platform_file" \ "templates/$PACKER_TEMPLATE.json"