Add conditional build step to use clouds.yaml 73/13073/3
authorJeremy Phelps <jphelps@linuxfoundation.org>
Thu, 18 Oct 2018 19:15:30 +0000 (14:15 -0500)
committerThanh Ha <thanh.ha@linuxfoundation.org>
Thu, 18 Oct 2018 19:30:36 +0000 (15:30 -0400)
This was missed in patch Idf23a30b111dd922120fb6195d0411e2fc993dab
when we were implementing this feature.

Issue: RELENG-1205
Change-Id: Id2017172293463c616158b79f3af826ea754fa08
Signed-off-by: Jeremy Phelps <jphelps@linuxfoundation.org>
docs/jjb/lf-ci-jobs.rst
docs/jjb/lf-macros.rst
jjb/lf-ci-jobs.yaml
jjb/lf-macros.yaml
releasenotes/notes/fix-packer-validate-clouds-yaml-3e3268b7c427f456.yaml [new file with mode: 0644]

index b2905f3..5308721 100644 (file)
@@ -594,6 +594,9 @@ Packer Verify job runs `packer validate` to verify packer configuration.
     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
     :build-timeout: Timeout in minutes before aborting build. (default: 10)
     :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 9f35594..bc88d8a 100644 (file)
@@ -125,6 +125,8 @@ Run `packer validate` to verify packer configuration.
 
 :Required parameters:
 
+    :openstack: Packer template uses an OpenStack builder (true|false).
+    :openstack-cloud: Sets OS_CLOUD variable to the value of this parameter.
     :packer-cloud-settings: Cloud configuration file. Loaded on the build
         server as CLOUDENV environment variable.
     :packer-version: Version of packer to use.
index 9cfa4b8..f074bac 100644 (file)
     ######################
 
     build-timeout: 10
+    openstack: true
+    openstack-cloud: vex
 
     gerrit_verify_triggers:
       - patchset-created-event:
 
     builders:
       - lf-infra-packer-validate:
+          openstack: '{openstack}'
+          openstack-cloud: '{openstack-cloud}'
           packer-cloud-settings: '{packer-cloud-settings}'
           packer-version: '{packer-version}'
 
index ac577c8..d81497c 100644 (file)
 - builder:
     name: lf-infra-packer-validate
     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}'
-              variable: 'CLOUDENV'
+              variable: CLOUDENV
       - inject:
           properties-content: |
               PACKER_VERSION={packer-version}
diff --git a/releasenotes/notes/fix-packer-validate-clouds-yaml-3e3268b7c427f456.yaml b/releasenotes/notes/fix-packer-validate-clouds-yaml-3e3268b7c427f456.yaml
new file mode 100644 (file)
index 0000000..5e36a5a
--- /dev/null
@@ -0,0 +1,5 @@
+---
+fixes:
+  - |
+    Fix packer-verify job to correctly work with ``clouds.yaml`` config model
+    implemented in global-jjb v0.25.0.