1
1
#! /bin/bash
2
2
set -euo pipefail
3
3
4
- # Pin to branch for some reproducibility
5
- BRANCH=f38
6
-
7
4
dn=$( cd " $( dirname " $0 " ) " && pwd)
8
5
topsrcdir=$( cd " $dn /.." && pwd)
9
6
commondir=$( cd " $dn /common" && pwd)
@@ -22,25 +19,43 @@ if test -z "${COMPOSE_KEEP_CACHE:-}"; then
22
19
mkdir compose-baseimage-test
23
20
fi
24
21
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
25
32
mkdir -p cache cache-container
26
33
27
34
# A container image using stock dnf, similar to
28
35
# https://pagure.io/fedora-kickstarts/blob/main/f/fedora-container-base.ks
29
36
rm minimal-test -rf
30
37
mkdir minimal-test
31
38
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
33
48
container: true
34
49
recommends: false
35
- releasever: 38
50
+ releasever: ${RELEASE}
36
51
packages:
37
52
- rootfiles
38
- - fedora-repos-modular
39
53
- vim-minimal
40
54
- coreutils
41
- - dnf dnf-yum
55
+ - ${ dnf}
42
56
- glibc glibc.i686
43
57
- sudo
58
+ ${systemd_sysusers}
44
59
repos:
45
60
- fedora # Intentially using frozen GA repo
46
61
EOF
@@ -56,15 +71,15 @@ test $(jq -r '.Labels["baz"]' < inspect.json) = blah
56
71
rpm-ostree compose image --cachedir=../cache-container --touch-if-changed changed.stamp minimal.yaml minimal.ociarchive
57
72
test ' !' -f changed.stamp
58
73
cd ..
59
- echo " ok minimal"
74
+ echo " ok minimal ${RELEASE} "
60
75
61
76
# A minimal bootable manifest, using repos from the host
62
77
rm minimal-test -rf
63
78
mkdir minimal-test
64
79
cd minimal-test
65
- cat > minimal.yaml << ' EOF '
80
+ cat > minimal.yaml << EOF
66
81
boot-location: modules
67
- releasever: 38
82
+ releasever: ${RELEASE}
68
83
packages:
69
84
- bash
70
85
- rpm
@@ -80,10 +95,10 @@ cp /etc/yum.repos.d/*.repo .
80
95
rpm-ostree compose image --cachedir=../cache --touch-if-changed=changed.stamp --initialize-mode=always minimal.yaml minimal.ociarchive
81
96
# TODO actually test this container image
82
97
cd ..
83
- echo " ok minimal"
98
+ echo " ok minimal ${RELEASE} "
84
99
85
100
# 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}
87
102
mkdir_oci () {
88
103
local d
89
104
d=$1
@@ -97,13 +112,16 @@ destocidir=fedora-silverblue.oci
97
112
rm " ${destocidir} " -rf
98
113
mkdir_oci " ${destocidir} "
99
114
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
100
119
# 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} "
102
121
skopeo inspect " oci:${destimg} "
103
122
test -f changed.stamp
104
123
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
106
125
test ' !' -f changed.stamp
107
126
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