From 29c7619f0368384dd2e266610098a1f8d7a13813 Mon Sep 17 00:00:00 2001 From: Matej Matuska Date: Wed, 27 Aug 2025 20:04:28 +0200 Subject: [PATCH 09/55] Rename Containerfiles to consistent names The container files (both those used in CI and locally by the Makefile) and both build and test, use various base containers - Centos, UBIs. This patch unifies the naming scheme to Containerfile.elX to avoid making the user remember which one is used by which command an at which version. The containerfiles used by Github Actions are moved to separate folder to avoid name clashes. Also, in the GitHub actions test workflow the --security-opt=seccomp=unconfined is removed. Not sure why it was set in the first place, but seems it's not needed anymore. --- .github/workflows/unit-tests.yml | 24 ++++++++------ Makefile | 31 +++++++++---------- .../{Containerfile.ubi8 => Containerfile.el8} | 0 .../{Containerfile.ubi9 => Containerfile.el9} | 0 ...{Containerfile.rhel8 => Containerfile.el8} | 0 ...{Containerfile.rhel9 => Containerfile.el9} | 0 .../Containerfile.el8} | 0 .../Containerfile.el8-lint} | 0 .../Containerfile.el9} | 0 .../Containerfile.el9-lint} | 0 10 files changed, 30 insertions(+), 25 deletions(-) rename utils/container-builds/{Containerfile.ubi8 => Containerfile.el8} (100%) rename utils/container-builds/{Containerfile.ubi9 => Containerfile.el9} (100%) rename utils/container-tests/{Containerfile.rhel8 => Containerfile.el8} (100%) rename utils/container-tests/{Containerfile.rhel9 => Containerfile.el9} (100%) rename utils/container-tests/{Containerfile.ubi8 => ci/Containerfile.el8} (100%) rename utils/container-tests/{Containerfile.ubi8-lint => ci/Containerfile.el8-lint} (100%) rename utils/container-tests/{Containerfile.ubi9 => ci/Containerfile.el9} (100%) rename utils/container-tests/{Containerfile.ubi9-lint => ci/Containerfile.el9-lint} (100%) diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index ed82e0e5..cfcec437 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -19,36 +19,36 @@ jobs: - name: 'Unit tests (python:3.12; repos:el9toel10,common)' python: python3.12 repos: 'el9toel10,common' - container: ubi9 + container: el9 - name: 'Linters (python:3.12; repos:el9toel10,common)' python: python3.12 repos: 'el9toel10,common' - container: ubi9-lint + container: el9-lint - name: 'Unit tests (python:3.9; repos:el9toel10,common)' python: python3.9 repos: 'el9toel10,common' - container: ubi9 + container: el9 - name: 'Linters (python:3.9; repos:el9toel10,common)' python: python3.9 repos: 'el9toel10,common' - container: ubi9-lint + container: el9-lint # 8to9 - name: 'Unit tests (python:3.9; repos:el8toel9,common)' python: python3.9 repos: 'el8toel9,common' - container: ubi9 + container: el9 - name: 'Linters (python:3.9; repos:el8toel9,common)' python: python3.9 repos: 'el8toel9,common' - container: ubi9-lint + container: el9-lint - name: 'Unit tests (python:3.6; repos:el8toel9,common)' python: python3.6 repos: 'el8toel9,common' - container: ubi8 + container: el8 - name: 'Linters (python:3.6; repos:el8toel9,common)' python: python3.6 repos: 'el8toel9,common' - container: ubi8-lint + container: el8-lint steps: - name: Checkout code @@ -63,4 +63,10 @@ jobs: run: | git branch -f main origin/main - name: ${{matrix.scenarios.name}} - run: script -e -c /bin/bash -c 'TERM=xterm podman build --security-opt=seccomp=unconfined -t leapp-tests -f utils/container-tests/Containerfile.${{matrix.scenarios.container}} utils/container-tests && PYTHON_VENV=${{matrix.scenarios.python}} REPOSITORIES=${{matrix.scenarios.repos}} podman run --security-opt=seccomp=unconfined --rm -ti -v ${PWD}:/payload --env=PYTHON_VENV --env=REPOSITORIES leapp-tests' + run: | + script -e -c /bin/bash -c \ + 'TERM=xterm \ + podman build -t leapp-tests -f utils/container-tests/ci/Containerfile.${{matrix.scenarios.container}} . && \ + PYTHON_VENV=${{matrix.scenarios.python}} \ + REPOSITORIES=${{matrix.scenarios.repos}} \ + podman run --rm -ti -v ${PWD}:/payload --env=PYTHON_VENV --env=REPOSITORIES leapp-tests' diff --git a/Makefile b/Makefile index e0fc7e00..754c2c63 100644 --- a/Makefile +++ b/Makefile @@ -51,7 +51,7 @@ _COPR_CONFIG=$${COPR_CONFIG:-~/.config/copr_rh_oamg.conf} _CONTAINER_TOOL=$${CONTAINER_TOOL:-podman} # container to run tests in -_TEST_CONTAINER=$${TEST_CONTAINER:-rhel8} +_TEST_CONTAINER=$${TEST_CONTAINER:-el8} # In case just specific CHROOTs should be used for the COPR build, you can # set the multiple CHROOTs separated by comma in the COPR_CHROOT envar, e.g. @@ -129,7 +129,7 @@ help: @echo " test lint source code and run tests" @echo " test_no_lint run tests without linting the source code" @echo " test_container run lint and tests in container" - @echo " - default container is 'rhel8'" + @echo " - default container is 'el8'" @echo " - can be changed by setting TEST_CONTAINER env" @echo " test_container_all run lint and tests in all available containers" @echo " test_container_no_lint run tests without linting in container, see test_container" @@ -164,9 +164,9 @@ help: @echo " PR=7 SUFFIX='my_additional_suffix' make " @echo " MR=6 COPR_CONFIG='path/to/the/config/copr/file' make " @echo " ACTOR= TEST_LIBS=y make test" - @echo " BUILD_CONTAINER=rhel8 make build_container" + @echo " BUILD_CONTAINER=el8 make build_container" @echo " TEST_CONTAINER=f42 make test_container" - @echo " CONTAINER_TOOL=docker TEST_CONTAINER=rhel8 make test_container_no_lint" + @echo " CONTAINER_TOOL=docker TEST_CONTAINER=el8 make test_container_no_lint" @echo "" clean: @@ -252,10 +252,10 @@ build_container: echo "--- Build RPM ${PKGNAME}-${VERSION}-${RELEASE}.el$(DIST_VERSION).rpm in container ---"; case "$(BUILD_CONTAINER)" in \ el8) \ - CONT_FILE="utils/container-builds/Containerfile.ubi8"; \ + CONT_FILE="utils/container-builds/Containerfile.el8"; \ ;; \ el9) \ - CONT_FILE="utils/container-builds/Containerfile.ubi9"; \ + CONT_FILE="utils/container-builds/Containerfile.el9"; \ ;; \ "") \ echo "BUILD_CONTAINER must be set"; \ @@ -415,7 +415,7 @@ lint_container: @_TEST_CONT_TARGET="lint" $(MAKE) test_container lint_container_all: - @for container in "f42" "rhel8" "rhel9"; do \ + @for container in f42 el{8,9}; do \ TEST_CONTAINER=$$container $(MAKE) lint_container || exit 1; \ done @@ -429,16 +429,16 @@ test_container: export CONT_FILE="utils/container-tests/Containerfile.f42"; \ export _VENV="python3.13"; \ ;; \ - rhel8) \ - export CONT_FILE="utils/container-tests/Containerfile.rhel8"; \ + el8) \ + export CONT_FILE="utils/container-tests/Containerfile.el8"; \ export _VENV="python3.6"; \ ;; \ - rhel9) \ - export CONT_FILE="utils/container-tests/Containerfile.rhel9"; \ + el9) \ + export CONT_FILE="utils/container-tests/Containerfile.el9"; \ export _VENV="python3.9"; \ ;; \ *) \ - echo "Error: Available containers are: f42, rhel8, rhel9"; exit 1; \ + echo "Error: Available containers are: f42, el8, el9"; exit 1; \ ;; \ esac; \ export TEST_IMAGE="leapp-repo-tests-$(_TEST_CONTAINER)"; \ @@ -470,7 +470,7 @@ test_container: exit $$res test_container_all: - @for container in "f42" "rhel8" "rhel9"; do \ + @for container in "f42" "el8" "el9"; do \ TEST_CONTAINER=$$container $(MAKE) test_container || exit 1; \ done @@ -478,14 +478,13 @@ test_container_no_lint: @_TEST_CONT_TARGET="test_no_lint" $(MAKE) test_container test_container_all_no_lint: - @for container in "f42" "rhel8" "rhel9"; do \ + @for container in f42 el{8,9}; do \ TEST_CONTAINER=$$container $(MAKE) test_container_no_lint || exit 1; \ done # clean all testing and building containers and their images clean_containers: - @for i in "leapp-repo-tests-f42" "leapp-repo-tests-rhel8" \ - "leapp-repo-tests-rhel9" "leapp-repo-build-el8"; do \ + @for i in leapp-repo-tests-f42 leapp-repo-tests-el{8,9} leapp-repo-build-el{8,9}; do \ $(_CONTAINER_TOOL) kill "$$i-cont" || :; \ $(_CONTAINER_TOOL) rm "$$i-cont" || :; \ $(_CONTAINER_TOOL) rmi "$$i" || :; \ diff --git a/utils/container-builds/Containerfile.ubi8 b/utils/container-builds/Containerfile.el8 similarity index 100% rename from utils/container-builds/Containerfile.ubi8 rename to utils/container-builds/Containerfile.el8 diff --git a/utils/container-builds/Containerfile.ubi9 b/utils/container-builds/Containerfile.el9 similarity index 100% rename from utils/container-builds/Containerfile.ubi9 rename to utils/container-builds/Containerfile.el9 diff --git a/utils/container-tests/Containerfile.rhel8 b/utils/container-tests/Containerfile.el8 similarity index 100% rename from utils/container-tests/Containerfile.rhel8 rename to utils/container-tests/Containerfile.el8 diff --git a/utils/container-tests/Containerfile.rhel9 b/utils/container-tests/Containerfile.el9 similarity index 100% rename from utils/container-tests/Containerfile.rhel9 rename to utils/container-tests/Containerfile.el9 diff --git a/utils/container-tests/Containerfile.ubi8 b/utils/container-tests/ci/Containerfile.el8 similarity index 100% rename from utils/container-tests/Containerfile.ubi8 rename to utils/container-tests/ci/Containerfile.el8 diff --git a/utils/container-tests/Containerfile.ubi8-lint b/utils/container-tests/ci/Containerfile.el8-lint similarity index 100% rename from utils/container-tests/Containerfile.ubi8-lint rename to utils/container-tests/ci/Containerfile.el8-lint diff --git a/utils/container-tests/Containerfile.ubi9 b/utils/container-tests/ci/Containerfile.el9 similarity index 100% rename from utils/container-tests/Containerfile.ubi9 rename to utils/container-tests/ci/Containerfile.el9 diff --git a/utils/container-tests/Containerfile.ubi9-lint b/utils/container-tests/ci/Containerfile.el9-lint similarity index 100% rename from utils/container-tests/Containerfile.ubi9-lint rename to utils/container-tests/ci/Containerfile.el9-lint -- 2.51.1