Skip to content

Commit d4b3ef2

Browse files
committed
test: update bootc install script to support Fedora CI gating test
Also rename test-00-bootc-install to bootc-install-provision to make more sense Signed-off-by: Xiaofeng Wang <henrywangxf@me.com>
1 parent b1fb35c commit d4b3ef2

File tree

4 files changed

+77
-28
lines changed

4 files changed

+77
-28
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: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 65 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,26 @@ 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+
# Fedora CI: https://github.com/fedora-ci/dist-git-pipeline/blob/master/Jenkinsfile#L145
23+
# OSCI: https://gitlab.cee.redhat.com/osci-pipelines/dist-git-pipeline/-/blob/master/Jenkinsfile?ref_type=heads#L93
24+
if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then
25+
# Just left those ls commands here to ring the bell for me when something changed
26+
echo "$TMT_SOURCE_DIR"
27+
ls -al "$TMT_SOURCE_DIR"
28+
ls -al "$TMT_SOURCE_DIR/SRPMS"
29+
ls -al /etc/yum.repos.d
30+
cat /etc/yum.repos.d/test-artifacts.repo
31+
ls -al /var/share/test-artifacts
32+
33+
# hack and tmt folders in dist source are required by test
34+
cp -a ../../hack "$BOOTC_TEMPDIR"
35+
cp -a ../../tmt "$BOOTC_TEMPDIR"
36+
# bootc CI
37+
else
38+
# Copy bootc root folder to image build root folder
39+
# Required by bootc CI to build bootc binary
40+
cp -a ../../. "$BOOTC_TEMPDIR"
41+
fi
2442

2543
# TMT needs this key
2644
cp -r /root/.ssh "$BOOTC_TEMPDIR"
@@ -40,31 +58,15 @@ if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
4058
ls -al "$BOOTC_TEMPDIR"
4159

4260
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
54-
55-
FROM $TIER1_IMAGE_URL
5661

62+
COMMON_CONTAINERFILE="${BOOTC_TEMPDIR}/common_containerfile"
63+
tee "$COMMON_CONTAINERFILE" > /dev/null << COMMONEOF
5764
COPY hack/provision-derived.sh /tmp
5865
RUN /tmp/provision-derived.sh && rm -f /tmp/*.sh
5966
# Also copy in some default install configs we use for testing
6067
COPY hack/install-test-configs/* /usr/lib/bootc/install/
6168
# And some test kargs
6269
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/ /
6870
6971
RUN <<EORUN
7072
set -xeuo pipefail
@@ -91,7 +93,49 @@ COPY bin /usr/local/bin
9193
9294
# In Testing Farm, all ssh things should be reserved for ssh command run after reboot
9395
COPY .ssh /var/roothome/.ssh
96+
COMMONEOF
97+
98+
if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then
99+
FEDORA_CI_CONTAINERFILE="${BOOTC_TEMPDIR}/fedora_ci_containerfile"
100+
tee "$FEDORA_CI_CONTAINERFILE" > /dev/null << FEDORACIEOF
101+
FROM $TIER1_IMAGE_URL
102+
103+
RUN dnf -y upgrade /rpms/*.rpm
104+
FEDORACIEOF
105+
cat >"$CONTAINERFILE" <<REALEOF
106+
$(cat "$FEDORA_CI_CONTAINERFILE")
107+
$(cat "$COMMON_CONTAINERFILE")
108+
94109
REALEOF
110+
else
111+
BOOTC_CI_CONTAINERFILE="${BOOTC_TEMPDIR}/bootc_ci_containerfile"
112+
tee "$BOOTC_CI_CONTAINERFILE" > /dev/null << BOOTCCIEOF
113+
FROM $TIER1_IMAGE_URL as build
114+
115+
COPY contrib /contrib
116+
COPY hack/build.sh /build.sh
117+
RUN /build.sh && rm -v /build.sh
118+
COPY . /build
119+
WORKDIR /build
120+
121+
RUN mkdir -p /build/target/dev-rootfs
122+
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
123+
124+
FROM $TIER1_IMAGE_URL
125+
126+
# Inject our built code
127+
COPY --from=build /out/bootc.tar.zst /tmp
128+
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/*
129+
# Also copy over arbitrary bits from the target root
130+
COPY --from=build /build/target/dev-rootfs/ /
131+
132+
BOOTCCIEOF
133+
cat >"$CONTAINERFILE" <<REALEOF
134+
$(cat "$BOOTC_CI_CONTAINERFILE")
135+
$(cat "$COMMON_CONTAINERFILE")
136+
REALEOF
137+
fi
138+
95139

96140
if [[ -d "/var/ARTIFACTS" ]]; then
97141
# In Testing Farm, TMT work dir /var/ARTIFACTS should be reserved
@@ -112,7 +156,7 @@ REALEOF
112156

113157
cat "$CONTAINERFILE"
114158
# 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"
159+
podman build --retry 5 --retry-delay 5s --tls-verify=false -v /var/share/test-artifacts:/rpms:z -t localhost/bootc:tmt -f "$CONTAINERFILE" "$BOOTC_TEMPDIR"
116160

117161
podman images
118162
podman run \

0 commit comments

Comments
 (0)