[PATCH 13/20] CI: Ensure pip install is always performed in venv
Jiaxun Yang
jiaxun.yang at flygoat.com
Tue Jun 11 23:04:12 CEST 2024
Since Ubuntu focal it's nolonger permitted to perform global
pip install.
Ensure that pip install is always performed in venv.
For buildman alone, all dependencies are already in docker
so there is no need to perform pip install.
Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
---
.azure-pipelines.yml | 16 ++++++++++------
.gitlab-ci.yml | 13 ++++++++-----
2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml
index 37b569b13ab0..2506814725e1 100644
--- a/.azure-pipelines.yml
+++ b/.azure-pipelines.yml
@@ -150,6 +150,8 @@ stages:
- script: |
git config --global --add safe.directory $(work_dir)
export USER=azure
+ virtualenv -p /usr/bin/python3 /tmp/venv
+ . /tmp/venv/bin/activate
pip install -r test/py/requirements.txt
pip install -r tools/buildman/requirements.txt
pip install asteval pylint==3.2.3 pyopenssl
@@ -183,7 +185,10 @@ stages:
image: $(ci_runner_image)
options: $(container_option)
steps:
- - script: make pip
+ - script: |
+ virtualenv -p /usr/bin/python3 /tmp/venv
+ . /tmp/venv/bin/activate
+ make pip
- job: create_test_py_wrapper_script
displayName: 'Create and stage a wrapper for test.py runs'
@@ -217,7 +222,11 @@ stages:
if [ -n "\${BUILD_ENV}" ]; then
export \${BUILD_ENV};
fi
+ virtualenv -p /usr/bin/python3 /tmp/venv
+ . /tmp/venv/bin/activate
pip install -r tools/buildman/requirements.txt
+ pip install -r test/py/requirements.txt
+ pip install pytest-azurepipelines
tools/buildman/buildman -o \${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e --board \${TEST_PY_BD} \${OVERRIDE}
cp ~/grub_x86.efi \${UBOOT_TRAVIS_BUILD_DIR}/
cp ~/grub_x64.efi \${UBOOT_TRAVIS_BUILD_DIR}/
@@ -241,10 +250,6 @@ stages:
/opt/coreboot/cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom remove -n fallback/payload;
/opt/coreboot/cbfstool \${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f \${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
fi
- virtualenv -p /usr/bin/python3 /tmp/venv
- . /tmp/venv/bin/activate
- pip install -r test/py/requirements.txt
- pip install pytest-azurepipelines
export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:\${PATH}
export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci
# "\${var:+"-k \$var"}" expands to "" if \$var is empty, "-k \$var" if not
@@ -504,7 +509,6 @@ stages:
# make environment variables available as tests are running inside a container
export BUILDMAN="${BUILDMAN}"
git config --global --add safe.directory ${WORK_DIR}
- pip install -r tools/buildman/requirements.txt
EOF
cat << "EOF" >> build.sh
if [[ "${BUILDMAN}" != "" ]]; then
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 18c4c430c63d..4c17abea468a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,6 +50,10 @@ stages:
- if [ -n "${BUILD_ENV}" ]; then
export ${BUILD_ENV};
fi
+ - virtualenv -p /usr/bin/python3 /tmp/venv
+ - . /tmp/venv/bin/activate
+ - pip install -r tools/buildman/requirements.txt
+ - pip install -r test/py/requirements.txt
- tools/buildman/buildman -o ${UBOOT_TRAVIS_BUILD_DIR} -w -E -W -e
--board ${TEST_PY_BD} ${OVERRIDE}
- cp ~/grub_x86.efi $UBOOT_TRAVIS_BUILD_DIR/
@@ -74,9 +78,6 @@ stages:
/opt/coreboot/cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom remove -n fallback/payload;
/opt/coreboot/cbfstool ${UBOOT_TRAVIS_BUILD_DIR}/coreboot.rom add-flat-binary -f ${UBOOT_TRAVIS_BUILD_DIR}/u-boot.bin -n fallback/payload -c LZMA -l 0x1110000 -e 0x1110000;
fi
- - virtualenv -p /usr/bin/python3 /tmp/venv
- - . /tmp/venv/bin/activate
- - pip install -r test/py/requirements.txt
# "${var:+"-k $var"}" expands to "" if $var is empty, "-k $var" if not
- export PATH=/opt/qemu/bin:/tmp/uboot-test-hooks/bin:${PATH};
export PYTHONPATH=/tmp/uboot-test-hooks/py/travis-ci;
@@ -100,7 +101,6 @@ build all 32bit ARM platforms:
script:
- ret=0;
git config --global --add safe.directory "${CI_PROJECT_DIR}";
- pip install -r tools/buildman/requirements.txt;
./tools/buildman/buildman -o /tmp -PEWM arm -x aarch64 || ret=$?;
if [[ $ret -ne 0 ]]; then
./tools/buildman/buildman -o /tmp -seP;
@@ -114,7 +114,6 @@ build all 64bit ARM platforms:
- . /tmp/venv/bin/activate
- ret=0;
git config --global --add safe.directory "${CI_PROJECT_DIR}";
- pip install -r tools/buildman/requirements.txt;
./tools/buildman/buildman -o /tmp -PEWM aarch64 || ret=$?;
if [[ $ret -ne 0 ]]; then
./tools/buildman/buildman -o /tmp -seP;
@@ -212,6 +211,8 @@ Run pylint:
extends: .testsuites
script:
- git config --global --add safe.directory "${CI_PROJECT_DIR}"
+ - virtualenv -p /usr/bin/python3 /tmp/venv;
+ - . /tmp/venv/bin/activate;
- pip install -r test/py/requirements.txt
- pip install -r tools/buildman/requirements.txt
- pip install asteval pylint==3.2.3 pyopenssl
@@ -240,6 +241,8 @@ Check for pre-schema tags:
Check packing of Python tools:
extends: .testsuites
script:
+ - virtualenv -p /usr/bin/python3 /tmp/venv;
+ - . /tmp/venv/bin/activate;
- make pip
# Test sandbox with test.py
--
2.43.0
More information about the U-Boot
mailing list