Skip to content

Commit 7b24e98

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 7b24e98

File tree

4 files changed

+78
-25
lines changed

4 files changed

+78
-25
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 renamed to tmt/tests/bootc-install-provision.sh

Lines changed: 66 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,27 @@ case "$ID" in
1919
esac
2020

2121
if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
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+
echo "$TMT_SOURCE_DIR"
26+
ls -al "$TMT_SOURCE_DIR"
27+
ls -al "$TMT_SOURCE_DIR/SRPMS"
28+
ls -al /etc/yum.repos.d
29+
cat /etc/yum.repos.d/test-artifacts.repo
30+
ls -al /var/share/test-artifacts
31+
# get bootc and system-reinstall-bootc rpm package name
32+
BOOTC_RPM_FULL_PATH=$(find /var/share/test-artifacts/ -type f | grep -E '/bootc-[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}-[0-9]{1,2}.(fc|el)[0-9]{1,2}.(x86_64|aarch64).rpm$')
33+
BOOTC_RPM_FILE_NAME=$(basename "$BOOTC_RPM_FULL_PATH")
34+
SYSTEM_REINSTALL_BOOTC_RPM_FULL_PATH=$(find /var/share/test-artifacts/ -type f | grep -E '/system-reinstall-bootc-[0-9]{1,2}.[0-9]{1,2}.[0-9]{1,2}-[0-9]{1,2}.(fc|el)[0-9]{1,2}.(x86_64|aarch64).rpm$')
35+
SYSTEM_REINSTALL_BOOTC_RPM_FILE_NAME=$(basename "$SYSTEM_REINSTALL_BOOTC_RPM_FULL_PATH")
36+
# Copy bootc rpm package to image build root folder
37+
cp "$BOOTC_RPM_FULL_PATH" "$SYSTEM_REINSTALL_BOOTC_RPM_FULL_PATH" "$BOOTC_TEMPDIR"
38+
fi
39+
2240
# Copy bootc root folder to image build root folder
41+
# Required by bootc CI to build bootc binary
42+
# And Required by Fedora CI for some folders for test
2343
cp -a ../../. "$BOOTC_TEMPDIR"
2444

2545
# TMT needs this key
@@ -40,31 +60,15 @@ if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then
4060
ls -al "$BOOTC_TEMPDIR"
4161

4262
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
5663

64+
COMMON_CONTAINERFILE="${BOOTC_TEMPDIR}/common_containerfile"
65+
tee "$COMMON_CONTAINERFILE" > /dev/null << COMMONEOF
5766
COPY hack/provision-derived.sh /tmp
5867
RUN /tmp/provision-derived.sh && rm -f /tmp/*.sh
5968
# Also copy in some default install configs we use for testing
6069
COPY hack/install-test-configs/* /usr/lib/bootc/install/
6170
# And some test kargs
6271
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/ /
6872
6973
RUN <<EORUN
7074
set -xeuo pipefail
@@ -91,7 +95,51 @@ COPY bin /usr/local/bin
9195
9296
# In Testing Farm, all ssh things should be reserved for ssh command run after reboot
9397
COPY .ssh /var/roothome/.ssh
98+
COMMONEOF
99+
100+
if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then
101+
FEDORA_CI_CONTAINERFILE="${BOOTC_TEMPDIR}/fedora_ci_containerfile"
102+
tee "$FEDORA_CI_CONTAINERFILE" > /dev/null << FEDORACIEOF
103+
FROM $TIER1_IMAGE_URL
104+
105+
COPY $BOOTC_RPM_FILE_NAME /$BOOTC_RPM_FILE_NAME
106+
COPY $SYSTEM_REINSTALL_BOOTC_RPM_FILE_NAME /$SYSTEM_REINSTALL_BOOTC_RPM_FILE_NAME
107+
RUN dnf remove -y bootc system-reinstall-bootc && dnf install -y /$BOOTC_RPM_FILE_NAME /$SYSTEM_REINSTALL_BOOTC_RPM_FILE_NAME rpm-ostree
108+
FEDORACIEOF
109+
cat >"$CONTAINERFILE" <<REALEOF
110+
$(cat "$FEDORA_CI_CONTAINERFILE")
111+
$(cat "$COMMON_CONTAINERFILE")
112+
94113
REALEOF
114+
else
115+
BOOTC_CI_CONTAINERFILE="${BOOTC_TEMPDIR}/bootc_ci_containerfile"
116+
tee "$BOOTC_CI_CONTAINERFILE" > /dev/null << BOOTCCIEOF
117+
FROM $TIER1_IMAGE_URL as build
118+
119+
COPY contrib /contrib
120+
COPY hack/build.sh /build.sh
121+
RUN /build.sh && rm -v /build.sh
122+
COPY . /build
123+
WORKDIR /build
124+
125+
RUN mkdir -p /build/target/dev-rootfs
126+
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
127+
128+
FROM $TIER1_IMAGE_URL
129+
130+
# Inject our built code
131+
COPY --from=build /out/bootc.tar.zst /tmp
132+
RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/*
133+
# Also copy over arbitrary bits from the target root
134+
COPY --from=build /build/target/dev-rootfs/ /
135+
136+
BOOTCCIEOF
137+
cat >"$CONTAINERFILE" <<REALEOF
138+
$(cat "$BOOTC_CI_CONTAINERFILE")
139+
$(cat "$COMMON_CONTAINERFILE")
140+
REALEOF
141+
fi
142+
95143

96144
if [[ -d "/var/ARTIFACTS" ]]; then
97145
# In Testing Farm, TMT work dir /var/ARTIFACTS should be reserved

0 commit comments

Comments
 (0)