Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions hack/Containerfile.packit
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ COPY ARTIFACTS /var/ARTIFACTS
# Copy bootc repo
COPY test-artifacts /var/share/test-artifacts

ARG GATING
RUN <<EORUN
set -xeuo pipefail
. /usr/lib/os-release
Expand All @@ -22,6 +23,12 @@ cp test-artifacts.repo /etc/yum.repos.d/
dnf -y update bootc
./provision-derived.sh

if [[ "$GATING" == true ]]; then
# Install Fedora CI/OSCI required packages for "Prepare dist-git sources" task
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be clear, this is to get the tests? Ah I see, we're shipping them in the .tar.zstd today. But in theory we shouldn't need the full build dependencies just to get those...

Is extracting the .src.rpm really what others do here? I guess we could make a -tests subpackage?

Copy link
Collaborator Author

@henrywang henrywang Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in Fedora/OSCI gating, two tasks will be running after our prepare:

queued prepare task #1: essential-requires on default-0
queued prepare task #2: default-0 on default-0 --> our install prepare
queued prepare task #3: default-1 on default-0 --> our provision prepare
queued prepare task #4: Prepare dist-git sources (buildrequires, patches, discovery...) on default-0 --> install packages with `rpm-build @buildsys-build 'dnf-command(builddep)`
queued prepare task #5: requires (dist-git) on default-0 --> install builddeps packages
queued prepare task #6: recommends (dist-git) on default-0

Because those package installations prepares are under our provision prepare, so we need pre-build those packages, which will be used by task 3 and task 4, into our image.

dnf install -y rpm-build @buildsys-build 'dnf-command(builddep)'
dnf builddep -y /var/share/test-artifacts/*.src.rpm
fi

# For test-22-logically-bound-install
cp -a lbi/usr/. /usr
for x in curl.container curl-base.image podman.image; do
Expand Down
6 changes: 0 additions & 6 deletions hack/packit-reboot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@
- name: Reboot after system-reinstall-bootc
hosts: all
tasks:
- name: Check system mode
shell: bootc status --json | jq -r '.status.type'
register: os_mode

# null type means package mode
- name: Reboot system to image mode
reboot:
when: os_mode.stdout == 'null'

- name: Wait for connection to become reachable/usable
wait_for_connection:
Expand Down
15 changes: 4 additions & 11 deletions hack/provision-packit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ set -exuo pipefail
# Check environment
printenv

# This script only runs on Packit and gating environment
# Do not run this script for image mode system
if command -v bootc >/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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
3 changes: 2 additions & 1 deletion tests/run-tmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 "$@"
26 changes: 21 additions & 5 deletions tmt/plans/integration.fmf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah. But if we do this, do we need the dnf builddep per above at all? I don't think so...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. We don't need buiddep packages, but FedoraCI/OSCI needs those packages.

- 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

Expand Down Expand Up @@ -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

Expand All @@ -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