Skip to content

Commit 9eb66a4

Browse files
committed
tests/compose-image: Test with Fedora 40, 41 & 42
- Add systemd-standalone-sysusers to container for F42+. Starting with Fedora 42, RPM will use sysusers to create users and we emulate that support by running sysusers in the rootfs before running other scriptlets. See: #5333 - Test with Fedora 41 by default - Replace dnf with dnf5 for F41+ See: https://fedoraproject.org/wiki/Changes/SwitchToDnf5 - tests/compose-image: Remove fedora-repos-modular Support for modularity has been removed from Fedora. See: https://fedoraproject.org/wiki/Changes/RetireModularity
1 parent a346d5f commit 9eb66a4

File tree

2 files changed

+41
-17
lines changed

2 files changed

+41
-17
lines changed

.github/workflows/ci.yaml

+7-1
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,10 @@ jobs:
184184
name: "compose-image tests"
185185
needs: build
186186
runs-on: ubuntu-latest
187+
strategy:
188+
fail-fast: false
189+
matrix:
190+
RELEASE: ['40', '41', '42']
187191
container:
188192
image: registry.ci.openshift.org/coreos/coreos-assembler:latest
189193
options: "--user root --privileged -v /var/tmp:/var/tmp"
@@ -199,7 +203,9 @@ jobs:
199203
- name: Install
200204
run: tar -C / -xzvf install.tar
201205
- name: Integration tests
202-
run: env TMPDIR=/var/tmp JOBS=3 ./tests/compose-image.sh
206+
run: env TMPDIR=/var/tmp JOBS=3 RELEASE=${RELEASE} ./tests/compose-image.sh
207+
env:
208+
RELEASE: ${{ matrix.RELEASE }}
203209
compose-rootfs:
204210
name: "compose-rootfs tests"
205211
needs: build

tests/compose-image.sh

+34-16
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
#!/bin/bash
22
set -euo pipefail
33

4-
# Pin to branch for some reproducibility
5-
BRANCH=f38
6-
74
dn=$(cd "$(dirname "$0")" && pwd)
85
topsrcdir=$(cd "$dn/.." && pwd)
96
commondir=$(cd "$dn/common" && pwd)
@@ -22,25 +19,43 @@ if test -z "${COMPOSE_KEEP_CACHE:-}"; then
2219
mkdir compose-baseimage-test
2320
fi
2421
cd compose-baseimage-test
22+
23+
# RELEASE is set in CI for all current Fedora releases
24+
if [[ -z ${RELEASE+x} ]]; then
25+
# Set RELEASE to latest Fedora stable by default
26+
RELEASE=41
27+
else
28+
echo "Testing using Fedora ${RELEASE}"
29+
fi
30+
31+
rm -rf cache cache-container
2532
mkdir -p cache cache-container
2633

2734
# A container image using stock dnf, similar to
2835
# https://pagure.io/fedora-kickstarts/blob/main/f/fedora-container-base.ks
2936
rm minimal-test -rf
3037
mkdir minimal-test
3138
cd minimal-test
32-
cat > minimal.yaml << 'EOF'
39+
dnf="dnf dnf-yum"
40+
if [[ "${RELEASE}" -ge 41 ]]; then
41+
dnf="dnf5"
42+
fi
43+
systemd_sysusers=""
44+
if [[ "${RELEASE}" -ge 42 ]]; then
45+
systemd_sysusers=" - systemd-standalone-sysusers"
46+
fi
47+
cat > minimal.yaml << EOF
3348
container: true
3449
recommends: false
35-
releasever: 38
50+
releasever: ${RELEASE}
3651
packages:
3752
- rootfiles
38-
- fedora-repos-modular
3953
- vim-minimal
4054
- coreutils
41-
- dnf dnf-yum
55+
- ${dnf}
4256
- glibc glibc.i686
4357
- sudo
58+
${systemd_sysusers}
4459
repos:
4560
- fedora # Intentially using frozen GA repo
4661
EOF
@@ -56,15 +71,15 @@ test $(jq -r '.Labels["baz"]' < inspect.json) = blah
5671
rpm-ostree compose image --cachedir=../cache-container --touch-if-changed changed.stamp minimal.yaml minimal.ociarchive
5772
test '!' -f changed.stamp
5873
cd ..
59-
echo "ok minimal"
74+
echo "ok minimal ${RELEASE}"
6075

6176
# A minimal bootable manifest, using repos from the host
6277
rm minimal-test -rf
6378
mkdir minimal-test
6479
cd minimal-test
65-
cat > minimal.yaml << 'EOF'
80+
cat > minimal.yaml << EOF
6681
boot-location: modules
67-
releasever: 38
82+
releasever: ${RELEASE}
6883
packages:
6984
- bash
7085
- rpm
@@ -80,10 +95,10 @@ cp /etc/yum.repos.d/*.repo .
8095
rpm-ostree compose image --cachedir=../cache --touch-if-changed=changed.stamp --initialize-mode=always minimal.yaml minimal.ociarchive
8196
# TODO actually test this container image
8297
cd ..
83-
echo "ok minimal"
98+
echo "ok minimal ${RELEASE}"
8499

85100
# Next, test the full Fedora Silverblue config, and also using an OCI directory
86-
test -d workstation-ostree-config || git clone --depth=1 https://pagure.io/workstation-ostree-config --branch "${BRANCH}"
101+
test -d workstation-ostree-config.${RELEASE} || git clone --depth=1 https://pagure.io/workstation-ostree-config --branch "f${RELEASE}" workstation-ostree-config.${RELEASE}
87102
mkdir_oci() {
88103
local d
89104
d=$1
@@ -97,13 +112,16 @@ destocidir=fedora-silverblue.oci
97112
rm "${destocidir}" -rf
98113
mkdir_oci "${destocidir}"
99114
destimg="${destocidir}:silverblue"
115+
manifest="workstation-ostree-config.${RELEASE}/silverblue.yaml"
116+
if [[ "${RELEASE}" -lt 41 ]]; then
117+
manifest="workstation-ostree-config.${RELEASE}/fedora-silverblue.yaml"
118+
fi
100119
# Sadly --if-not-exists is broken for oci: too
101-
rpm-ostree compose image --cachedir=cache --touch-if-changed=changed.stamp --initialize-mode=always --format=oci workstation-ostree-config/fedora-silverblue.yaml "${destimg}"
120+
rpm-ostree compose image --cachedir=cache --touch-if-changed=changed.stamp --initialize-mode=always --format=oci "${manifest}" "${destimg}"
102121
skopeo inspect "oci:${destimg}"
103122
test -f changed.stamp
104123
rm -f changed.stamp
105-
rpm-ostree compose image --cachedir=cache --offline --touch-if-changed=changed.stamp --initialize-mode=if-not-exists --format=oci workstation-ostree-config/fedora-silverblue.yaml "${destimg}"| tee out.txt
124+
rpm-ostree compose image --cachedir=cache --offline --touch-if-changed=changed.stamp --initialize-mode=if-not-exists --format=oci "${manifest}" "${destimg}"| tee out.txt
106125
test '!' -f changed.stamp
107126
assert_file_has_content_literal out.txt 'No apparent changes since previous commit'
108-
109-
echo "ok compose baseimage"
127+
echo "ok compose Silverblue ${RELEASE}"

0 commit comments

Comments
 (0)