Fix branch variable in github scm
[releng/global-jjb.git] / .jjb-test / expected-xml / gerrit-python-tox-verify-master
index 06ad1f1..1fbb526 100644 (file)
@@ -166,7 +166,7 @@ Example: docs,py2,py3
       <allowTriggeringUnreviewedPatches>false</allowTriggeringUnreviewedPatches>
       <triggerOnEvents>
         <com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
-          <excludeDrafts>false</excludeDrafts>
+          <excludeDrafts>true</excludeDrafts>
           <excludeTrivialRebase>false</excludeTrivialRebase>
           <excludeNoCodeChange>false</excludeNoCodeChange>
         </com.sonyericsson.hudson.plugins.gerrit.trigger.hudsontrigger.events.PluginPatchsetCreatedEvent>
@@ -317,14 +317,50 @@ echo &quot;---&gt; tox-run.sh&quot;
 # DO NOT set -u as virtualenv's activate script has unbound variables
 set -e -o pipefail
 
+ARCHIVE_TOX_DIR=&quot;$WORKSPACE/archives/tox&quot;
+mkdir -p &quot;$ARCHIVE_TOX_DIR&quot;
+
 cd &quot;$WORKSPACE/$TOX_DIR&quot;
 
-if [ -n &quot;$TOX_ENVS&quot; ];
-then
-    tox -e &quot;$TOX_ENVS&quot;
+if [ -z &quot;$TOX_ENVS&quot; ]; then
+    TOX_ENVS=$(crudini --get tox.ini tox envlist)
+fi
+
+run_tox() {
+    local log_dir=&quot;$1&quot;
+    local env=&quot;$2&quot;
+
+    # Sleep a random 10 second interval to workaround tox sdist
+    # conflicts due to building in the same dist directory.
+    sleep $[ ( $RANDOM % 10 )  + 1 ]s
+
+    echo &quot;-----&gt; Running tox $env&quot;
+    if ! tox -e $env &gt; &quot;$log_dir/tox-$env.log&quot;; then
+        echo &quot;$env&quot; &gt;&gt; &quot;$log_dir/failed-envs.log&quot;
+    fi
+}
+
+TOX_ENVS=(${TOX_ENVS//,/ })
+if hash parallel 2&gt;/dev/null; then
+    export -f run_tox
+    parallel --jobs 200% &quot;run_tox $ARCHIVE_TOX_DIR {}&quot; ::: ${TOX_ENVS[*]}
 else
-    tox
+    for env in &quot;${TOX_ENVS[@]}&quot;; do
+        run_tox &quot;$ARCHIVE_TOX_DIR&quot; &quot;$env&quot;
+    done
 fi
+
+if [ -f &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot; ]; then
+    failed_envs=($(cat &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot;))
+    for e in &quot;${failed_envs[@]}&quot;; do
+        echo &quot;cat $ARCHIVE_TOX_DIR/tox-$e.log&quot;
+        cat &quot;$ARCHIVE_TOX_DIR/tox-$e.log&quot;
+    done
+    echo &quot;ERROR: Failed the following builds: ${failed_envs[*]}&quot;
+    exit 1
+fi
+
+echo &quot;Completed tox runs.&quot;
 </command>
     </hudson.tasks.Shell>
   </builders>
@@ -407,7 +443,7 @@ echo &quot;---&gt; create-netrc.sh&quot;
 # Ensure we fail the job if any steps fail.
 set -eu -o pipefail
 
-NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
+NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
 CREDENTIAL=$(xmlstarlet sel -N &quot;x=http://maven.apache.org/SETTINGS/1.0.0&quot; \
     -t -m &quot;/x:settings/x:servers/x:server[x:id='${SERVER_ID}']&quot; \
     -v x:username -o &quot;:&quot; -v x:password \
@@ -417,7 +453,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>
@@ -533,7 +569,7 @@ then
 
     echo &quot;WARNING: Logging server not set&quot;
 else
-    NEXUS_URL=&quot;${NEXUS_URL:-$NEXUSPROXY}&quot;
+    NEXUS_URL=&quot;${NEXUSPROXY:-$NEXUS_URL}&quot;
     NEXUS_PATH=&quot;${SILO}/${JENKINS_HOSTNAME}/${JOB_NAME}/${BUILD_NUMBER}&quot;
     BUILD_URL=&quot;${BUILD_URL}&quot;
 
@@ -605,5 +641,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>