Skip to content

Commit 0c5446b

Browse files
henrywangcgwalters
authored andcommitted
test: Fix package installation version skew issue
Issue: Base image has packages installed with latest repo, but test image builds with old repo. Fix: Use lates repo to build test image Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
1 parent 4dfccbe commit 0c5446b

1 file changed

Lines changed: 36 additions & 0 deletions

File tree

tmt/tests/booted/test-soft-reboot-selinux-policy.nu

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,42 @@ def initial_build [] {
4646
if $os.ID == "rhel" {
4747
cp /etc/yum.repos.d/rhel.repo .
4848
$repo_copy = "COPY rhel.repo /etc/yum.repos.d/"
49+
} else if $os.ID == "centos" {
50+
let gpgkey = (
51+
open /etc/yum.repos.d/centos.repo
52+
| lines
53+
| find --regex '^gpgkey='
54+
| first
55+
| split row "="
56+
| last
57+
)
58+
59+
if ($gpgkey | is-empty) {
60+
print -e "Error: Could not find gpgkey in /etc/yum.repos.d/centos.repo"
61+
exit 1
62+
}
63+
64+
# Enable latest repos to avoid version skew between
65+
# installed image and building image
66+
let repo_content = $"[compose-baseos]
67+
name=CentOS Stream $releasever Compose BaseOS
68+
baseurl=https://composes.stream.centos.org/stream-$releasever/production/latest-CentOS-Stream/compose/BaseOS/$basearch/os/
69+
gpgcheck=1
70+
enabled=1
71+
priority=1
72+
gpgkey=($gpgkey)
73+
74+
[compose-appstream]
75+
name=CentOS Stream $releasever Compose AppStream
76+
baseurl=https://composes.stream.centos.org/stream-$releasever/production/latest-CentOS-Stream/compose/AppStream/$basearch/os/
77+
gpgcheck=1
78+
enabled=1
79+
priority=1
80+
gpgkey=($gpgkey)
81+
"
82+
$repo_content | save --force centos-compose.repo
83+
84+
$repo_copy = "COPY centos-compose.repo /etc/yum.repos.d/"
4985
}
5086

5187
# Create a derived container that installs a custom SELinux policy module

0 commit comments

Comments
 (0)