Skip to content

Commit 578063b

Browse files
authored
Merge pull request #1282 from henrywang/fedora_ci
test: update bootc install script to support Fedora CI gating test
2 parents 81f6242 + ad936b7 commit 578063b

File tree

4 files changed

+96
-37
lines changed

4 files changed

+96
-37
lines changed

hack/provision-derived.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ case "${ID}-${VERSION_ID}" in
1818
dnf -y install nu
1919
dnf clean all
2020
;;
21-
"centos-10")
21+
"rhel-9."*)
22+
dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
23+
dnf -y install nu
24+
dnf clean all
25+
;;
26+
"centos-10"|"rhel-10."*)
2227
# nu is not available in CS10
2328
curl -kL "https://github.com/nushell/nushell/releases/download/0.103.0/nu-0.103.0-$(uname -m)-unknown-linux-gnu.tar.gz" --output nu.tar.gz
2429
mkdir -p nu && tar zvxf nu.tar.gz --strip-components=1 -C nu

tmt/plans/integration.fmf

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# local image: file:///home/foobar/image.qcow2
44
provision:
55
how: virtual
6-
image: https://composes.stream.centos.org/stream-10/production/CentOS-Stream-10-20250331.0/compose/BaseOS/x86_64/images/CentOS-Stream-GenericCloud-10-20250331.0.x86_64.qcow2
6+
image: fedora-rawhide
77
prepare:
88
- how: install
99
package:
@@ -18,23 +18,23 @@ execute:
1818
discover:
1919
how: fmf
2020
test:
21-
- /tmt/tests/test-00-bootc-install
21+
- /tmt/tests/bootc-install-provision
2222
- /tmt/tests/test-01-readonly
2323

2424
/test-20-local-upgrade:
2525
summary: Execute local upgrade tests
2626
discover:
2727
how: fmf
2828
test:
29-
- /tmt/tests/test-00-bootc-install
29+
- /tmt/tests/bootc-install-provision
3030
- /tmt/tests/test-20-local-upgrade
3131

3232
/test-21-logically-bound-switch:
3333
summary: Execute logically bound images tests for switching images
3434
discover:
3535
how: fmf
3636
test:
37-
- /tmt/tests/test-00-bootc-install
37+
- /tmt/tests/bootc-install-provision
3838
- /tmt/tests/test-21-logically-bound-switch
3939

4040
/test-22-logically-bound-install:
@@ -44,13 +44,13 @@ execute:
4444
discover:
4545
how: fmf
4646
test:
47-
- /tmt/tests/test-00-bootc-install
47+
- /tmt/tests/bootc-install-provision
4848
- /tmt/tests/test-22-logically-bound-install
4949

5050
/test-23-install-outside-container:
5151
summary: Execute tests for installing outside of a container
5252
discover:
5353
how: fmf
5454
test:
55-
- /tmt/tests/test-00-bootc-install
55+
- /tmt/tests/bootc-install-provision
5656
- /tmt/tests/test-23-install-outside-container
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
summary: Run bootc install to-existing-root to deploy bootc image
2-
test: ./test-00-bootc-install.sh
2+
test: ./bootc-install-provision.sh
33
duration: 30m

tmt/tests/test-00-bootc-install.sh renamed to tmt/tests/bootc-install-provision.sh

Lines changed: 83 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,19 @@ case "$ID" in
1919
esac
2020

2121
if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
22-
# Copy bootc root folder to image build root folder
23-
cp -a ../../. "$BOOTC_TEMPDIR"
22+
# Let's move to bootc root folder
23+
cd ../..
24+
# Fedora CI: https://github.com/fedora-ci/dist-git-pipeline/blob/master/Jenkinsfile#L145
25+
# OSCI: https://gitlab.cee.redhat.com/osci-pipelines/dist-git-pipeline/-/blob/master/Jenkinsfile?ref_type=heads#L93
26+
if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then
27+
# Just left those ls commands here to ring the bell for me when something changed
28+
echo "$TMT_SOURCE_DIR"
29+
ls -al "$TMT_SOURCE_DIR"
30+
ls -al "$TMT_SOURCE_DIR/SRPMS"
31+
ls -al /etc/yum.repos.d
32+
cat /etc/yum.repos.d/test-artifacts.repo
33+
ls -al /var/share/test-artifacts
34+
fi
2435

2536
# TMT needs this key
2637
cp -r /root/.ssh "$BOOTC_TEMPDIR"
@@ -40,34 +51,18 @@ if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
4051
ls -al "$BOOTC_TEMPDIR"
4152

4253
CONTAINERFILE=${BOOTC_TEMPDIR}/Containerfile
43-
tee "$CONTAINERFILE" > /dev/null << REALEOF
44-
FROM $TIER1_IMAGE_URL as build
45-
46-
COPY contrib /contrib
47-
COPY hack/build.sh /build.sh
48-
RUN /build.sh && rm -v /build.sh
49-
COPY . /build
50-
WORKDIR /build
51-
52-
RUN mkdir -p /build/target/dev-rootfs
53-
RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make test-bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out
5454

55-
FROM $TIER1_IMAGE_URL
55+
COMMON_CONTAINERFILE="${BOOTC_TEMPDIR}/common_containerfile"
56+
tee "$COMMON_CONTAINERFILE" > /dev/null << COMMONEOF
57+
RUN <<EORUN
58+
set -xeuo pipefail
5659
57-
COPY hack/provision-derived.sh /tmp
58-
RUN /tmp/provision-derived.sh && rm -f /tmp/*.sh
60+
# Provision test requirement
61+
/code/hack/provision-derived.sh
5962
# Also copy in some default install configs we use for testing
60-
COPY hack/install-test-configs/* /usr/lib/bootc/install/
63+
cp -a /code/hack/install-test-configs/* /usr/lib/bootc/install/
6164
# And some test kargs
62-
COPY hack/test-kargs /usr/lib/bootc/kargs.d/
63-
# Inject our built code
64-
COPY --from=build /out/bootc.tar.zst /tmp
65-
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/*
66-
# Also copy over arbitrary bits from the target root
67-
COPY --from=build /build/target/dev-rootfs/ /
68-
69-
RUN <<EORUN
70-
set -xeuo pipefail
65+
cp -a /code/hack/test-kargs/* /usr/lib/bootc/kargs.d/
7166
7267
# For testing farm
7368
mkdir -p -m 0700 /var/roothome
@@ -91,7 +86,46 @@ COPY bin /usr/local/bin
9186
9287
# In Testing Farm, all ssh things should be reserved for ssh command run after reboot
9388
COPY .ssh /var/roothome/.ssh
89+
COMMONEOF
90+
91+
if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then
92+
FEDORA_CI_CONTAINERFILE="${BOOTC_TEMPDIR}/fedora_ci_containerfile"
93+
tee "$FEDORA_CI_CONTAINERFILE" > /dev/null << FEDORACIEOF
94+
FROM $TIER1_IMAGE_URL
95+
96+
RUN dnf -y upgrade /rpms/*.rpm
97+
FEDORACIEOF
98+
cat >"$CONTAINERFILE" <<REALEOF
99+
$(cat "$FEDORA_CI_CONTAINERFILE")
100+
$(cat "$COMMON_CONTAINERFILE")
101+
94102
REALEOF
103+
else
104+
BOOTC_CI_CONTAINERFILE="${BOOTC_TEMPDIR}/bootc_ci_containerfile"
105+
tee "$BOOTC_CI_CONTAINERFILE" > /dev/null << BOOTCCIEOF
106+
FROM $TIER1_IMAGE_URL as build
107+
108+
WORKDIR /code
109+
RUN hack/build.sh
110+
111+
RUN mkdir -p /build/target/dev-rootfs
112+
RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome make test-bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out
113+
114+
FROM $TIER1_IMAGE_URL
115+
116+
# Inject our built code
117+
COPY --from=build /out/bootc.tar.zst /tmp
118+
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/*
119+
# Also copy over arbitrary bits from the target root
120+
COPY --from=build /build/target/dev-rootfs/ /
121+
122+
BOOTCCIEOF
123+
cat >"$CONTAINERFILE" <<REALEOF
124+
$(cat "$BOOTC_CI_CONTAINERFILE")
125+
$(cat "$COMMON_CONTAINERFILE")
126+
REALEOF
127+
fi
128+
95129

96130
if [[ -d "/var/ARTIFACTS" ]]; then
97131
# In Testing Farm, TMT work dir /var/ARTIFACTS should be reserved
@@ -103,16 +137,36 @@ REALEOF
103137

104138
# For test-22-logically-bound-install
105139
if [[ "$LBI" == "enabled" ]]; then
106-
echo "COPY tmt/tests/lbi/usr/. /usr" >> "$CONTAINERFILE"
107-
echo "RUN ln -s /usr/share/containers/systemd/curl.container /usr/lib/bootc/bound-images.d/curl.container && ln -s /usr/share/containers/systemd/curl-base.image /usr/lib/bootc/bound-images.d/curl-base.image && ln -s /usr/share/containers/systemd/podman.image /usr/lib/bootc/bound-images.d/podman.image" >> "$CONTAINERFILE"
140+
echo "RUN cp -a /code/tmt/tests/lbi/usr/. /usr && ln -s /usr/share/containers/systemd/curl.container /usr/lib/bootc/bound-images.d/curl.container && ln -s /usr/share/containers/systemd/curl-base.image /usr/lib/bootc/bound-images.d/curl-base.image && ln -s /usr/share/containers/systemd/podman.image /usr/lib/bootc/bound-images.d/podman.image" >> "$CONTAINERFILE"
108141
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest
109142
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest
110143
podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest
111144
fi
112145

113146
cat "$CONTAINERFILE"
114147
# Retry here to avoid quay.io "502 Bad Gateway"
115-
podman build --retry 5 --retry-delay 5s --tls-verify=false -t localhost/bootc:tmt -f "$CONTAINERFILE" "$BOOTC_TEMPDIR"
148+
# bind mount bootc source code folder for bootc binary building and run test provision
149+
# bind mount /var/share/test-artifacts for bootc RPM package installation in Fedora CI and OSCI
150+
if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then
151+
podman build \
152+
--retry 5 \
153+
--retry-delay 5s \
154+
--tls-verify=false \
155+
-v /var/share/test-artifacts:/rpms:z \
156+
-v "$(pwd)":/code:z \
157+
-t localhost/bootc:tmt \
158+
-f "$CONTAINERFILE" \
159+
"$BOOTC_TEMPDIR"
160+
else
161+
podman build \
162+
--retry 5 \
163+
--retry-delay 5s \
164+
--tls-verify=false \
165+
-v "$(pwd)":/code:z \
166+
-t localhost/bootc:tmt \
167+
-f "$CONTAINERFILE" \
168+
"$BOOTC_TEMPDIR"
169+
fi
116170

117171
podman images
118172
podman run \

0 commit comments

Comments
 (0)