@@ -4,115 +4,65 @@ set -exuo pipefail
44# This script basically builds bootc from source using the provided base image,
55# then runs the target tests.
66
7- mkdir -p /tmp/tmp-bootc-build
8- BOOTC_TEMPDIR=" /tmp/tmp-bootc-build"
9-
10- # Get OS info from TEST_OS env
11- OS_ID=$( echo " $TEST_OS " | cut -d ' -' -f 1)
12- OS_VERSION_ID=$( echo " $TEST_OS " | cut -d ' -' -f 2)
13-
14- # Base image
15- case " $OS_ID " in
16- " centos" )
17- TIER1_IMAGE_URL=" quay.io/centos-bootc/centos-bootc:stream${OS_VERSION_ID} "
7+ # If provided should be of the form fedora-42 or centos-10
8+ target=${1:- }
9+
10+ build_args=()
11+ if test -n " ${target:- } " ; then
12+ shift
13+ # Get OS info from TEST_OS env
14+ OS_ID=$( echo " $target " | cut -d ' -' -f 1)
15+ OS_VERSION_ID=$( echo " $target " | cut -d ' -' -f 2)
16+
17+ # Base image
18+ case " $OS_ID " in
19+ " centos" )
20+ BASE=" quay.io/centos-bootc/centos-bootc:stream${OS_VERSION_ID} "
1821 ;;
19- " fedora" )
20- TIER1_IMAGE_URL =" quay.io/fedora/fedora-bootc:${OS_VERSION_ID} "
22+ " fedora" )
23+ BASE =" quay.io/fedora/fedora-bootc:${OS_VERSION_ID} "
2124 ;;
22- esac
23-
24- CONTAINERFILE=" ${BOOTC_TEMPDIR} /Containerfile"
25- tee " $CONTAINERFILE " > /dev/null << CONTAINERFILEOF
26- FROM $TIER1_IMAGE_URL as build
27-
28- WORKDIR /code
29-
30- RUN <<EORUN
31- set -xeuo pipefail
32- . /usr/lib/os-release
33- case \$ ID in
34- centos|rhel) dnf config-manager --set-enabled crb;;
35- fedora) dnf -y install dnf-utils 'dnf5-command(builddep)';;
36- esac
37- dnf -y builddep contrib/packaging/bootc.spec
38- dnf -y install git-core
39- EORUN
40-
41- RUN mkdir -p /build/target/dev-rootfs
42- # git config --global --add safe.directory /code to fix "fatal: detected dubious ownership in repository at '/code'" error
43- RUN --mount=type=cache,target=/build/target --mount=type=cache,target=/var/roothome git config --global --add safe.directory /code && make test-bin-archive && mkdir -p /out && cp target/bootc.tar.zst /out
44-
45- FROM $TIER1_IMAGE_URL
46-
47- # Inject our built code
48- COPY --from=build /out/bootc.tar.zst /tmp
49- RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/*
50-
51- RUN <<EORUN
52- set -xeuo pipefail
53-
54- # Provision test requirement
55- /code/hack/provision-derived.sh
56- # Also copy in some default install configs we use for testing
57- cp -a /code/hack/install-test-configs/* /usr/lib/bootc/install/
58- # And some test kargs
59- cp -a /code/hack/test-kargs/* /usr/lib/bootc/kargs.d/
60-
61- # For testing farm
62- mkdir -p -m 0700 /var/roothome
63-
64- # Enable ttyS0 console
65- mkdir -p /usr/lib/bootc/kargs.d/
66- cat <<KARGEOF >> /usr/lib/bootc/kargs.d/20-console.toml
67- kargs = ["console=ttyS0,115200n8"]
68- KARGEOF
69-
70- # For test-22-logically-bound-install
71- cp -a /code/tmt/tests/lbi/usr/. /usr
72- ln -s /usr/share/containers/systemd/curl.container /usr/lib/bootc/bound-images.d/curl.container
73- ln -s /usr/share/containers/systemd/curl-base.image /usr/lib/bootc/bound-images.d/curl-base.image
74- ln -s /usr/share/containers/systemd/podman.image /usr/lib/bootc/bound-images.d/podman.image
75-
76- # Install rsync which is required by tmt
77- dnf -y install cloud-init rsync
78- dnf -y clean all
25+ * ) echo " Unknown OS: ${OS_ID} " 1>&2 ; exit 1
26+ ;;
27+ esac
28+ build_args+=(" --build-arg=base=$BASE " )
29+ fi
7930
80- rm -rf /var/cache /var/lib/dnf
81- EORUN
82- CONTAINERFILEOF
31+ just build ${build_args[@]}
32+ just build-integration-test-image
8333
84- LOCAL_IMAGE=" localhost/bootc:test"
85- podman build \
86- --retry 5 \
87- --retry-delay 5s \
88- -v " $( pwd) " :/code:z \
89- -t " $LOCAL_IMAGE " \
90- -f " $CONTAINERFILE " \
91- " $BOOTC_TEMPDIR "
34+ # Host builds will have this already, but we use it as a general dumping space
35+ # for output artifacts
36+ mkdir -p target
9237
93- SSH_KEY=${BOOTC_TEMPDIR} /id_rsa
38+ SSH_KEY=$( pwd) /target/id_rsa
39+ rm -vf " ${SSH_KEY} " *
9440ssh-keygen -f " ${SSH_KEY} " -N " " -q -t rsa-sha2-256 -b 2048
41+ chmod 600 " ${SSH_KEY} "
9542
96- truncate -s 10G " ${BOOTC_TEMPDIR} /disk.raw"
43+ rm -vf target/disk.raw
44+ truncate -s 10G " target/disk.raw"
9745
9846# For test-22-logically-bound-install
9947podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest
10048podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest
10149podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest
10250
51+ mkdir -p target/disks
52+
10353podman run \
10454 --rm \
10555 --privileged \
10656 --pid=host \
10757 --security-opt label=type:unconfined_t \
10858 -v /var/lib/containers:/var/lib/containers \
10959 -v /dev:/dev \
110- -v " $BOOTC_TEMPDIR " :/output \
111- " $LOCAL_IMAGE " \
60+ -v $( pwd ) /target:/target \
61+ localhost/bootc-integration \
11262 bootc install to-disk \
11363 --filesystem " xfs" \
114- --root-ssh-authorized-keys " /output /id_rsa.pub" \
64+ --root-ssh-authorized-keys " /target /id_rsa.pub" \
11565 --karg=console=ttyS0,115200n8 \
11666 --generic-image \
11767 --via-loopback \
118- /output /disk.raw
68+ /target /disk.raw
0 commit comments