Skip to content

Commit 204d729

Browse files
committed
build-sys: Enable CentOS Stream compose repos to avoid version skew
The base image may be built from a compose that has newer packages than what's available on the public mirrors. This causes version skew where packages like bootupd have different versions between the base image and our built image. For example, bootupd 0.2.32 changed the EFI file layout from /usr/lib/bootupd/updates/EFI/ to /usr/lib/efi/, and if we build with an older bootupd from mirrors while the target image has the newer layout, bootloader installation fails. Enable the CentOS Stream compose repos with higher priority to ensure we get matching versions. xref https://gitlab.com/redhat/centos-stream/containers/bootc/-/issues/1174 Signed-off-by: Colin Walters <walters@verbum.org> Assisted-by: OpenCode (Opus 4.5) Signed-off-by: Colin Walters <walters@verbum.org>
1 parent d5c6515 commit 204d729

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

Dockerfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ RUN --mount=type=tmpfs,target=/run /src/contrib/packaging/configure-systemdboot
4747
# local sources. We'll override it later.
4848
# NOTE: All your base belong to me.
4949
FROM $base as target-base
50+
# Handle version skew between base image and mirrors for CentOS Stream
51+
# xref https://gitlab.com/redhat/centos-stream/containers/bootc/-/issues/1174
52+
RUN --mount=type=tmpfs,target=/run \
53+
--mount=type=bind,from=packaging,src=/,target=/run/packaging \
54+
/run/packaging/enable-compose-repos
5055
RUN --mount=type=tmpfs,target=/run /usr/libexec/bootc-base-imagectl build-rootfs --manifest=standard /target-rootfs
5156

5257
FROM scratch as base
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/bin/bash
2+
# Enable compose repos to avoid version skew between base image and mirrors
3+
# xref https://gitlab.com/redhat/centos-stream/containers/bootc/-/issues/1174
4+
set -euo pipefail
5+
6+
. /usr/lib/os-release
7+
8+
case "${ID}" in
9+
centos)
10+
# The base image may have been built from a compose that has newer packages
11+
# than what's available on the public mirrors. Enable the compose repos
12+
# with higher priority to ensure we get matching versions.
13+
14+
# Extract the gpgkey from the existing centos.repo - c9s uses
15+
# RPM-GPG-KEY-centosofficial while c10s uses RPM-GPG-KEY-centosofficial-SHA256
16+
gpgkey=$(grep -m1 '^gpgkey=' /etc/yum.repos.d/centos.repo | cut -d= -f2)
17+
if [[ -z "${gpgkey}" ]]; then
18+
echo "Error: Could not find gpgkey in /etc/yum.repos.d/centos.repo" >&2
19+
exit 1
20+
fi
21+
22+
cat > /etc/yum.repos.d/centos-compose.repo << EOF
23+
[compose-baseos]
24+
name=CentOS Stream \$releasever Compose BaseOS
25+
baseurl=https://composes.stream.centos.org/stream-\$releasever/production/latest-CentOS-Stream/compose/BaseOS/\$basearch/os/
26+
gpgcheck=1
27+
enabled=1
28+
priority=1
29+
gpgkey=${gpgkey}
30+
31+
[compose-appstream]
32+
name=CentOS Stream \$releasever Compose AppStream
33+
baseurl=https://composes.stream.centos.org/stream-\$releasever/production/latest-CentOS-Stream/compose/AppStream/\$basearch/os/
34+
gpgcheck=1
35+
enabled=1
36+
priority=1
37+
gpgkey=${gpgkey}
38+
EOF
39+
echo "Enabled CentOS Stream compose repos (gpgkey: ${gpgkey})"
40+
;;
41+
*)
42+
# No compose repo needed for other distros
43+
;;
44+
esac

0 commit comments

Comments
 (0)