From 7c901fa0457758d9e428ed5071c00eaf2e23c0be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Soko=C5=82owski?= Date: Mon, 15 Apr 2024 15:06:28 +0300 Subject: [PATCH] ci: use virtualenv to avoid race conditions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Desktop QA tests also use Pytest packages and their versions are different, so we can't install them globally, it needs to be done per build using `WORKSPACE_TMP` as destination. Signed-off-by: Jakub SokoĊ‚owski --- ci/tests/Jenkinsfile.e2e-nightly | 9 ++++++++- ci/tests/Jenkinsfile.e2e-prs | 9 ++++++++- ci/tests/Jenkinsfile.e2e-upgrade | 8 +++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/ci/tests/Jenkinsfile.e2e-nightly b/ci/tests/Jenkinsfile.e2e-nightly index 75156ee4e9..9c17a6d254 100644 --- a/ci/tests/Jenkinsfile.e2e-nightly +++ b/ci/tests/Jenkinsfile.e2e-nightly @@ -36,6 +36,12 @@ pipeline { )) } + environment { + /* Avoid race conditions with other builds using virtualenv. */ + VIRTUAL_ENV = "${WORKSPACE_TMP}/venv" + PATH = "${VIRTUAL_ENV}/bin:${PATH}" + } + stages { stage('Fetch') { steps { script { @@ -52,7 +58,8 @@ pipeline { stage('Setup') { steps { script { dir('test/appium') { - sh 'pip3 install --user -r requirements.txt' + sh "python3 -m venv ${VIRTUAL_ENV}" + sh 'pip3 install -r requirements.txt' } } } } diff --git a/ci/tests/Jenkinsfile.e2e-prs b/ci/tests/Jenkinsfile.e2e-prs index 7cbf6a17c4..4dcf06b32a 100644 --- a/ci/tests/Jenkinsfile.e2e-prs +++ b/ci/tests/Jenkinsfile.e2e-prs @@ -54,6 +54,12 @@ pipeline { )) } + environment { + /* Avoid race conditions with other builds using virtualenv. */ + VIRTUAL_ENV = "${WORKSPACE_TMP}/venv" + PATH = "${VIRTUAL_ENV}/bin:${PATH}" + } + stages { stage('Prep') { steps { script { @@ -79,7 +85,8 @@ pipeline { stage('Setup') { steps { script { dir('test/appium') { - sh 'pip3 install --user -r requirements.txt' + sh "python3 -m venv ${VIRTUAL_ENV}" + sh 'pip3 install -r requirements.txt' } } } } diff --git a/ci/tests/Jenkinsfile.e2e-upgrade b/ci/tests/Jenkinsfile.e2e-upgrade index 56ed8f9573..eeb9771bec 100644 --- a/ci/tests/Jenkinsfile.e2e-upgrade +++ b/ci/tests/Jenkinsfile.e2e-upgrade @@ -35,6 +35,11 @@ pipeline { )) } + environment { + /* Avoid race conditions with other builds using virtualenv. */ + VIRTUAL_ENV = "${WORKSPACE_TMP}/venv" + PATH = "${VIRTUAL_ENV}/bin:${PATH}" + } stages { stage('Prep') { @@ -51,7 +56,8 @@ pipeline { stage('Setup') { steps { script { dir('test/appium') { - sh 'pip3 install --user -r requirements.txt' + sh "python3 -m venv ${VIRTUAL_ENV}" + sh 'pip3 install -r requirements.txt' } } } }