From b8f451cf78f3eb176a6d7376891ff6197e95e7bb Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Tue, 20 Dec 2022 17:01:06 +0100 Subject: [PATCH 1/6] ci: use new vdsm-test container Update the cis workflow to use the new vdsm-test container at quay.io/ovirt/vdsm-test:. Modify the test scripts to activate the venv before running the tests, otherwise the tests will have missing dependencies that are only installed in the venv in the new containers. Signed-off-by: Albert Esteve --- .github/workflows/ci.yml | 8 ++++---- ci/lint.sh | 3 +++ ci/tests-storage.sh | 3 +++ ci/tests.sh | 3 +++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20221f6537..7b61978cee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: fail-fast: false matrix: distro: [centos-8, centos-9] - container: quay.io/ovirt/vdsm-test-${{ matrix.distro }} + container: quay.io/ovirt/vdsm-test:${{ matrix.distro }} steps: - uses: ovirt/checkout-action@main - name: Run linters @@ -26,7 +26,7 @@ jobs: matrix: distro: [centos-8, centos-9] container: - image: quay.io/ovirt/vdsm-test-${{ matrix.distro }} + image: quay.io/ovirt/vdsm-test:${{ matrix.distro }} # Required to create loop devices. options: --privileged steps: @@ -42,7 +42,7 @@ jobs: matrix: distro: [centos-8, centos-9] container: - image: quay.io/ovirt/vdsm-test-${{ matrix.distro }} + image: quay.io/ovirt/vdsm-test:${{ matrix.distro }} # Required to create loop devices. options: --privileged steps: @@ -58,7 +58,7 @@ jobs: matrix: distro: [centos-8, centos-9] container: - image: quay.io/ovirt/vdsm-test-${{ matrix.distro }} + image: quay.io/ovirt/vdsm-test:${{ matrix.distro }} # Needed for many operations, i.e. creating bridges options: --privileged steps: diff --git a/ci/lint.sh b/ci/lint.sh index 1237ffff95..47ca089949 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -3,6 +3,9 @@ # SPDX-FileCopyrightText: Red Hat, Inc. # SPDX-License-Identifier: GPL-2.0-or-later +# Activate the tests venv (for containers only) +[ -d /venv ] && source /venv/bin/activate + ./autogen.sh --system make make lint diff --git a/ci/tests-storage.sh b/ci/tests-storage.sh index c2de43ce65..694bc0ab83 100755 --- a/ci/tests-storage.sh +++ b/ci/tests-storage.sh @@ -56,6 +56,9 @@ if [ -z "$user" ]; then exit 1 fi +# Activate the tests venv (for containers only) +[ -d /venv ] && source /venv/bin/activate + echo "Running tests as user $user" setup_storage diff --git a/ci/tests.sh b/ci/tests.sh index 6b68babf3a..fcaccce837 100755 --- a/ci/tests.sh +++ b/ci/tests.sh @@ -9,6 +9,9 @@ echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6 SUFFIX=$RANDOM ip link add mod_bond$SUFFIX type bond && ip link del mod_bond$SUFFIX +# Activate the tests venv (for containers only) +[ -d /venv ] && source /venv/bin/activate + ./autogen.sh --system make make tests From e825dabf5a01215a269008510d29c0546e6e0825 Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Tue, 20 Dec 2022 17:04:52 +0100 Subject: [PATCH 2/6] ci: add alma-9 to tested distros Add alma-9 to the matrix of tested distros for vdsm-test repository. Signed-off-by: Albert Esteve --- .github/workflows/ci.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7b61978cee..23c2e9c863 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: strategy: fail-fast: false matrix: - distro: [centos-8, centos-9] + distro: [centos-8, centos-9, alma-9] container: quay.io/ovirt/vdsm-test:${{ matrix.distro }} steps: - uses: ovirt/checkout-action@main @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - distro: [centos-8, centos-9] + distro: [centos-8, centos-9, alma-9] container: image: quay.io/ovirt/vdsm-test:${{ matrix.distro }} # Required to create loop devices. @@ -40,7 +40,7 @@ jobs: strategy: fail-fast: false matrix: - distro: [centos-8, centos-9] + distro: [centos-8, centos-9, alma-9] container: image: quay.io/ovirt/vdsm-test:${{ matrix.distro }} # Required to create loop devices. @@ -56,7 +56,7 @@ jobs: strategy: fail-fast: false matrix: - distro: [centos-8, centos-9] + distro: [centos-8, centos-9, alma-9] container: image: quay.io/ovirt/vdsm-test:${{ matrix.distro }} # Needed for many operations, i.e. creating bridges From c39371878d350e8391a04a9768c35ba6592c2cca Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Mon, 20 Feb 2023 10:08:57 +0100 Subject: [PATCH 3/6] Makefile: add -- for pylint target Add -- to separate arguments from the tox command for the pylint target. Otherwise it fails with unrecognized arguments. Signed-off-by: Albert Esteve --- Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.am b/Makefile.am index c640aaca56..deacb0b785 100644 --- a/Makefile.am +++ b/Makefile.am @@ -72,7 +72,7 @@ gitignore: .PHONY: pylint pylint: tox - tox -e pylint \ + tox -e pylint -- \ $(PYLINT_TARGETS) execcmd: From a116cbd23d90c1557787ae0b9ab3edd8b32f4bf8 Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Mon, 20 Feb 2023 10:57:42 +0100 Subject: [PATCH 4/6] pywatch_test: fix has_py_gdb_support for el9 On CentOS Stream 9, debuginfo packages now include the minor version in the name, so has_py_gdb_support logic needed some rework to support this. Otherwise, it fails to find the gdb support package and fails the test_timeout_backtrace. Signed-off-by: Marcin Sobczyk Signed-off-by: Albert Esteve --- tests/pywatch_test.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/pywatch_test.py b/tests/pywatch_test.py index 520aebdebe..e4e0d0d5e2 100644 --- a/tests/pywatch_test.py +++ b/tests/pywatch_test.py @@ -43,14 +43,15 @@ def has_py_gdb_support(): pkg_name = "python{}".format(sys.version_info.major) pkg_ver = package_version(pkg_name) - # On CentOS we we don't have "python2" package and we must query "python" - # and "python-debuginfo". - if pkg_name == "python2" and not pkg_ver: - pkg_name = "python" - pkg_ver = package_version(pkg_name) - pkg_dbg_ver = package_version("{}-debuginfo".format(pkg_name)) + # On CentOS Stream 9 debuginfo packages now include the minor version in + # the name, i.e. python3.9-debuginfo-... + if pkg_dbg_ver == "": + pkg_name2 = "python{}.{}".format(sys.version_info.major, + sys.version_info.minor) + pkg_dbg_ver = package_version("{}-debuginfo".format(pkg_name2)) + return pkg_dbg_ver != "" and pkg_dbg_ver == pkg_ver From 28101bd6b28c1630cd4b401718bb2a5e013593ee Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Tue, 21 Feb 2023 10:44:08 +0100 Subject: [PATCH 5/6] ci/*.sh: add workaround for git dubious ownership Lint and test jobs are failing with git config --global --add safe.directory /__w/vdsm/vdsm fatal: detected dubious ownership in repository at '/__w/vdsm/vdsm' To add an exception for this directory, call: As suggested in [1], add current directory to the git safe list to avoid the issue. [1] https://github.com/actions/runner-images/issues/6775 Signed-off-by: Albert Esteve --- ci/lint.sh | 11 +++++++++-- ci/tests-storage.sh | 11 +++++++++-- ci/tests.sh | 11 +++++++++-- 3 files changed, 27 insertions(+), 6 deletions(-) diff --git a/ci/lint.sh b/ci/lint.sh index 47ca089949..a18987a405 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -3,8 +3,15 @@ # SPDX-FileCopyrightText: Red Hat, Inc. # SPDX-License-Identifier: GPL-2.0-or-later -# Activate the tests venv (for containers only) -[ -d /venv ] && source /venv/bin/activate +# Only when running in a container +[ -d /venv ] && { + # Workaround to avoid this warning: + # fatal: detected dubious ownership in repository at '/dir' + git config --global --add safe.directory "$(pwd)" + + # Activate the tests venv (for containers only) + source /venv/bin/activate +} ./autogen.sh --system make diff --git a/ci/tests-storage.sh b/ci/tests-storage.sh index 694bc0ab83..c1e5e9195b 100755 --- a/ci/tests-storage.sh +++ b/ci/tests-storage.sh @@ -56,8 +56,15 @@ if [ -z "$user" ]; then exit 1 fi -# Activate the tests venv (for containers only) -[ -d /venv ] && source /venv/bin/activate +# Only when running in a container +[ -d /venv ] && { + # Workaround to avoid this warning: + # fatal: detected dubious ownership in repository at '/dir' + git config --global --add safe.directory "$(pwd)" + + # Activate the tests venv (for containers only) + source /venv/bin/activate +} echo "Running tests as user $user" diff --git a/ci/tests.sh b/ci/tests.sh index fcaccce837..ed449dc743 100755 --- a/ci/tests.sh +++ b/ci/tests.sh @@ -9,8 +9,15 @@ echo 0 > /proc/sys/net/ipv6/conf/all/disable_ipv6 SUFFIX=$RANDOM ip link add mod_bond$SUFFIX type bond && ip link del mod_bond$SUFFIX -# Activate the tests venv (for containers only) -[ -d /venv ] && source /venv/bin/activate +# Only when running in a container +[ -d /venv ] && { + # Workaround to avoid this warning: + # fatal: detected dubious ownership in repository at '/dir' + git config --global --add safe.directory "$(pwd)" + + # Activate the tests venv (for containers only) + source /venv/bin/activate +} ./autogen.sh --system make From f90eeb3f275ca024f827e51795efa65ee13a7bf5 Mon Sep 17 00:00:00 2001 From: Albert Esteve Date: Tue, 21 Feb 2023 14:00:23 +0100 Subject: [PATCH 6/6] tox.ini: remove testenv from reuse Avoid inheriting from testenv for the reuse environment in tox. Testenv uses sitepackages for Python which is interfering somehow with the setup for reuse, which fails to recognize the current working directory as a VCS repository and fails with: reuse.project - WARNING - could not find supported VCS Signed-off-by: Albert Esteve --- tox.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index dc57e8f135..9c73bc806d 100644 --- a/tox.ini +++ b/tox.ini @@ -200,7 +200,7 @@ commands = ./lib/vdsm/network/ \ ./tests/network -[testenv:reuse] +[reuse] deps = reuse commands =