Merge "Use detox to run tox in parallel"
authorAndrew Grimberg <agrimberg@linuxfoundation.org>
Wed, 10 Jan 2018 18:40:13 +0000 (18:40 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Wed, 10 Jan 2018 18:40:13 +0000 (18:40 +0000)
13 files changed:
.jjb-test/expected-xml/gerrit-ciman-packer-merge-centos-java-builder
.jjb-test/expected-xml/gerrit-ciman-packer-merge-centos-mininet
.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-java-builder
.jjb-test/expected-xml/gerrit-ciman-packer-merge-ubuntu1604-mininet
.jjb-test/expected-xml/gerrit-ciman-packer-verify
.jjb-test/expected-xml/github-ciman-packer-merge-centos-java-builder
.jjb-test/expected-xml/github-ciman-packer-merge-centos-mininet
.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-java-builder
.jjb-test/expected-xml/github-ciman-packer-merge-ubuntu1604-mininet
.jjb-test/expected-xml/github-ciman-packer-verify
jjb/lf-ci-jobs.yaml
shell/packer-build.sh
shell/packer-validate.sh

index 2dac4ca..a1d15ea 100644 (file)
@@ -151,7 +151,11 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
-              <pattern>packer/provision/java-builder.sh</pattern>
+              <pattern>packer/provision/*.sh</pattern>
+            </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+            <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+              <compareType>ANT</compareType>
+              <pattern>packer/provision/java-builder.yaml</pattern>
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
@@ -268,17 +272,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -379,16 +391,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 40b09ef..a2d8e53 100644 (file)
@@ -151,7 +151,11 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
-              <pattern>packer/provision/mininet.sh</pattern>
+              <pattern>packer/provision/*.sh</pattern>
+            </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+            <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+              <compareType>ANT</compareType>
+              <pattern>packer/provision/mininet.yaml</pattern>
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
@@ -268,17 +272,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -379,16 +391,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index d1af8b1..5571df8 100644 (file)
@@ -151,7 +151,11 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
-              <pattern>packer/provision/java-builder.sh</pattern>
+              <pattern>packer/provision/*.sh</pattern>
+            </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+            <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+              <compareType>ANT</compareType>
+              <pattern>packer/provision/java-builder.yaml</pattern>
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
@@ -268,17 +272,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -379,16 +391,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 902f52a..19656c5 100644 (file)
@@ -151,7 +151,11 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
-              <pattern>packer/provision/mininet.sh</pattern>
+              <pattern>packer/provision/*.sh</pattern>
+            </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+            <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
+              <compareType>ANT</compareType>
+              <pattern>packer/provision/mininet.yaml</pattern>
             </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
             <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.data.FilePath>
               <compareType>ANT</compareType>
@@ -268,17 +272,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -379,16 +391,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index deaa51a..8c58c9b 100644 (file)
@@ -270,17 +270,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
index 91ba067..df8f3cc 100644 (file)
@@ -226,17 +226,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -337,16 +345,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 18fe98f..56e8039 100644 (file)
@@ -226,17 +226,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -337,16 +345,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 146d342..b963d5c 100644 (file)
@@ -226,17 +226,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -337,16 +345,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 8870c48..beff211 100644 (file)
@@ -226,17 +226,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
@@ -337,16 +345,22 @@ PACKER_BUILD_LOG=&quot;$PACKER_LOGS_DIR/packer-build.log&quot;
 mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
+# Prioritize the project's own version of vars if available
+platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+if [ -f &quot;$PACKER_PLATFORM&quot; ]; then
+    platform_file=&quot;vars/$PACKER_PLATFORM.json&quot;
+fi
+
 cd packer
-export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
-                 packer.io build -color=false \
-                        -var-file=&quot;$CLOUDENV&quot; \
-                        -var-file=&quot;../packer/vars/$PACKER_PLATFORM.json&quot; \
-                        &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
+export PACKER_LOG=&quot;yes&quot;
+export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot;
+packer.io build -color=false \
+    -var-file=&quot;$CLOUDENV&quot; \
+    -var-file=&quot;$platform_file&quot; \
+    &quot;templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
index 532b24b..4c4436e 100644 (file)
@@ -214,17 +214,25 @@ mkdir -p &quot;$PACKER_LOGS_DIR&quot;
 export PATH=&quot;${WORKSPACE}/bin:$PATH&quot;
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in &quot;${varfiles[@]}&quot;; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ &quot;$varfile&quot; == *&quot;cloud-env.json&quot;* ]]; then
+        continue
+    fi
+
+    echo &quot;-----&gt; Testing varfile: $varfile&quot;
     for template in &quot;${templates[@]}&quot;; do
-        export PACKER_LOG=&quot;yes&quot; &amp;&amp; \
-        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot; &amp;&amp; \
-                    packer.io validate -var-file=&quot;$CLOUDENV&quot; \
-                    -var-file=&quot;$varfile&quot; &quot;$template&quot;
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG=&quot;yes&quot;
+        export PACKER_LOG_PATH=&quot;$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log&quot;
+        if output=$(packer.io validate -var-file=&quot;$CLOUDENV&quot; -var-file=&quot;$varfile&quot; &quot;$template&quot;); then
+            echo &quot;$template: $output&quot;
+        else
+            echo &quot;$template: $output&quot;
+            exit 1
         fi
     done
 done
index c931f77..7aba084 100644 (file)
 - lf_packer_file_paths: &lf_packer_file_paths
     name: lf-packer-file-paths
     file-paths:
-      # Common files for all projects
       - compare-type: ANT
         pattern: 'packer/vars/{platforms}.json'
       - compare-type: ANT
         pattern: 'packer/templates/{templates}.json'
       - compare-type: ANT
-        pattern: 'packer/provision/{templates}.sh'
+        pattern: 'packer/provision/*.sh'
+      - compare-type: ANT
+        pattern: 'packer/provision/{templates}.yaml'
       - compare-type: ANT
         pattern: 'packer/provision/lib/**'
 
index e730545..177bb1c 100644 (file)
@@ -22,16 +22,22 @@ PACKER_BUILD_LOG="$PACKER_LOGS_DIR/packer-build.log"
 mkdir -p "$PACKER_LOGS_DIR"
 export PATH="${WORKSPACE}/bin:$PATH"
 
+# Prioritize the project's own version of vars if available
+platform_file="vars/$PACKER_PLATFORM.json"
+if [ -f "$PACKER_PLATFORM" ]; then
+    platform_file="vars/$PACKER_PLATFORM.json"
+fi
+
 cd packer
-export PACKER_LOG="yes" && \
-export PACKER_LOG_PATH="$PACKER_BUILD_LOG" && \
-                 packer.io build -color=false \
-                        -var-file="$CLOUDENV" \
-                        -var-file="../packer/vars/$PACKER_PLATFORM.json" \
-                        "../packer/templates/$PACKER_TEMPLATE.json"
+export PACKER_LOG="yes"
+export PACKER_LOG_PATH="$PACKER_BUILD_LOG"
+packer.io build -color=false \
+    -var-file="$CLOUDENV" \
+    -var-file="$platform_file" \
+    "templates/$PACKER_TEMPLATE.json"
 
 # Retrive the list of cloud providers
-mapfile -t clouds < <(jq -r '.builders[].name' "../packer/templates/$PACKER_TEMPLATE.json")
+mapfile -t clouds < <(jq -r '.builders[].name' "templates/$PACKER_TEMPLATE.json")
 
 # Split public/private clouds logs
 for cloud in "${clouds[@]}"; do
index e9f1a8f..dff5397 100644 (file)
@@ -21,17 +21,25 @@ mkdir -p "$PACKER_LOGS_DIR"
 export PATH="${WORKSPACE}/bin:$PATH"
 
 cd packer
-varfiles=(../packer/vars/*.json)
-templates=(../packer/templates/*.json)
+varfiles=(vars/*.json common-packer/vars/*.json)
+templates=(templates/*.json)
 
 for varfile in "${varfiles[@]}"; do
+    # cloud-env.json is a file containing credentials which is pulled in via
+    # CLOUDENV variable so skip it here.
+    if [[ "$varfile" == *"cloud-env.json"* ]]; then
+        continue
+    fi
+
+    echo "-----> Testing varfile: $varfile"
     for template in "${templates[@]}"; do
-        export PACKER_LOG="yes" && \
-        export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log" && \
-                    packer.io validate -var-file="$CLOUDENV" \
-                    -var-file="$varfile" "$template"
-        if [ $? -ne 0 ]; then
-            break
+        export PACKER_LOG="yes"
+        export PACKER_LOG_PATH="$PACKER_LOGS_DIR/packer-validate-${varfile##*/}-${template##*/}.log"
+        if output=$(packer.io validate -var-file="$CLOUDENV" -var-file="$varfile" "$template"); then
+            echo "$template: $output"
+        else
+            echo "$template: $output"
+            exit 1
         fi
     done
 done