From: Thanh Ha Date: Thu, 11 Jan 2018 23:27:16 +0000 (-0500) Subject: Enable pyenv if available in image X-Git-Tag: v0.15.0~19 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F70%2F8370%2F2;p=releng%2Fglobal-jjb.git Enable pyenv if available in image We need pyenv so that tox can pull in Python versions provided by the pyenv setup. Issue: RT-50802 Change-Id: I406f28e10e2d701f5f8fd396fea10d81bffd61a8 Co-authored-by: Vanessa Rene Valderrama Signed-off-by: Thanh Ha --- diff --git a/.jjb-test/expected-xml/gerrit-python-tox-verify-master b/.jjb-test/expected-xml/gerrit-python-tox-verify-master index aaaaa4d7..c1d49569 100644 --- a/.jjb-test/expected-xml/gerrit-python-tox-verify-master +++ b/.jjb-test/expected-xml/gerrit-python-tox-verify-master @@ -319,9 +319,14 @@ set -e -o pipefail ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox" mkdir -p "$ARCHIVE_TOX_DIR" - cd "$WORKSPACE/$TOX_DIR" +if [ -d "/opt/pyenv" ]; then + echo "---> Setting up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" +fi + if [ ! -z "$TOX_ENVS" ]; then detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log" else diff --git a/.jjb-test/expected-xml/github-python-tox-verify-master b/.jjb-test/expected-xml/github-python-tox-verify-master index 7081949f..d04f71ea 100644 --- a/.jjb-test/expected-xml/github-python-tox-verify-master +++ b/.jjb-test/expected-xml/github-python-tox-verify-master @@ -281,9 +281,14 @@ set -e -o pipefail ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox" mkdir -p "$ARCHIVE_TOX_DIR" - cd "$WORKSPACE/$TOX_DIR" +if [ -d "/opt/pyenv" ]; then + echo "---> Setting up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" +fi + if [ ! -z "$TOX_ENVS" ]; then detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log" else diff --git a/shell/tox-run.sh b/shell/tox-run.sh index 97f8855b..0eae0f18 100644 --- a/shell/tox-run.sh +++ b/shell/tox-run.sh @@ -16,9 +16,14 @@ set -e -o pipefail ARCHIVE_TOX_DIR="$WORKSPACE/archives/tox" mkdir -p "$ARCHIVE_TOX_DIR" - cd "$WORKSPACE/$TOX_DIR" +if [ -d "/opt/pyenv" ]; then + echo "---> Setting up pyenv" + export PYENV_ROOT="/opt/pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" +fi + if [ ! -z "$TOX_ENVS" ]; then detox -e "$TOX_ENVS" | tee -a "$ARCHIVE_TOX_DIR/detox.log" else