leapp-repository/SOURCES/0010-Replace-ubi-8-containers-with-centos-8.patch
2025-12-01 09:14:24 +00:00

81 lines
3.2 KiB
Diff

From 17767238d038d36341181e1702b73681ae432439 Mon Sep 17 00:00:00 2001
From: Matej Matuska <mmatuska@redhat.com>
Date: Wed, 20 Aug 2025 14:12:13 +0200
Subject: [PATCH 10/55] Replace ubi:8 containers with centos:8
The networkmanagerconnectionscanner depends on NetworkManager-nmlib and
python3-gobject. These are not available in the UBI 8 repos and the
tests are skipped.
This patch changes the base container from UBI 8 to Centos 8 which has
the packages available and the tests are not skipped.
---
commands/tests/test_upgrade_paths.py | 5 +++++
utils/container-tests/Containerfile.el8 | 10 ++++++++--
utils/container-tests/ci/Containerfile.el8 | 10 ++++++++--
3 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/commands/tests/test_upgrade_paths.py b/commands/tests/test_upgrade_paths.py
index 89b5eb71..9bdf5792 100644
--- a/commands/tests/test_upgrade_paths.py
+++ b/commands/tests/test_upgrade_paths.py
@@ -42,6 +42,11 @@ def test_get_target_version(mock_open, monkeypatch):
},
)
def test_get_target_release(mock_open, monkeypatch): # do not remove mock_open
+ # Make it look like it's RHEL even on centos, because that's what the test
+ # assumes.
+ # Otherwise the test, when ran on Centos, fails because it works
+ # with MAJOR.MINOR version format while Centos uses MAJOR format.
+ monkeypatch.setattr(command_utils, 'get_distro_id', lambda: 'rhel')
monkeypatch.setattr(command_utils, 'get_os_release_version_id', lambda x: '8.6')
# make sure env var LEAPP_DEVEL_TARGET_RELEASE takes precedence
diff --git a/utils/container-tests/Containerfile.el8 b/utils/container-tests/Containerfile.el8
index 6f21839b..b92e8742 100644
--- a/utils/container-tests/Containerfile.el8
+++ b/utils/container-tests/Containerfile.el8
@@ -1,9 +1,15 @@
-FROM registry.access.redhat.com/ubi8/ubi:latest
+FROM centos:8
+
+RUN sed -i s/mirror.centos.org/vault.centos.org/ /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^#\s*baseurl=http/baseurl=http/ /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^mirrorlist=http/#mirrorlist=http/ /etc/yum.repos.d/CentOS-*.repo
VOLUME /repo
RUN dnf update -y && \
- dnf install -y python3-virtualenv python3-setuptools python3-pip make git rsync
+ dnf install -y git make rsync \
+ python3-virtualenv python3-setuptools python3-pip \
+ python3-gobject NetworkManager-libnm
ENV PYTHON_VENV python3.6
diff --git a/utils/container-tests/ci/Containerfile.el8 b/utils/container-tests/ci/Containerfile.el8
index 4da60c18..4a19092e 100644
--- a/utils/container-tests/ci/Containerfile.el8
+++ b/utils/container-tests/ci/Containerfile.el8
@@ -1,9 +1,15 @@
-FROM registry.access.redhat.com/ubi8/ubi:latest
+FROM centos:8
+
+RUN sed -i s/mirror.centos.org/vault.centos.org/ /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^#\s*baseurl=http/baseurl=http/ /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^mirrorlist=http/#mirrorlist=http/ /etc/yum.repos.d/CentOS-*.repo
VOLUME /payload
RUN dnf update -y && \
- dnf install python3-virtualenv python3-setuptools python3-pip make git -y
+ dnf install -y make git \
+ python3-virtualenv python3-setuptools python3-pip \
+ python3-gobject NetworkManager-libnm
WORKDIR /payload
ENTRYPOINT make install-deps && make test_no_lint
--
2.51.1