Update packer file_path triggers
[releng/global-jjb.git] / .jjb-test / expected-xml / gerrit-ciman-packer-merge-centos-java-builder
index 88d2c9c..a6cdee4 100644 (file)
@@ -76,7 +76,7 @@ For example '<1.0.0' or '>=1.0.0,<2.0.0'.
         <hudson.model.StringParameterDefinition>
           <name>PACKER_VERSION</name>
           <description>Packer version to download and install.</description>
-          <defaultValue>1.1.1</defaultValue>
+          <defaultValue>1.1.3</defaultValue>
         </hudson.model.StringParameterDefinition>
       </parameterDefinitions>
     </hudson.model.ParametersDefinitionProperty>
@@ -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>
@@ -205,7 +209,7 @@ For example '&lt;1.0.0' or '&gt;=1.0.0,&lt;2.0.0'.
     </org.jenkinsci.plugins.configfiles.builder.ConfigFileBuildStep>
     <EnvInjectBuilder>
       <info>
-        <propertiesContent>PACKER_VERSION=1.1.1
+        <propertiesContent>PACKER_VERSION=1.1.3
 </propertiesContent>
       </info>
     </EnvInjectBuilder>
@@ -226,7 +230,7 @@ echo &quot;---&gt; packer-install.sh&quot;
 
 # $PACKER_VERSION        : Define a packer version passed as job paramter
 
-PACKER_VERSION=&quot;${PACKER_VERSION:-1.0.2}&quot;
+PACKER_VERSION=&quot;${PACKER_VERSION:-1.1.3}&quot;
 
 # Ensure we fail the job if any steps fail.
 set -eu -o pipefail
@@ -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
@@ -315,7 +327,7 @@ exit 0
       <info>
         <propertiesContent>PACKER_PLATFORM=centos
 PACKER_TEMPLATE=java-builder
-PACKER_VERSION=1.1.1
+PACKER_VERSION=1.1.3
 </propertiesContent>
       </info>
     </EnvInjectBuilder>
@@ -336,7 +348,7 @@ echo &quot;---&gt; packer-install.sh&quot;
 
 # $PACKER_VERSION        : Define a packer version passed as job paramter
 
-PACKER_VERSION=&quot;${PACKER_VERSION:-1.0.2}&quot;
+PACKER_VERSION=&quot;${PACKER_VERSION:-1.1.3}&quot;
 
 # Ensure we fail the job if any steps fail.
 set -eu -o pipefail
@@ -388,7 +400,7 @@ export PACKER_LOG_PATH=&quot;$PACKER_BUILD_LOG&quot; &amp;&amp; \
                         &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;
 
 # Retrive the list of cloud providers
-clouds=($(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;))
+mapfile -t clouds &lt; &lt;(jq -r '.builders[].name' &quot;../packer/templates/$PACKER_TEMPLATE.json&quot;)
 
 # Split public/private clouds logs
 for cloud in &quot;${clouds[@]}&quot;; do
@@ -455,9 +467,9 @@ SAR_DIR=&quot;$WORKSPACE/archives/sar-reports&quot;
 mkdir -p &quot;$SAR_DIR&quot;
 cp &quot;$SYSSTAT_PATH/&quot;* &quot;$_&quot;
 # convert sar data to ascii format
-while IFS=&quot;&quot; read -r s
+while IFS=&quot;&quot; read -r sarfilenum
 do
-    [ -f &quot;$s&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$s&quot; &gt; &quot;$SAR_DIR/sar${s//[!0-9]/}&quot;
+    [ -f &quot;$sarfilenum&quot; ] &amp;&amp; LC_TIME=POSIX sar -A -f &quot;$sarfilenum&quot; &gt; &quot;$SAR_DIR/sar${sarfilenum//[!0-9]/}&quot;
 done &lt; &lt;(find &quot;$SYSSTAT_PATH&quot; -name &quot;sa[0-9]*&quot; || true)
 
 # DON'T fail build if script fails.
@@ -504,7 +516,7 @@ machine=$(echo &quot;$NEXUS_URL&quot; | awk -F/ '{print $3}')
 user=$(echo &quot;$CREDENTIAL&quot; | cut -f1 -d:)
 pass=$(echo &quot;$CREDENTIAL&quot; | cut -f2 -d:)
 
-echo &quot;machine $machine login $user password $pass&quot; &gt; ~/.netrc
+echo &quot;machine ${machine%:*} login $user password $pass&quot; &gt; ~/.netrc
 </command>
         </hudson.tasks.Shell>
         <hudson.tasks.Shell>
@@ -692,5 +704,14 @@ rm ~/.netrc
       <user>test-credential</user>
     </com.cloudbees.jenkins.plugins.sshagent.SSHAgentBuildWrapper>
     <jenkins.plugins.openstack.compute.JCloudsOneOffSlave/>
+    <org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper plugin="config-file-provider">
+      <managedFiles>
+        <org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
+          <fileId>npmrc</fileId>
+          <targetLocation>$HOME/.npmrc</targetLocation>
+          <variable/>
+        </org.jenkinsci.plugins.configfiles.buildwrapper.ManagedFile>
+      </managedFiles>
+    </org.jenkinsci.plugins.configfiles.buildwrapper.ConfigFileBuildWrapper>
   </buildWrappers>
 </project>