Skip to content

Conversation

@martinpitt
Copy link
Contributor

@martinpitt martinpitt commented May 28, 2025

See https://issues.redhat.com/browse/RHEL-88396 and linux-system-roles/tox-lsr#202. As mentioned in the latter, I also have branches for less trivial roles, firewall (passing) and postgresql (spotted a bug). But I'd like to get this reviewed first, as iterating is cheap.

After we agree to the structure, I'll submit the general structure (first four commits) to .github.git, and send PRs for firewall and postgresql.

Summary by Sourcery

Add end-to-end bootc validation testing and update CI to support bootc-image scenarios

New Features:

  • Add bootc end-to-end validation test suite for QEMU container images

CI:

  • Install tox-lsr from the qemu-bootc branch
  • Pin Podman to 5.x on Ubuntu to maintain compatibility with the bootc-image-builder
  • Adjust tox-lsr invocation to skip and later execute bootc-e2e tests separately
  • Add a CI step to run bootc-e2e tests in QEMU for container-bootc images

Tests:

  • Introduce tests/tests_bootc_e2e.yml Ansible playbook defining the bootc end-to-end validation test

Summary by Sourcery

Add bootc end-to-end validation testing and enhance CI workflows to install updated dependencies, pin Podman, and run bootc-e2e tests separately in QEMU

New Features:

  • Add a bootc end-to-end validation test suite for QEMU container-bootc images

CI:

  • Bump tox-lsr dependency to v3.10.0 across GitHub Actions workflows
  • Pin Podman to version 5.x on Ubuntu for compatibility with the bootc-image-builder
  • Skip bootc-e2e tests in regular runs and introduce a dedicated CI step to execute them in QEMU

Tests:

  • Introduce tests/tests_bootc_e2e.yml playbook for end-to-end validation of bootc container images

@martinpitt martinpitt requested review from richm and spetrosi as code owners May 28, 2025 11:44
@sourcery-ai
Copy link

sourcery-ai bot commented May 28, 2025

Reviewer's Guide

This PR integrates an end-to-end bootc validation test suite into CI by upgrading tox-lsr, pinning Podman for compatibility, adjusting test invocations to exclude bootc tests by default, adding a dedicated QEMU job for bootc-image validation, and introducing a new Ansible playbook for bootc end-to-end testing.

Sequence Diagram for CI Bootc E2E Test Execution Flow

sequenceDiagram
    actor User
    participant GHA as "GitHub Actions"
    participant TOX as "Tox-LSR"
    participant QEMU as "QEMU Environment"
    participant ANSIBLE as "Ansible (tests_bootc_e2e.yml)"

    User->>GHA: Push code / Open PR
    activate GHA
    GHA->>GHA: Install dependencies (updated tox-lsr, pinned Podman)
    GHA->>TOX: Run standard tests (bootc tests skipped)
    activate TOX
    TOX-->>GHA: Standard tests complete
    deactivate TOX

    GHA->>TOX: Run bootc-e2e tests (dedicated step)
    activate TOX
    TOX->>QEMU: Setup and trigger bootc tests
    activate QEMU
    QEMU->>ANSIBLE: Execute bootc validation
    activate ANSIBLE
    ANSIBLE-->>QEMU: Validation results
    deactivate ANSIBLE
    QEMU-->>TOX: Test results
    deactivate QEMU
    TOX-->>GHA: Bootc e2e tests complete
    deactivate TOX
    GHA-->>User: CI Results
    deactivate GHA
Loading

File-Level Changes

Change Details Files
Upgrade tox-lsr version across all CI workflows
  • Bump tox-lsr reference from 3.9.0 to 3.10.0
  • Update pip install commands accordingly
.github/workflows/qemu-kvm-integration-tests.yml
.github/workflows/ansible-lint.yml
.github/workflows/ansible-managed-var-comment.yml
.github/workflows/ansible-test.yml
.github/workflows/python-unit-test.yml
Pin Podman to 5.x on Ubuntu for bootc-image-builder compatibility
  • Insert apt sources and preferences for ‘plucky’ release
  • Install Podman 5.x artifacts
.github/workflows/qemu-kvm-integration-tests.yml
Adjust standard test invocation to skip bootc-e2e tests
  • Add --skip-tags tests::bootc-e2e in tox command
  • Introduce $TOX_ARGS placeholder for later bootc runs
.github/workflows/qemu-kvm-integration-tests.yml
Add dedicated CI step to run bootc validation tests in QEMU
  • Detect container-bootc images and switch to qemu env
  • Loop over generated qcow2 images and run Ansible playbook
  • Capture and archive PASS/FAIL logs
.github/workflows/qemu-kvm-integration-tests.yml
Introduce Ansible playbook for bootc end-to-end validation
  • Create tests/tests_bootc_e2e.yml with build and validation tasks
  • Define roles and tasks for QEMU and buildah connections
tests/tests_bootc_e2e.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@martinpitt martinpitt marked this pull request as draft May 28, 2025 11:44
@codecov
Copy link

codecov bot commented May 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@f3cf515). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #58   +/-   ##
=======================================
  Coverage        ?   52.31%           
=======================================
  Files           ?        1           
  Lines           ?      346           
  Branches        ?        0           
=======================================
  Hits            ?      181           
  Misses          ?      165           
  Partials        ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @martinpitt - I've reviewed your changes and they look great!

Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@martinpitt
Copy link
Contributor Author

codespell lol -- why does that only hit now? Presumably just a new version? I'll add a new commit to ignore "passt".

@martinpitt martinpitt marked this pull request as ready for review May 28, 2025 12:23
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @martinpitt - I've reviewed your changes - here's some feedback:

  • The Update podman to 5.x hack block is tightly coupled to Ubuntu ‘plucky’—consider refactoring it into a reusable step or adding a clear TODO with removal criteria and target milestone.
  • In the Run bootc validation tests step, consider uploading both PASS and FAIL logs as artifacts (not only on failure) to simplify debugging of successful runs.
  • The test loop uses $TOX_ARGS without a default—add a fallback or an explicit check to avoid undefined variable errors during CI execution.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@martinpitt
Copy link
Contributor Author

Hey @martinpitt - I've reviewed your changes - here's some feedback:

* The `Update podman to 5.x` hack block is tightly coupled to Ubuntu ‘plucky’—consider refactoring it into a reusable step or adding a clear TODO with removal criteria and target milestone.

The removal criterion is clearly documented both in the commit message and a comment. Once this fails, it's a good reminder to revisit if it's still even applicable.

* In the `Run bootc validation tests` step, consider uploading both PASS and FAIL logs as artifacts (not only on failure) to simplify debugging of successful runs.

We don't currently do this, it's a waste. If/when we want that, let's do that in a separate PR.

* The test loop uses `$TOX_ARGS` without a default—add a fallback or an explicit check to avoid undefined variable errors during CI execution.

No, the workflow does set it by default.

@martinpitt

This comment was marked as outdated.

run: >-
tox -e ${{ matrix.scenario.env }} -- --image-name ${{ matrix.scenario.image }} --make-batch
--log-level debug --skip-tags tests::infiniband,tests::nvme,tests::scsi
--log-level debug $TOX_ARGS --skip-tags tests::bootc-e2e
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do you remove previous skip tags here?

Copy link
Contributor

Choose a reason for hiding this comment

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

We should also use TOX_ARGS: "--skip-tags tests::infiniband,tests::nvme,tests::scsi" for this.

Copy link
Contributor Author

@martinpitt martinpitt May 30, 2025

Choose a reason for hiding this comment

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

Because that's the exact value of the defined TOX_ARGS. The workflow defines that at the top but never actually used it. And it seems sensible to be able to parameterize it. Otherwise we could drop the unused definition at the top and repeat the value (or not, it's not super important for bootc e2e tests)

for t in $(grep -wl tests::bootc-e2e tests/tests_*.yml); do
test=$(basename ${t%.yml})
image_file="$(pwd)/tests/tmp/$test/qcow2/disk.qcow2"
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah - this is where the /tmp/ directory is used. Hmm - not sure how to get the $LSR_TOX_ENV_TMP_DIR in this context - this may also be problematic when testing the collections format, because the test directory is tests/$rolename/ and not ....$rolename/tests/ there

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't $LSR_TOX_ENV_TMP_DIR at the moment, but OUTPUT="./tmp/$BUILDAH_ID" in bootc-buildah-qcow.sh (in the tox-lsr PR). We can of course change it on both sides.

@martinpitt
Copy link
Contributor Author

I updated the workflow to the version in #59 which supports both new exclusive bootc-e2e tests as well as modifying existing tests.

@martinpitt martinpitt marked this pull request as draft June 2, 2025 06:27
This *is* the correct name for our test dependency. The most recent
codespell version started to complain about it.
@martinpitt martinpitt force-pushed the qemu-bootc branch 2 times, most recently from d995c25 to 2ed8ec2 Compare June 2, 2025 07:09
@martinpitt
Copy link
Contributor Author

martinpitt commented Jun 2, 2025

Meh, now F41 fails with "Installing to filesystem: Creating ostree deployment: invalid reference format". This is reproducible locally. Reported as osbuild/bootc-image-builder#949 , and it is fixed in https://bodhi.fedoraproject.org/updates/FEDORA-2025-f68c3fced6

Ubuntu 24.04's podman 4.9.3 does not work with the bootc-image-builder
container: Bind-mounting the container storage into it makes the
container's podman 5 fail with a storage error.

Thus install podman 5.4 from Ubuntu 25.04 to regain compatibility. This
is rather hackish, but as that is a stable release, it should not break
in the future (wrt. library dependencies and such).
These tests run the role during a bootc container image build, deploy
the container into a QEMU VM, boot that, and validate the expected
configuration there. They run in two different tox environments, and
thus have to be run in two steps (preparation in buildah, validation in
QEMU). The preparation is expected to output a qcow2 image in
`tests/tmp/TESTNAME/qcow2/disk.qcow2`, i.e. the output structure of
<https://github.com/osbuild/bootc-image-builder>.

There are two possibilities:

 * Have separate bootc end-to-end tests. These are tagged with
   `tests::bootc-e2` and are skipped in the normal qemu-* scenarios.
   They run as part of the container-* ones.

 * Modify an existing test: These need to build a qcow2 image exactly
   *once* (via calling `bootc-buildah-qcow.sh`) and skip setup/cleanup
   and role invocations in validation mode, i.e. when
   `__bootc_validation` is true.

In the container scenario, run the QEMU validation as a separate step in
the workflow.

See https://issues.redhat.com/browse/RHEL-88396
@martinpitt martinpitt removed the blocked label Jun 2, 2025
@martinpitt martinpitt requested a review from richm June 2, 2025 21:22
@martinpitt martinpitt marked this pull request as ready for review June 2, 2025 21:22
@martinpitt
Copy link
Contributor Author

Updated to tox 3.10.0. Most probably we'll land #59 instead, but then this at least serves as a worked example how to do a new test.

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @martinpitt - I've reviewed your changes - here's some feedback:

  • The APT pinning hack for Podman is pretty complex and brittle—consider isolating it into a reusable script or container image and clearly marking its removal checkpoint once Ubuntu 26.04 LTS is in use.
  • In the QEMU bootc-e2e step, add an explicit check or log if no image files are found so it doesn’t silently skip all tests when tests/tmp/*/qcow2/disk.qcow2 is empty.
  • You’ve repeated the tox-lsr version bump across four workflows—consider using a shared variable or workflow template to DRY up that change.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@martinpitt
Copy link
Contributor Author

Landed #59.

@martinpitt martinpitt closed this Jun 3, 2025
@martinpitt martinpitt deleted the qemu-bootc branch June 3, 2025 05:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants