From: Jessica Wagantall Date: Wed, 25 Sep 2019 10:10:53 +0000 (+0000) Subject: Merge "Lift PyPI templates to Global-JJB from Acumos" X-Git-Tag: v0.44.0 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Ftags%2Fv0.44.0;hp=2ded6bf745aeb45cd14f9d09bd5822ebaf2bc1a2;p=releng%2Fglobal-jjb.git Merge "Lift PyPI templates to Global-JJB from Acumos" --- diff --git a/docs/jjb/lf-release-jobs.rst b/docs/jjb/lf-release-jobs.rst index 4ef52ad7..3df7f8d3 100644 --- a/docs/jjb/lf-release-jobs.rst +++ b/docs/jjb/lf-release-jobs.rst @@ -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 diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index de38fa1b..e28bc22b 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -265,7 +265,7 @@ 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 @@ -431,7 +431,7 @@ 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 diff --git a/shell/packer-build.sh b/shell/packer-build.sh index dfacdeb7..b015271c 100644 --- a/shell/packer-build.sh +++ b/shell/packer-build.sh @@ -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}" diff --git a/shell/python-tools-install.sh b/shell/python-tools-install.sh index be6d1810..1f5beec0 100644 --- a/shell/python-tools-install.sh +++ b/shell/python-tools-install.sh @@ -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 diff --git a/shell/release-job.sh b/shell/release-job.sh index c27a87f8..b764ac19 100644 --- a/shell/release-job.sh +++ b/shell/release-job.sh @@ -11,25 +11,12 @@ 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. diff --git a/shell/tox-run.sh b/shell/tox-run.sh index c1598917..8be8459f 100644 --- a/shell/tox-run.sh +++ b/shell/tox-run.sh @@ -10,27 +10,19 @@ ############################################################################## 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."