From: Matthew Watkins Date: Tue, 6 Dec 2022 10:37:59 +0000 (+0000) Subject: Fix: Ensure tox is run under Python3 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=ci-management.git;a=commitdiff_plain;h=1a16d1d25ca0f16cb14af1f62847ccea6297b6cc Fix: Ensure tox is run under Python3 Issue-ID: CCSDK-3820 Signed-off-by: Matthew Watkins Change-Id: Ic5276c18e29af97e9a201fccba9074bece5e8e23 --- diff --git a/jjb/global-templates-python.yaml b/jjb/global-templates-python.yaml index 6f3c8363d..df37064c2 100644 --- a/jjb/global-templates-python.yaml +++ b/jjb/global-templates-python.yaml @@ -59,12 +59,25 @@ settings-file: '{mvn-settings}' - shell: | #!/bin/bash - virtualenv $WORKSPACE/venv-tox - source $WORKSPACE/venv-tox/bin/activate - pip install --upgrade pip - pip install --upgrade tox argparse - pip freeze - cd $WORKSPACE/{path} + # shellcheck disable=SC1090 + source ~/lf-env.sh + + lf-activate-venv --python python3.8 --venv-file /tmp/.toxenv \ + tox tox-pyenv virtualenv + + 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 + + # Useful debugging + python --version + tox --version + tox publishers: