From 4e17a6f8d59354580614d94f21b1e3c6cf5daa1a Mon Sep 17 00:00:00 2001 From: Lucas Caudill Date: Mon, 8 Jul 2024 19:28:37 +0000 Subject: [PATCH 1/5] initial commit --- test/force-auto.py.in | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/test/force-auto.py.in b/test/force-auto.py.in index 0184fd2da..48fa0a519 100644 --- a/test/force-auto.py.in +++ b/test/force-auto.py.in @@ -116,6 +116,14 @@ class Test(abc.ABC): return "\n".join("RUN %s" % run for run in runs) def test(self): + # kludge up a way to fix centos mirror issue + if (self.base == "centos:7"): + kludge = f"""\ +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ + && sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ + && sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo\n""" + else: + kludge = "" # skip? if (self.preprep and not (self.force and self.run == Run.NEEDED)): print(f"\n# skip: {self}: not needed") @@ -186,7 +194,7 @@ scope {scope} # build 2: image we're testing run ch-image -v build {force} -t tmpimg2 -f - . << 'EOF' FROM {build2_base} -RUN {run} +{kludge}RUN {run} EOF echo "$output" [[ $status -eq {status} ]] @@ -226,7 +234,11 @@ class RHEL7(Test): class T_CentOS_7(RHEL7, EPEL_Mixin): scope = Scope.STANDARD base = "centos:7" - prep_run = "yum install -y epel-release" + prep_run = f"""\ +sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ +&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ +&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \ +&& yum install -y epel-release""" class RHEL8(Test): From 36c6503b85080eb64ee14b8571de042b99e22262 Mon Sep 17 00:00:00 2001 From: Lucas Caudill Date: Mon, 22 Jul 2024 15:06:15 +0000 Subject: [PATCH 2/5] use a hook instead --- test/force-auto.py.in | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/test/force-auto.py.in b/test/force-auto.py.in index 48fa0a519..bd6579447 100644 --- a/test/force-auto.py.in +++ b/test/force-auto.py.in @@ -84,6 +84,10 @@ class Test(abc.ABC): def build2_post_hook(self): return "" + @property + def build2_from_hook(self): + return "" + @property def skip(self): if (self.skip_reason is None): @@ -194,7 +198,8 @@ scope {scope} # build 2: image we're testing run ch-image -v build {force} -t tmpimg2 -f - . << 'EOF' FROM {build2_base} -{kludge}RUN {run} +{self.build2_from_hook} +RUN {run} EOF echo "$output" [[ $status -eq {status} ]] @@ -240,6 +245,14 @@ sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ && sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \ && yum install -y epel-release""" + @property + def build2_from_hook(self): + return f"""\ +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ +&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ +&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \ +&& yum install -y epel-release""" + class RHEL8(Test): config = "rhel8" From 699d7d795c29caa28ce3942332a6ef32a181cb40 Mon Sep 17 00:00:00 2001 From: Lucas Caudill Date: Mon, 22 Jul 2024 15:49:22 +0000 Subject: [PATCH 3/5] oops --- test/force-auto.py.in | 8 -------- 1 file changed, 8 deletions(-) diff --git a/test/force-auto.py.in b/test/force-auto.py.in index bd6579447..f0186f5ff 100644 --- a/test/force-auto.py.in +++ b/test/force-auto.py.in @@ -120,14 +120,6 @@ class Test(abc.ABC): return "\n".join("RUN %s" % run for run in runs) def test(self): - # kludge up a way to fix centos mirror issue - if (self.base == "centos:7"): - kludge = f"""\ -RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ - && sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ - && sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo\n""" - else: - kludge = "" # skip? if (self.preprep and not (self.force and self.run == Run.NEEDED)): print(f"\n# skip: {self}: not needed") From 6c6b960b5ac5bedc7fb4038c405ba69e2e9a69e5 Mon Sep 17 00:00:00 2001 From: Lucas Caudill Date: Mon, 22 Jul 2024 16:32:22 +0000 Subject: [PATCH 4/5] some cleanup --- test/force-auto.py.in | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/test/force-auto.py.in b/test/force-auto.py.in index f0186f5ff..d0864c78a 100644 --- a/test/force-auto.py.in +++ b/test/force-auto.py.in @@ -85,7 +85,7 @@ class Test(abc.ABC): return "" @property - def build2_from_hook(self): + def build_from_hook(self): return "" @property @@ -151,6 +151,7 @@ class Test(abc.ABC): build1 = f"""\ run ch-image -v build -t tmpimg -f - . << 'EOF' FROM {self.base} +{self.build_from_hook} RUN {self.prep_run} EOF echo "$output" @@ -190,7 +191,7 @@ scope {scope} # build 2: image we're testing run ch-image -v build {force} -t tmpimg2 -f - . << 'EOF' FROM {build2_base} -{self.build2_from_hook} +{self.build_from_hook} RUN {run} EOF echo "$output" @@ -231,19 +232,14 @@ class RHEL7(Test): class T_CentOS_7(RHEL7, EPEL_Mixin): scope = Scope.STANDARD base = "centos:7" - prep_run = f"""\ -sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ -&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ -&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \ -&& yum install -y epel-release""" + prep_run = "yum install -y epel-release" @property - def build2_from_hook(self): + def build_from_hook(self): return f"""\ -RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ +sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ && sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ -&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \ -&& yum install -y epel-release""" +&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo""" class RHEL8(Test): From 59952c5b4187db40f918b1aee909ecc0f5232cce Mon Sep 17 00:00:00 2001 From: Lucas Caudill Date: Wed, 24 Jul 2024 20:30:21 +0000 Subject: [PATCH 5/5] add missing instruction --- test/force-auto.py.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/force-auto.py.in b/test/force-auto.py.in index d0864c78a..173ebbd7d 100644 --- a/test/force-auto.py.in +++ b/test/force-auto.py.in @@ -237,9 +237,9 @@ class T_CentOS_7(RHEL7, EPEL_Mixin): @property def build_from_hook(self): return f"""\ -sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ -&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ -&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo""" +RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \ + && sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \ + && sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo""" class RHEL8(Test):