Merge "Lift PyPI templates to Global-JJB from Acumos" v0.44.0
authorJessica Wagantall <jwagantall@linuxfoundation.org>
Wed, 25 Sep 2019 10:10:53 +0000 (10:10 +0000)
committerGerrit Code Review <gerrit@linuxfoundation.org>
Wed, 25 Sep 2019 10:10:53 +0000 (10:10 +0000)
docs/jjb/lf-release-jobs.rst
jjb/lf-python-jobs.yaml
shell/packer-build.sh
shell/python-tools-install.sh
shell/release-job.sh
shell/tox-run.sh

index 4ef52ad..3df7f8d 100644 (file)
@@ -227,8 +227,8 @@ Jenkins configure -> Global properties -> Environment variables
 
 .. note::
 
-    These also need to be added to your global-vars-$SILO.sh
-    or they will be overwritten.
+    Add these variables to your global-vars-$SILO.sh file or they will
+    be overwritten.
 
 Jenkins configure -> Managed Files -> Add a New Config -> Custom File
 
index de38fa1..e28bc22 100644 (file)
     mvn-version: mvn35
     parallel: true
     pre-build-script: "# pre-build script goes here"
-    python-version: python2
+    python-version: python3
     sonar-mvn-goal: "sonar:sonar"
     stream: master
     submodule-recursive: true
     github-url: "https://github.com"
     parallel: false
     pre-build-script: "# pre-build script goes here"
-    python-version: python2
+    python-version: python3
     stream: master
     submodule-recursive: true
     submodule-timeout: 10
index dfacdeb..b015271 100644 (file)
@@ -44,8 +44,8 @@ packer.io build -color=false \
 # Extract image name from log and store value in the downstream job
 if [[ ${UPDATE_CLOUD_IMAGE} ]]; then
 
-    NEW_IMAGE_NAME=$(grep -P '(\s+.*image: )(ZZCI\s+.*\d+-\d+\.\d+)' "$PACKER_BUILD_LOG" \
-                  | awk -F': ' '{print $4}')\")
+    NEW_IMAGE_NAME=$(grep -P '(\s+.*image: )(ZZCI\s+.*\d+-\d+\.\d+)' \
+                          "$PACKER_BUILD_LOG" | awk -F': ' '{print $4}')
 
     echo NEW_IMAGE_NAME="$NEW_IMAGE_NAME" >> "$WORKSPACE/variables.prop"
     echo "NEW_IMAGE_NAME: ${NEW_IMAGE_NAME}"
index be6d181..1f5beec 100644 (file)
@@ -19,7 +19,7 @@ pip_list_pre=/tmp/pip-list-pre.txt
 pip_list_post=/tmp/pip-list-post.txt
 pip_list_diffs=/tmp/pip-list-diffs.txt
 if [[ -f $pip_list_pre ]]; then
-    pip list > $pip_list_post
+    python3 -m pip list > $pip_list_post
     echo "Compare pip packages before/after..."
     if diff --suppress-common-lines $pip_list_pre $pip_list_post \
             | tee $pip_list_diffs; then
@@ -33,7 +33,7 @@ if [[ -f $pip_list_pre ]]; then
     # log-deploy.sh script is 'appended' to this file and it would not
     # be executed.
 else
-    pip list > "$pip_list_pre"
+    python3 -m pip list > "$pip_list_pre"
     # These 'pip installs' only need to be executed during pre-build
 
     requirements_file=$(mktemp /tmp/requirements-XXXX.txt)
@@ -44,20 +44,18 @@ else
 
     echo "Generating Requirements File"
     cat << 'EOF' > "$requirements_file"
-lftools[openstack]~=0.26.2
-python-cinderclient~=4.3.0
-python-heatclient~=1.16.1
-python-openstackclient~=3.16.0
-dogpile.cache~=0.6.8  # Version 0.7.[01] seems to break openstackclient
-more-itertools~=5.0.0
-niet~=1.4.2 # Extract values from yaml
-tox>=3.7.0. # Tox 3.7 or greater is necessary for parallel mode support
-yq~=2.7.2
+lftools[openstack]
+python-heatclient
+python-openstackclient
+niet~=1.4.2
+tox>=3.7.0 # Tox 3.7 or greater is necessary for parallel mode support
+yq
 EOF
 
     # Use `python -m pip` to ensure we are using the latest version of pip
-    python -m pip install --user --quiet --upgrade pip
-    python -m pip install --user --quiet --upgrade setuptools
-    python -m pip install --user --quiet --upgrade -r "$requirements_file"
+    python3 -m venv ~/.local
+    python3 -m pip install --user --quiet --upgrade pip
+    python3 -m pip install --user --quiet --upgrade setuptools
+    python3 -m pip install --user --quiet --upgrade -r "$requirements_file"
     rm -rf "$requirements_file"
 fi
index c27a87f..b764ac1 100644 (file)
 echo "---> release-job.sh"
 set -eu -o pipefail
 
-#Python bits. Remove when centos 7.7 builder is avaliable.
-if [ -d "/opt/pyenv" ]; then
-    echo "INFO: Setting up pyenv"
-    export PYENV_ROOT="/opt/pyenv"
-    export PATH="$PYENV_ROOT/bin:$PATH"
-fi
-PYTHONPATH=$(pwd)
-export PYTHONPATH
-
-latest_version=$(pyenv versions \
-  | sed s,*,,g \
-  | awk '/[0-9]+/{ print $1 }' \
-  | sort --version-sort \
-  | awk '/./{line=$0} END{print line}')
-
-pyenv local "$latest_version"
-
-export PYENV_VERSION="$latest_version"
-pip install --user lftools[nexus] jsonschema niet yq
+set +u
+python3 -m venv /tmp/v/venv/
+# shellcheck disable=SC1091
+source /tmp/v/venv/bin/activate
+set -u
+python -m pip install lftools[nexus] jsonschema niet yq
 
 #Functions.
 
index c159891..8be8459 100644 (file)
 ##############################################################################
 echo "---> tox-run.sh"
 
-# 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="$WORKSPACE/archives/tox"
 mkdir -p "$ARCHIVE_TOX_DIR"
-cd "$WORKSPACE/$TOX_DIR"
+cd "$WORKSPACE/$TOX_DIR" || exit 1
 
 if [ -d "/opt/pyenv" ]; then
     echo "---> Setting up pyenv"
     export PYENV_ROOT="/opt/pyenv"
     export PATH="$PYENV_ROOT/bin:$PATH"
+    PYTHONPATH="$(pwd)"
+    export PYTHONPATH
+    export TOX_TESTENV_PASSENV=PYTHONPATH
 fi
 
-# Set and pass in PYTHONPATH to circumvent installation bug in tox>=3.2.0
-PYTHONPATH=$(pwd)
-export PYTHONPATH
-export TOX_TESTENV_PASSENV=PYTHONPATH
-
-set +e  # Allow detox to fail so that we can collect the logs in the next step
-
 PARALLEL="${PARALLEL:-true}"
 if [ "${PARALLEL}" = true ]; then
     if [ -n "$TOX_ENVS" ]; then
@@ -56,7 +48,6 @@ for i in .tox/*/log; do
     tox_env=$(echo "$i" | awk -F'/' '{print $2}')
     cp -r "$i" "$ARCHIVE_TOX_DIR/$tox_env"
 done
-set -e  # Logs collected so re-enable
 
 echo "Completed tox runs."