From 5bb89d95c5a3a164a75b38819c2c58c80f44c020 Mon Sep 17 00:00:00 2001 From: Tim McCormack Date: Fri, 1 May 2020 13:33:38 -0400 Subject: [PATCH] Revert "Revert "Fix Jenkins virtualenv issue that masked stale dependency" (#23828)" (#23866) This reverts commit 70600d79d7e38563ebd50e11894e83610610431c. --- Makefile | 3 ++- scripts/jenkins-common.sh | 6 ++++++ scripts/xdist/prepare_xdist_nodes.sh | 13 +++++-------- scripts/xdist/setup_worker.sh | 27 +++++++++++++++++++++++++++ 4 files changed, 40 insertions(+), 9 deletions(-) create mode 100755 scripts/xdist/setup_worker.sh diff --git a/Makefile b/Makefile index 586ab8d884..887e609508 100644 --- a/Makefile +++ b/Makefile @@ -61,7 +61,8 @@ pull: ## update the Docker image used by "make shell" docker pull edxops/edxapp:latest requirements: ## install development environment requirements - pip install -qr requirements/edx/development.txt --exists-action w + pip install -qr requirements/edx/pip-tools.txt + pip-sync -q requirements/edx/development.txt requirements/edx/private.* shell: ## launch a bash shell in a Docker container with all edx-platform dependencies installed docker run -it -e "NO_PYTHON_UNINSTALL=1" -e "PIP_INDEX_URL=https://pypi.python.org/simple" -e TERM \ diff --git a/scripts/jenkins-common.sh b/scripts/jenkins-common.sh index b1a56b1f39..d4048817d9 100644 --- a/scripts/jenkins-common.sh +++ b/scripts/jenkins-common.sh @@ -45,6 +45,12 @@ fi # Activate the Python virtualenv source $VENV_PATH/edx-venv/bin/activate +# Hack to fix up egg-link files given that the virtualenv is not relocatable +sed -i "s|^/home/jenkins/shallow-clone|`pwd`|" -- \ + $VENV_PATH/edx-venv/lib/python*/site-packages/*.egg-link +pip install -qr requirements/edx/pip-tools.txt +pip-sync -q requirements/edx/testing.txt requirements/edx/django.txt + # add the node packages dir to PATH PATH=$PATH:node_modules/.bin diff --git a/scripts/xdist/prepare_xdist_nodes.sh b/scripts/xdist/prepare_xdist_nodes.sh index 8a4d964bc1..3d029c6f03 100644 --- a/scripts/xdist/prepare_xdist_nodes.sh +++ b/scripts/xdist/prepare_xdist_nodes.sh @@ -12,13 +12,13 @@ python scripts/xdist/pytest_worker_manager.py -a up -n ${XDIST_NUM_WORKERS} \ # Install the correct version of Django depending on which tox environment (if any) is in use if [[ -z ${TOXENV+x} ]] || [[ ${TOXENV} == 'null' ]]; then - DJANGO_REQUIREMENT="-r requirements/edx/django.txt" + DJANGO_REQUIREMENT="requirements/edx/django.txt" elif [[ ${TOXENV} == *'django20'* ]]; then - DJANGO_REQUIREMENT="-r requirements/edx/django20.txt" + DJANGO_REQUIREMENT="requirements/edx/django20.txt" elif [[ ${TOXENV} == *'django21'* ]]; then - DJANGO_REQUIREMENT="-r requirements/edx/django21.txt" + DJANGO_REQUIREMENT="requirements/edx/django21.txt" elif [[ ${TOXENV} == *'django22'* ]]; then - DJANGO_REQUIREMENT="-r requirements/edx/django.txt" + DJANGO_REQUIREMENT="requirements/edx/django.txt" fi ip_list=$(&2 "Usage: $0 -p python-version -d django-reqs-file" + exit 1 + ;; + esac +done + +venv_parent=/home/jenkins/edx-venv-${PYTHON_VERSION} +venv=$venv_parent/edx-venv +rm -rf $venv +tar -C $venv_parent -xf /home/jenkins/edx-venv_clean-${PYTHON_VERSION}.tar.gz +source $venv/bin/activate + +# Hack to fix up egg-link files given that the virtualenv is not relocatable +sed -i "s|\(^/home/jenkins\)/shallow-clone|\1/edx-platform|" -- \ + $venv/lib/python*/site-packages/*.egg-link +pip install -qr requirements/edx/pip-tools.txt +pip-sync -q requirements/edx/testing.txt "${DJANGO_REQUIREMENT}" + +mkdir reports