From: Thanh Ha Date: Wed, 12 Sep 2018 00:03:52 +0000 (-0400) Subject: Use clouds.yaml for openstack packer builders X-Git-Tag: v0.25.0~13^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=d8e3dc493b1ba8b5a462887c6fa90a51c86bedc2;p=releng%2Fglobal-jjb.git Use clouds.yaml for openstack packer builders Since packer version 1.2.5, packer now supports pulling openstack config from clouds.yaml. Let's consolidate to that file so that we don't have duplicate configuration with the jobs that need the openstack cli. Issue: RELENG-1205 Change-Id: Idf23a30b111dd922120fb6195d0411e2fc993dab Signed-off-by: Thanh Ha --- diff --git a/docs/jjb/lf-ci-jobs.rst b/docs/jjb/lf-ci-jobs.rst index 0ac86d99..6a8caff6 100644 --- a/docs/jjb/lf-ci-jobs.rst +++ b/docs/jjb/lf-ci-jobs.rst @@ -552,6 +552,9 @@ Packer Merge job runs `packer build` to build system images in the cloud. :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7) :build-timeout: Timeout in minutes before aborting build. (default: 90) :git-url: URL clone project from. (default: $GIT_URL/$PROJECT) + :openstack: Packer template uses an OpenStack builder (default: true). + :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter. + (default: vex). :packer-cloud-settings: Name of settings file containing credentials for the cloud that packer will build on. (default: packer-cloud-env) :packer-version: Version of packer to install / use in build. (default: 1.0.2) diff --git a/docs/jjb/lf-macros.rst b/docs/jjb/lf-macros.rst index a57fac5c..69873c91 100644 --- a/docs/jjb/lf-macros.rst +++ b/docs/jjb/lf-macros.rst @@ -110,6 +110,14 @@ lf-infra-packer-build Run `packer build` to build system images. +:Required parameters: + + :openstack: Packer template uses an OpenStack builder (true|false). + :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter. + :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. + lf-infra-packer-validate ------------------------ diff --git a/jjb/lf-ci-jobs.yaml b/jjb/lf-ci-jobs.yaml index ec3e48ee..e9e483ea 100644 --- a/jjb/lf-ci-jobs.yaml +++ b/jjb/lf-ci-jobs.yaml @@ -37,7 +37,7 @@ stream: master submodule-recursive: true packer-cloud-settings: packer-cloud-env - packer-version: 1.2.3 + packer-version: 1.2.5 ##################### # Job Configuration # @@ -1172,12 +1172,30 @@ - lf_packer_merge: &lf_packer_merge name: lf-packer-merge + ###################### + # Default parameters # + ###################### + + openstack: true + openstack-cloud: vex + ##################### # Job Configuration # ##################### + parameters: + - lf-infra-parameters: + project: '{project}' + stream: '{stream}' + branch: '{branch}' + lftools-version: '{lftools-version}' + - lf-packer-parameters: + packer-version: '{packer-version}' + builders: - lf-infra-packer-build: + openstack: '{openstack}' + openstack-cloud: '{openstack-cloud}' 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 5188417a..9572f885 100644 --- a/jjb/lf-macros.yaml +++ b/jjb/lf-macros.yaml @@ -81,6 +81,16 @@ - builder: name: lf-infra-packer-build builders: + - conditional-step: + condition-kind: boolean-expression + condition-expression: '{openstack}' + steps: + - config-file-provider: + files: + - file-id: clouds-yaml + target: '$HOME/.config/openstack/clouds.yaml' + - inject: + properties-content: OS_CLOUD={openstack-cloud} - config-file-provider: files: - file-id: '{packer-cloud-settings}' diff --git a/releasenotes/notes/packer-openstack-clouds-yaml-b0f8a251d9b68bee.yaml b/releasenotes/notes/packer-openstack-clouds-yaml-b0f8a251d9b68bee.yaml new file mode 100644 index 00000000..9a429d39 --- /dev/null +++ b/releasenotes/notes/packer-openstack-clouds-yaml-b0f8a251d9b68bee.yaml @@ -0,0 +1,14 @@ +--- +features: + - | + Add support to the packer-build job to use clouds.yaml for openstack builder + configuration rather than through the cloud-env file. This allows us to + simplify the template configuration for openstack builders moving forward. +upgrade: + - | + Minimum packer version 1.2.5 is now required for the packer-build job. + - | + **lf-infra-packer-build** macro now requires 2 new variables to be passed. + + #. **openstack:** Set to true if template is built using the openstack builder + #. **openstack-cloud:** The clouds.yaml cloud to use when running ``packer build``