tmt icon indicating copy to clipboard operation
tmt copied to clipboard

plans: enable epel on CentOS Stream in provision/virtual.py

Open The-Mule opened this issue 9 months ago • 4 comments

Prepare step of /plans/provision/virtual installs beakerlib on virtual machine images. This does not work for CentOS Stream because you need to enable EPEL to be able to install beakerlib. This PR does that. Furthermore, it limits beakerlib installation only for Fedora and CentOS Stream (notice that there are no RHEL VM images in the test suite and hence there is no need to handle them).

Also, this unblocks testing of #3344 where we need CentOS Stream virtual 9 and 10 virtual machine images.

Pull Request Checklist

  • [ ] implement the feature
  • [ ] write the documentation
  • [ ] extend the test coverage
  • [ ] update the specification
  • [ ] adjust plugin docstring
  • [ ] modify the json schema
  • [ ] mention the version
  • [ ] include a release note

The-Mule avatar Mar 13 '25 17:03 The-Mule

IMHO if a virtual test requires beakerlib there is now much better way to get it - EPEL prepare feature in the actual test plan

Purpose of that snippet is to avoid getting dnf metadata and installing beakerlib for each VM.

How about making sure this happens only for rhel/fedora/centos, excluding image-mode images?

lukaszachy avatar Mar 14 '25 15:03 lukaszachy

How about making sure this happens only for rhel/fedora/centos, excluding image-mode images?

I guess we can do that. Let me try. We don't have RHEL images in the test suite right now IMO so it is essentially just about Fedora and CentOS Stream.

The-Mule avatar Mar 14 '25 15:03 The-Mule

Addressed @lukaszachy remark, update commit, PR summary and description.

See below (added echo $image for more verbose output, not included in this PR):

# tmt  --feeling-safe -c how=provision run -vvv -a plan -n /plans/provision/virtual/prepare
...
        prepare task #6: prepare-image on default-0
        how: shell
        summary: Fetch the image, refresh dnf cache, install beakerlib
        name: prepare-image
        order: 50
        overview: 1 script found
        script:
            tmt run --remove plan --default provision --how virtual finish
            for image in /var/tmp/tmt/testcloud/images/*qcow2; do
                echo $image
                if [[ $image =~ (Fedora|CentOS-Stream) ]]; then
                    if [[ $image =~ CentOS-Stream ]]; then
                      virt-customize --add $image --run-command 'dnf install -y epel-release --enablerepo="crb"'
                    fi
                    virt-customize --add $image --run-command 'dnf --refresh install -y beakerlib'
                fi
            done
            cmd: /var/tmp/tmt/run-034/plans/provision/virtual/prepare/tree/tmt-prepare-wrapper.sh-prepare-image-default-0
            err: /var/tmp/tmt/run-035
            err:
            err: /default/plan
            err:     provision
            err:         queued provision.provision task #1: default-0
            err:
            err:         provision.provision task #1: default-0
            err:         how: virtual
            err:         memory: 2048 MB
            err:         disk: 40 GB
            err:         progress: booting...
            err:         multihost name: default-0
            err:         arch: x86_64
            err:         distro: Fedora Linux 41 (Cloud Edition)
            err:
            err:         summary: 1 guest provisioned
            err:     finish
            err:
            err:         summary: 0 tasks completed
            err:         guest: stopped
            err:         guest: removed
            out: /var/tmp/tmt/testcloud/images/CentOS-Stream-GenericCloud-10-20250317.0.x86_64.qcow2
            out: [   0.0] Examining the guest ...
            out: [  12.6] Setting a random seed
            out: [  12.6] Running: dnf install -y epel-release --enablerepo="crb"
            out: [  14.8] SELinux relabelling
            out: [  33.9] Finishing off
            out: [   0.0] Examining the guest ...
            out: [  13.0] Setting a random seed
            out: [  13.0] Running: dnf --refresh install -y beakerlib
            out: [  15.7] SELinux relabelling
            out: [  34.4] Finishing off
            out: /var/tmp/tmt/testcloud/images/CentOS-Stream-GenericCloud-9-20250317.0.x86_64.qcow2
            out: [   0.0] Examining the guest ...
            out: [  12.3] Setting a random seed
            out: [  12.3] Running: dnf install -y epel-release --enablerepo="crb"
            out: [  15.5] SELinux relabelling
            out: [  34.6] Finishing off
            out: [   0.0] Examining the guest ...
            out: [  12.7] Setting a random seed
            out: [  12.7] Running: dnf --refresh install -y beakerlib
            out: [  15.8] SELinux relabelling
            out: [  33.5] Finishing off
            out: /var/tmp/tmt/testcloud/images/Fedora-Cloud-Base-Generic-41-1.4.x86_64.qcow2
            out: [   0.0] Examining the guest ...
            out: [  13.5] Setting a random seed
            out: [  13.5] Running: dnf --refresh install -y beakerlib
            out: [  15.9] SELinux relabelling
            out: [  34.5] Finishing off
            out: /var/tmp/tmt/testcloud/images/Fedora-Cloud-Base-Generic-Rawhide-20250320.n.0.x86_64.qcow2
            out: [   0.0] Examining the guest ...
            out: [  11.9] Setting a random seed
            out: [  11.9] Running: dnf --refresh install -y beakerlib
            out: [  29.0] SELinux relabelling
            out: [  45.1] Finishing off
            out: /var/tmp/tmt/testcloud/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2
            out: [   0.0] Examining the guest ...
            out: [  12.4] Setting a random seed
            out: [  12.4] Running: dnf --refresh install -y beakerlib
            out: [  15.8] SELinux relabelling
            out: [  33.2] Finishing off
            out: /var/tmp/tmt/testcloud/images/fedora-coreos-41.20250302.3.2-qemu.x86_64.qcow2

The-Mule avatar Mar 20 '25 13:03 The-Mule

Is this still relevant?

LecrisUT avatar Nov 11 '25 16:11 LecrisUT