leapp-repository/0074-Add-RHEL9-container-for-building-and-testing.patch
Toshio Kuratomi d9029cec24 CTC2 candidate 1 (Release for 8.10/9.5)
- Improve set_systemd_services_states logging
- [IPU 7 -> 8] Fix detection of bootable device on RAID
- Fix detection of valid sshd config with internal-sftp subsystem in Leapp
- Handle a false positive GPG check error when TargetUserSpaceInfo is missing
- Fix failing "update-ca-trust" command caused by missing util-linux package
- Improve report when a system is unsupported
- Fix handling of versions in RHUI configuration for ELS and SAP upgrades
- Add missing RHUI GCP config info for RHEL for SAP

- Resolves: RHEL-33902, RHEL-30573, RHEL-43978, RHEL-39046, RHEL-39047, RHEL-39049
2024-07-25 00:55:43 -07:00

160 lines
5.8 KiB
Diff

From 953bfb1868595a6100522bfd92f4ea4c47e6be1b Mon Sep 17 00:00:00 2001
From: Matej Matuska <mmatuska@redhat.com>
Date: Mon, 24 Jun 2024 17:00:09 +0200
Subject: [PATCH 74/92] Add RHEL9 container for building and testing
Adding RHEL 9 containers so we can start to test & build packages
in RHEL 9 environemnt.
Since `python3-virtualenv` package is not available in the RHEL 9 UBI,
a workaround is introduced `make install-deps-fedora`, which is used by
the testing containers. If not able to install the package, `pip install
virtualenv` is used as a fallback as this is working in the image.
The relatively recent Python version used in the container means there
is also a relative recent Pylint verision, which introduces 2+ new
checks.
---
Makefile | 31 +++++++++++++++++------
utils/container-builds/Containerfile.ubi9 | 10 ++++++++
utils/container-tests/Containerfile.rhel9 | 18 +++++++++++++
3 files changed, 51 insertions(+), 8 deletions(-)
create mode 100644 utils/container-builds/Containerfile.ubi9
create mode 100644 utils/container-tests/Containerfile.rhel9
diff --git a/Makefile b/Makefile
index a62d0ccc..5b2bc4d2 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,7 @@ help:
@echo " packaging"
@echo " srpm create the SRPM"
@echo " build_container create the RPM in container"
- @echo " - set BUILD_CONTAINER to el7 or el8"
+ @echo " - set BUILD_CONTAINER to el7, el8 or el9"
@echo " - don't run more than one build at the same time"
@echo " since containers operate on the same files!"
@echo " copr_build create the COPR build using the COPR TOKEN"
@@ -164,7 +164,7 @@ help:
@echo " PR=7 SUFFIX='my_additional_suffix' make <target>"
@echo " MR=6 COPR_CONFIG='path/to/the/config/copr/file' make <target>"
@echo " ACTOR=<actor> TEST_LIBS=y make test"
- @echo " BUILD_CONTAINER=rhel7 make build_container"
+ @echo " BUILD_CONTAINER=el7 make build_container"
@echo " TEST_CONTAINER=f34 make test_container"
@echo " CONTAINER_TOOL=docker TEST_CONTAINER=rhel7 make test_container_no_lint"
@echo ""
@@ -258,12 +258,15 @@ build_container:
el8) \
CONT_FILE="utils/container-builds/Containerfile.ubi8"; \
;; \
+ el9) \
+ CONT_FILE="utils/container-builds/Containerfile.ubi9"; \
+ ;; \
"") \
echo "BUILD_CONTAINER must be set"; \
exit 1; \
;; \
*) \
- echo "Available containers are el7, el8"; \
+ echo "Available containers are el7, el8, el9"; \
exit 1; \
;; \
esac && \
@@ -305,12 +308,20 @@ install-deps:
$(VENVNAME)/bin/pip install -I "git+https://github.com/oamg/leapp.git@refs/pull/$(REQ_LEAPP_PR)/head"; \
fi
$(_PYTHON_VENV) utils/install_actor_deps.py --actor=$(ACTOR) --repos="$(TEST_PATHS)"
+
install-deps-fedora:
@# Check the necessary rpms are installed for py3 (and py2 below)
- if ! rpm -q git findutils python3-virtualenv gcc; then \
- if ! dnf install -y git findutils python3-virtualenv gcc; then \
+ if ! rpm -q git findutils gcc; then \
+ if ! dnf install -y git findutils gcc; then \
echo 'Please install the following rpms via the command: ' \
- 'sudo dnf install -y git findutils python3-virtualenv gcc'; \
+ 'sudo dnf install -y git findutils gcc'; \
+ exit 1; \
+ fi; \
+ fi
+ if ! command -v virtualenv; then \
+ if ! (dnf install -y python3-virtualenv || pip install virtualenv); then \
+ echo 'Please install the following packages via the command: ' \
+ 'sudo dnf install -y python3-virtualenv or pip install virtualenv'; \
exit 1; \
fi; \
fi
@@ -432,6 +443,10 @@ test_container:
export CONT_FILE="utils/container-tests/Containerfile.rhel8"; \
export _VENV="python3.6"; \
;; \
+ rhel9) \
+ export CONT_FILE="utils/container-tests/Containerfile.rhel9"; \
+ export _VENV="python3.9"; \
+ ;; \
*) \
echo "Error: Available containers are: f34, rhel7, rhel8"; exit 1; \
;; \
@@ -481,7 +496,7 @@ test_container_all_no_lint:
# clean all testing and building containers and their images
clean_containers:
@for i in "leapp-repo-tests-f34" "leapp-repo-tests-rhel7" "leapp-repo-tests-rhel8" \
- "leapp-repo-build-el7" "leapp-repo-build-el8"; do \
+ "leapp-repo-tests-rhel9" "leapp-repo-build-el7" "leapp-repo-build-el8"; do \
$(_CONTAINER_TOOL) kill "$$i-cont" || :; \
$(_CONTAINER_TOOL) rm "$$i-cont" || :; \
$(_CONTAINER_TOOL) rmi "$$i" || :; \
@@ -492,7 +507,7 @@ fast_lint:
FILES_TO_LINT="$$(git diff --name-only $(MASTER_BRANCH) --diff-filter AMR | grep '\.py$$')"; \
if [[ -n "$$FILES_TO_LINT" ]]; then \
pylint -j 0 $$FILES_TO_LINT $(PYLINT_ARGS) && \
- flake8 $$FILES_TO_LINT $(FLAKE8_ARG); \
+ flake8 $$FILES_TO_LINT $(FLAKE8_ARGS); \
LINT_EXIT_CODE="$$?"; \
if [[ "$$LINT_EXIT_CODE" != "0" ]]; then \
exit $$LINT_EXIT_CODE; \
diff --git a/utils/container-builds/Containerfile.ubi9 b/utils/container-builds/Containerfile.ubi9
new file mode 100644
index 00000000..53567c08
--- /dev/null
+++ b/utils/container-builds/Containerfile.ubi9
@@ -0,0 +1,10 @@
+FROM registry.access.redhat.com/ubi9/ubi:latest
+
+VOLUME /repo
+
+RUN dnf update -y && \
+ dnf install -y python3-devel rpm-build make git
+
+WORKDIR /repo
+ENV DIST_VERSION 9
+ENTRYPOINT make _build_local
diff --git a/utils/container-tests/Containerfile.rhel9 b/utils/container-tests/Containerfile.rhel9
new file mode 100644
index 00000000..2261b2ad
--- /dev/null
+++ b/utils/container-tests/Containerfile.rhel9
@@ -0,0 +1,18 @@
+FROM registry.access.redhat.com/ubi9/ubi:latest
+
+VOLUME /repo
+
+RUN dnf update -y && \
+ dnf install -y python3-setuptools python3-pip make git rsync
+
+ENV PYTHON_VENV python3.9
+
+COPY . /repocopy
+
+WORKDIR /repocopy
+
+RUN rm -rf tut*
+
+RUN make clean && make install-deps-fedora
+
+WORKDIR /
--
2.42.0