diff --git a/hack/provision-derived.sh b/hack/provision-derived.sh index 688716129..c9b456495 100755 --- a/hack/provision-derived.sh +++ b/hack/provision-derived.sh @@ -18,7 +18,12 @@ case "${ID}-${VERSION_ID}" in dnf -y install nu dnf clean all ;; - "centos-10") + "rhel-9."*) + dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + dnf -y install nu + dnf clean all + ;; + "centos-10"|"rhel-10."*) # nu is not available in CS10 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 mkdir -p nu && tar zvxf nu.tar.gz --strip-components=1 -C nu diff --git a/tmt/plans/integration.fmf b/tmt/plans/integration.fmf index fab04517d..bc518831c 100644 --- a/tmt/plans/integration.fmf +++ b/tmt/plans/integration.fmf @@ -3,7 +3,7 @@ # local image: file:///home/foobar/image.qcow2 provision: how: virtual - 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 + image: fedora-rawhide prepare: - how: install package: @@ -18,7 +18,7 @@ execute: discover: how: fmf test: - - /tmt/tests/test-00-bootc-install + - /tmt/tests/bootc-install-provision - /tmt/tests/test-01-readonly /test-20-local-upgrade: @@ -26,7 +26,7 @@ execute: discover: how: fmf test: - - /tmt/tests/test-00-bootc-install + - /tmt/tests/bootc-install-provision - /tmt/tests/test-20-local-upgrade /test-21-logically-bound-switch: @@ -34,7 +34,7 @@ execute: discover: how: fmf test: - - /tmt/tests/test-00-bootc-install + - /tmt/tests/bootc-install-provision - /tmt/tests/test-21-logically-bound-switch /test-22-logically-bound-install: @@ -44,7 +44,7 @@ execute: discover: how: fmf test: - - /tmt/tests/test-00-bootc-install + - /tmt/tests/bootc-install-provision - /tmt/tests/test-22-logically-bound-install /test-23-install-outside-container: @@ -52,5 +52,5 @@ execute: discover: how: fmf test: - - /tmt/tests/test-00-bootc-install + - /tmt/tests/bootc-install-provision - /tmt/tests/test-23-install-outside-container diff --git a/tmt/tests/test-00-bootc-install.fmf b/tmt/tests/bootc-install-provision.fmf similarity index 69% rename from tmt/tests/test-00-bootc-install.fmf rename to tmt/tests/bootc-install-provision.fmf index 2802ac666..d55e5c71a 100644 --- a/tmt/tests/test-00-bootc-install.fmf +++ b/tmt/tests/bootc-install-provision.fmf @@ -1,3 +1,3 @@ summary: Run bootc install to-existing-root to deploy bootc image -test: ./test-00-bootc-install.sh +test: ./bootc-install-provision.sh duration: 30m diff --git a/tmt/tests/test-00-bootc-install.sh b/tmt/tests/bootc-install-provision.sh similarity index 57% rename from tmt/tests/test-00-bootc-install.sh rename to tmt/tests/bootc-install-provision.sh index b40766d60..c4c884bc0 100755 --- a/tmt/tests/test-00-bootc-install.sh +++ b/tmt/tests/bootc-install-provision.sh @@ -19,8 +19,19 @@ case "$ID" in esac if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then - # Copy bootc root folder to image build root folder - cp -a ../../. "$BOOTC_TEMPDIR" + # Let's move to bootc root folder + cd ../.. + # Fedora CI: https://github.com/fedora-ci/dist-git-pipeline/blob/master/Jenkinsfile#L145 + # OSCI: https://gitlab.cee.redhat.com/osci-pipelines/dist-git-pipeline/-/blob/master/Jenkinsfile?ref_type=heads#L93 + if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then + # Just left those ls commands here to ring the bell for me when something changed + echo "$TMT_SOURCE_DIR" + ls -al "$TMT_SOURCE_DIR" + ls -al "$TMT_SOURCE_DIR/SRPMS" + ls -al /etc/yum.repos.d + cat /etc/yum.repos.d/test-artifacts.repo + ls -al /var/share/test-artifacts + fi # TMT needs this key cp -r /root/.ssh "$BOOTC_TEMPDIR" @@ -40,34 +51,18 @@ if [ "$TMT_REBOOT_COUNT" -eq 0 ]; then ls -al "$BOOTC_TEMPDIR" CONTAINERFILE=${BOOTC_TEMPDIR}/Containerfile - tee "$CONTAINERFILE" > /dev/null << REALEOF -FROM $TIER1_IMAGE_URL as build - -COPY contrib /contrib -COPY hack/build.sh /build.sh -RUN /build.sh && rm -v /build.sh -COPY . /build -WORKDIR /build - -RUN mkdir -p /build/target/dev-rootfs -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 -FROM $TIER1_IMAGE_URL + COMMON_CONTAINERFILE="${BOOTC_TEMPDIR}/common_containerfile" + tee "$COMMON_CONTAINERFILE" > /dev/null << COMMONEOF +RUN < /dev/null << FEDORACIEOF +FROM $TIER1_IMAGE_URL + +RUN dnf -y upgrade /rpms/*.rpm +FEDORACIEOF + cat >"$CONTAINERFILE" < /dev/null << BOOTCCIEOF +FROM $TIER1_IMAGE_URL as build + +WORKDIR /code +RUN hack/build.sh + +RUN mkdir -p /build/target/dev-rootfs +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 + +FROM $TIER1_IMAGE_URL + +# Inject our built code +COPY --from=build /out/bootc.tar.zst /tmp +RUN tar -C / --zstd -xvf /tmp/bootc.tar.zst && rm -vrf /tmp/* +# Also copy over arbitrary bits from the target root +COPY --from=build /build/target/dev-rootfs/ / + +BOOTCCIEOF + cat >"$CONTAINERFILE" <> "$CONTAINERFILE" - 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" + 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" podman pull --retry 5 --retry-delay 5s quay.io/curl/curl:latest podman pull --retry 5 --retry-delay 5s quay.io/curl/curl-base:latest podman pull --retry 5 --retry-delay 5s registry.access.redhat.com/ubi9/podman:latest @@ -112,7 +145,28 @@ REALEOF cat "$CONTAINERFILE" # Retry here to avoid quay.io "502 Bad Gateway" - podman build --retry 5 --retry-delay 5s --tls-verify=false -t localhost/bootc:tmt -f "$CONTAINERFILE" "$BOOTC_TEMPDIR" + # bind mount bootc source code folder for bootc binary building and run test provision + # bind mount /var/share/test-artifacts for bootc RPM package installation in Fedora CI and OSCI + if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then + podman build \ + --retry 5 \ + --retry-delay 5s \ + --tls-verify=false \ + -v /var/share/test-artifacts:/rpms:z \ + -v "$(pwd)":/code:z \ + -t localhost/bootc:tmt \ + -f "$CONTAINERFILE" \ + "$BOOTC_TEMPDIR" + else + podman build \ + --retry 5 \ + --retry-delay 5s \ + --tls-verify=false \ + -v "$(pwd)":/code:z \ + -t localhost/bootc:tmt \ + -f "$CONTAINERFILE" \ + "$BOOTC_TEMPDIR" + fi podman images podman run \