From 5320005564017416e6ed93a12be2553c2e381840 Mon Sep 17 00:00:00 2001 From: Thanh Ha Date: Thu, 13 Sep 2018 15:31:30 -0400 Subject: [PATCH] Use --user for tox install instead of virtualenv Allows us to remove the workaround of installing lftools in a venv before as the virtualenvs should no longer be conflicting. Change-Id: Ic466cd74a568e0de2fbb0f3fd75205cd04c1e3f9 Signed-off-by: Thanh Ha --- jjb/lf-python-jobs.yaml | 6 +----- releasenotes/notes/local-user-pip-5ce9da99fc86fb97.yaml | 6 ++++++ shell/python-tools-install.sh | 1 + shell/tox-install.sh | 8 ++------ shell/tox-run.sh | 5 +---- 5 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 releasenotes/notes/local-user-pip-5ce9da99fc86fb97.yaml diff --git a/jjb/lf-python-jobs.yaml b/jjb/lf-python-jobs.yaml index 2c30a46d..c3bd91bb 100644 --- a/jjb/lf-python-jobs.yaml +++ b/jjb/lf-python-jobs.yaml @@ -446,11 +446,7 @@ jenkins-ssh-credential: '{jenkins-ssh-credential}' builders: - - shell: !include-raw-escape: - # Workaround issue where the tox run later breaks the lftools virtualenv. - # Without running the install first the run in the publisher will fail - # due to missing lftools because it gets installed into a tox venv. - - ../shell/lftools-install.sh + - lf-infra-pre-build - lf-infra-tox-install: python-version: '{python-version}' - shell: !include-raw-escape: ../shell/tox-run.sh diff --git a/releasenotes/notes/local-user-pip-5ce9da99fc86fb97.yaml b/releasenotes/notes/local-user-pip-5ce9da99fc86fb97.yaml new file mode 100644 index 00000000..b4797520 --- /dev/null +++ b/releasenotes/notes/local-user-pip-5ce9da99fc86fb97.yaml @@ -0,0 +1,6 @@ +--- +fixes: + - | + Fix the lftools virtualenv workaround we had to put in place in + the tox-verify job by using ``pip install --user`` for global tool + installs. diff --git a/shell/python-tools-install.sh b/shell/python-tools-install.sh index c57609ca..74c6b9d1 100644 --- a/shell/python-tools-install.sh +++ b/shell/python-tools-install.sh @@ -19,6 +19,7 @@ python-heatclient~=1.16.1 python-openstackclient~=3.16.0 EOF +# Use `python -m pip` to ensure we are using the latest version of pip python -m pip install --user --quiet --upgrade pip~=18.0 setuptools~=40.2.0 python -m pip install --user --quiet --upgrade -r "$REQUIREMENTS_FILE" pip freeze diff --git a/shell/tox-install.sh b/shell/tox-install.sh index 9e50ead4..3aceceb2 100644 --- a/shell/tox-install.sh +++ b/shell/tox-install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -14,11 +14,7 @@ echo "---> tox-install.sh" # DO NOT set -u as virtualenv's activate script has unbound variables set -e -o pipefail -virtualenv --quiet -p "$PYTHON_VERSION" "/tmp/v/tox" -# shellcheck source=/tmp/v/tox/bin/activate disable=SC1091 -source "/tmp/v/tox/bin/activate" -pip install --quiet --upgrade "pip==9.0.3" setuptools -pip install --quiet --upgrade argparse detox "tox<3.0.0" tox-pyenv +python -m pip install --user --quiet --upgrade argparse detox "tox<3.0.0" tox-pyenv echo "----> pip freeze" pip freeze diff --git a/shell/tox-run.sh b/shell/tox-run.sh index 6b451166..47380010 100644 --- a/shell/tox-run.sh +++ b/shell/tox-run.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash -l # SPDX-License-Identifier: EPL-1.0 ############################################################################## # Copyright (c) 2017 The Linux Foundation and others. @@ -10,9 +10,6 @@ ############################################################################## echo "---> tox-run.sh" -# shellcheck source=/tmp/v/tox/bin/activate disable=SC1091 -source "/tmp/v/tox/bin/activate" - # 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 -- 2.16.6