@@ -4,115 +4,65 @@ set -exuo pipefail
4
4
# This script basically builds bootc from source using the provided base image,
5
5
# then runs the target tests.
6
6
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} "
18
21
;;
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} "
21
24
;;
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
79
30
80
- rm -rf /var/cache /var/lib/dnf
81
- EORUN
82
- CONTAINERFILEOF
31
+ just build ${build_args[@]}
32
+ just build-integration-test-image
83
33
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
92
37
93
- SSH_KEY=${BOOTC_TEMPDIR} /id_rsa
38
+ SSH_KEY=$( pwd) /target/id_rsa
39
+ rm -vf " ${SSH_KEY} " *
94
40
ssh-keygen -f " ${SSH_KEY} " -N " " -q -t rsa-sha2-256 -b 2048
41
+ chmod 600 " ${SSH_KEY} "
95
42
96
- truncate -s 10G " ${BOOTC_TEMPDIR} /disk.raw"
43
+ rm -vf target/disk.raw
44
+ truncate -s 10G " target/disk.raw"
97
45
98
46
# For test-22-logically-bound-install
99
47
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest
100
48
podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest
101
49
podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest
102
50
51
+ mkdir -p target/disks
52
+
103
53
podman run \
104
54
--rm \
105
55
--privileged \
106
56
--pid=host \
107
57
--security-opt label=type:unconfined_t \
108
58
-v /var/lib/containers:/var/lib/containers \
109
59
-v /dev:/dev \
110
- -v " $BOOTC_TEMPDIR " :/output \
111
- " $LOCAL_IMAGE " \
60
+ -v $( pwd ) /target:/target \
61
+ localhost/bootc-integration \
112
62
bootc install to-disk \
113
63
--filesystem " xfs" \
114
- --root-ssh-authorized-keys " /output /id_rsa.pub" \
64
+ --root-ssh-authorized-keys " /target /id_rsa.pub" \
115
65
--karg=console=ttyS0,115200n8 \
116
66
--generic-image \
117
67
--via-loopback \
118
- /output /disk.raw
68
+ /target /disk.raw
0 commit comments