Skip to content

Add bootc support for prepare shell step #4495

@thrix

Description

@thrix

Summary

Add support for bootc guests in the prepare/shell step, allowing shell scripts to be executed as part of the bootc image build process rather than on the live guest.

Background

When using bootc guests, most preparation commands should be collected and executed during the container image build (via Containerfile), followed by a reboot. Only test commands should run on the live guest.

Related draft PR: #3947

Proposed Implementation

Based on discussions in #3947, the implementation should:

  1. Hide bootc behavior behind the Guest class API - Plugins should not need to be aware they are talking to a bootc guest. The different behavior should be transparent to plugin users.

  2. Add make_changes parameter to Guest.execute() - Commands that modify the system (default make_changes=True) would be collected for the Containerfile, while probe/check commands (make_changes=False) would execute immediately on the live guest.

  3. Determine when to build the collected Containerfile - Options include:

    • Lazy approach: Build when test_session=True is seen (test is about to run)
    • Add explicit on_start/on_finish events to phase/step workflow
  4. Support Guest.push() for Containerfile COPY operations - Needed for cases like prepare/shell with URL + script, where content needs to be available during the build:

    prepare:
        how: shell
        url: https://github.com/teemtee/tmt.git
        ref: main
        script: cd $TMT_PREPARE_SHELL_URL_REPOSITORY && make docs

Open Questions

  • How to handle the finish step (no test after it, so collected commands would remain in the buffer)?
  • Which specific commands need to run live vs. be collected (probe commands, package presence checks, bootc status commands)?

References

Metadata

Metadata

Assignees

Type

No type

Projects

Status

implement

Status

triaged

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions