Allow tox-install to handle base python ver
[releng/global-jjb.git] / .jjb-test / expected-xml / gerrit-python-tox-verify-master
index 9393044..30f2729 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>
@@ -274,6 +274,11 @@ lftools --version
 # pipdeptree
 </command>
     </hudson.tasks.Shell>
+    <EnvInjectBuilder>
+      <info>
+        <propertiesContent>PYTHON_VERSION=python3</propertiesContent>
+      </info>
+    </EnvInjectBuilder>
     <hudson.tasks.Shell>
       <command>#!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
@@ -291,17 +296,19 @@ echo &quot;---&gt; tox-install.sh&quot;
 # DO NOT set -u as virtualenv's activate script has unbound variables
 set -e -o pipefail
 
-virtualenv --quiet &quot;/tmp/v/tox&quot;
+virtualenv --quiet -p &quot;$PYTHON_VERSION&quot; &quot;/tmp/v/tox&quot;
 # shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
 source &quot;/tmp/v/tox/bin/activate&quot;
 pip install --quiet --upgrade pip
 pip install --quiet --upgrade pipdeptree
-pip install --quiet --upgrade tox argparse
+pip install --quiet --upgrade argparse detox tox tox-pyenv
 
 echo &quot;----&gt; Pip Dependency Tree&quot;
 pipdeptree
-
-#!/bin/bash
+</command>
+    </hudson.tasks.Shell>
+    <hudson.tasks.Shell>
+      <command>#!/bin/bash
 # SPDX-License-Identifier: EPL-1.0
 ##############################################################################
 # Copyright (c) 2017 The Linux Foundation and others.
@@ -313,44 +320,34 @@ pipdeptree
 ##############################################################################
 echo &quot;---&gt; tox-run.sh&quot;
 
+# shellcheck source=/tmp/v/tox/bin/activate disable=SC1091
+source &quot;/tmp/v/tox/bin/activate&quot;
+
 # Ensure we fail the job if any steps fail.
 # 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 [ -z &quot;$TOX_ENVS&quot; ]; then
-    TOX_ENVS=$(crudini --get tox.ini tox envlist)
+if [ -d &quot;/opt/pyenv&quot; ]; then
+    echo &quot;---&gt; Setting up pyenv&quot;
+    export PYENV_ROOT=&quot;/opt/pyenv&quot;
+    export PATH=&quot;$PYENV_ROOT/bin:$PATH&quot;
 fi
 
-run_tox() {
-    local log_dir=&quot;$1&quot;
-    local env=&quot;$2&quot;
-
-    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[*]}
+if [ ! -z &quot;$TOX_ENVS&quot; ]; then
+    detox -e &quot;$TOX_ENVS&quot;  | tee -a &quot;$ARCHIVE_TOX_DIR/detox.log&quot;
 else
-    for env in &quot;${TOX_ENVS[@]}&quot;; do
-        run_tox &quot;$ARCHIVE_TOX_DIR&quot; &quot;$env&quot;
-    done
+    detox | tee -a &quot;$ARCHIVE_TOX_DIR/detox.log&quot;
 fi
 
-if [ -f &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot; ]; then
-    failed_envs=($(cat &quot;$ARCHIVE_TOX_DIR/failed-envs.log&quot;))
-    echo &quot;ERROR: Failed the following builds: ${failed_envs[*]}&quot;
-    exit 1
-fi
+# Disable SC2116 as we want to echo a space separated list of TOX_ENVS
+# shellcheck disable=SC2116
+for i in $(echo &quot;${TOX_ENVS//,/ }&quot;); do
+    cp -r &quot;.tox/$i/log&quot; &quot;$ARCHIVE_TOX_DIR/$i&quot;
+done
 
 echo &quot;Completed tox runs.&quot;
 </command>
@@ -396,9 +393,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.
@@ -435,7 +432,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 \
@@ -445,7 +442,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>
@@ -561,7 +558,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;
 
@@ -633,5 +630,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>