Merge "Use clouds.yaml for openstack packer builders"
authorAnil Belur <abelur@linuxfoundation.org>
Thu, 13 Sep 2018 15:56:24 +0000 (15:56 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Thu, 13 Sep 2018 15:56:24 +0000 (15:56 +0000)
docs/jjb/lf-ci-jobs.rst
docs/jjb/lf-macros.rst
jjb/lf-ci-jobs.yaml
jjb/lf-macros.yaml
releasenotes/notes/packer-openstack-clouds-yaml-b0f8a251d9b68bee.yaml [new file with mode: 0644]

index 0ac86d9..6a8caff 100644 (file)
@@ -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)
index c6334fd..1fac043 100644 (file)
@@ -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
 ------------------------
 
index ec3e48e..e9e483e 100644 (file)
@@ -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 #
 - 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}'
index 2e3a857..59b249f 100644 (file)
 - 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 (file)
index 0000000..9a429d3
--- /dev/null
@@ -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``