diff --git a/hack/Containerfile.packit b/hack/Containerfile.packit index 1c289891d..efecf1357 100644 --- a/hack/Containerfile.packit +++ b/hack/Containerfile.packit @@ -12,6 +12,7 @@ COPY ARTIFACTS /var/ARTIFACTS # Copy bootc repo COPY test-artifacts /var/share/test-artifacts +ARG GATING RUN </dev/null && bootc status --json | grep '"type":"bootcHost"'; then - echo "This system is Image Mode." - exit 0 -fi - -# Install required packages -dnf install -y podman skopeo jq bootc system-reinstall-bootc expect ansible-core - # temp folder to save building files and folders BOOTC_TEMPDIR=$(mktemp -d) trap 'rm -rf -- "$BOOTC_TEMPDIR"' EXIT @@ -87,6 +77,9 @@ if [[ -v KOJI_TASK_ID ]] || [[ -v CI_KOJI_TASK_ID ]]; then echo "$TMT_SOURCE_DIR" ls -al "$TMT_SOURCE_DIR" ls -al "$TMT_SOURCE_DIR/SRPMS" + GATING="true" +else + GATING="false" fi ls -al /etc/yum.repos.d @@ -100,7 +93,7 @@ cp /etc/yum.repos.d/test-artifacts.repo "$BOOTC_TEMPDIR" ls -al "$BOOTC_TEMPDIR" "${BOOTC_TEMPDIR}/bin" # Do not use just because it's only available on Fedora, not on CS and RHEL -podman build --jobs=4 --from "$BASE" -v "$BOOTC_TEMPDIR":/bootc-test:z -t localhost/bootc-integration -f "${BOOTC_TEMPDIR}/Containerfile.packit" "$BOOTC_TEMPDIR" +podman build --jobs=4 --from "$BASE" --build-arg GATING="$GATING" -v "$BOOTC_TEMPDIR":/bootc-test:z -t localhost/bootc-integration -f "${BOOTC_TEMPDIR}/Containerfile.packit" "$BOOTC_TEMPDIR" # Keep these in sync with what's used in hack/lbi podman pull -q --retry 5 --retry-delay 5s quay.io/curl/curl:latest quay.io/curl/curl-base:latest registry.access.redhat.com/ubi9/podman:latest diff --git a/tests/run-tmt.sh b/tests/run-tmt.sh index 8b89c02d1..92672a41b 100755 --- a/tests/run-tmt.sh +++ b/tests/run-tmt.sh @@ -23,4 +23,5 @@ rm -vrf /var/tmp/tmt/testcloud/images/bootc-integration-test.qcow2 cd target/tmt-workdir # TMT will rsync tmt-* scripts to TMT_SCRIPTS_DIR=/var/lib/tmt/scripts -exec tmt --context "test_disk_image=${DISK}" run --all -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts "$@" +# running_env=image_mode means running tmt on image mode system on Github CI or locally +exec tmt --context "test_disk_image=${DISK}" --context "running_env=image_mode" run --all -e TMT_SCRIPTS_DIR=/var/lib/tmt/scripts "$@" diff --git a/tmt/plans/integration.fmf b/tmt/plans/integration.fmf index a423bd2aa..42d41f671 100644 --- a/tmt/plans/integration.fmf +++ b/tmt/plans/integration.fmf @@ -2,16 +2,32 @@ provision: how: virtual image: $@{test_disk_image} prepare: - # Replace package mode with image mode + # Install image mode system on package mode system + # Do not run on image mode VM running on Github CI and Locally + # Run on package mode VM running on Packit and Gating + - how: install + package: + - podman + - skopeo + - jq + - bootc + - system-reinstall-bootc + - expect + - ansible-core + - zstd + when: running_env != image_mode - how: shell script: - - pwd && ls -al - - if [[ -d hack ]]; then cd hack && ./provision-packit.sh; fi + - mkdir -p bootc && cp /var/share/test-artifacts/*.src.rpm bootc + - cd bootc && rpm2cpio *.src.rpm | cpio -idmv && rm -f *-vendor.tar.zstd && zstd -d *.tar.zstd && tar -xvf *.tar -C . --strip-components=1 && ls -al + - pwd && ls -al && cd bootc/hack && ./provision-packit.sh + when: running_env != image_mode # tmt-reboot and reboot do not work in this case # reboot in ansible is the only way to reboot in tmt prepare - how: ansible playbook: - https://github.com/bootc-dev/bootc/raw/refs/heads/main/hack/packit-reboot.yml + when: running_env != image_mode execute: how: tmt @@ -71,7 +87,7 @@ execute: test: - /tmt/tests/test-26-examples-build adjust: - - when: running_env == packit + - when: running_env != image_mode enabled: false because: packit tests use RPM bootc and does not install /usr/lib/bootc/initramfs-setup @@ -82,6 +98,6 @@ execute: test: - /tmt/tests/test-27-custom-selinux-policy adjust: - - when: running_env == packit + - when: running_env != image_mode enabled: false because: tmt-reboot does not work with systemd reboot in testing farm environment