teemtee / tmt

Test Management Tool
MIT License
80 stars 120 forks source link

Best practice around repository enablement #2825

Open ekohl opened 4 months ago

ekohl commented 4 months ago

In the Foreman project we host our repositories on https://yum.theforeman.org/ (and staging on https://stagingyum.theforeman.org/). We do have COPR builds, but they're not representative for real repositories. On EL8 they lack modularity and we also filter packages via comps, so COPR is a superset of all packages.

Now I'm looking at integrating tmt for testing in our project and wondering what the best practice is to do this. Where do you set up repositories that are used within every test. The provision step doesn't appear to deal with repositories. There is a prepare step to install packages, but looks inflexible if you want to make it generic enough so the same test can run on EL 8 & EL9 (and whatever else in the future).

We build our packages in COPR (https://copr.fedorainfracloud.org/coprs/g/theforeman/foreman-nightly-staging) but it's not our real repository we want users to consume. For one, on EL8 it lacks modularity metadata that our real repositories do have. We also filter packages to avoid publishing some which COPR can't do.

Still, for a test I tried this:

summary: Run with --help
prepare:
  - how: install
    copr: "@theforeman/foreman-nightly-staging"
    package: foreman-maintain
execute:
  - script: foreman-maintain --help

Then run it with:

tmt run -a provision -h container -i centos:stream9

When then fails with:

Error: It wasn't possible to enable this project.
Repository 'epel-9-x86_64' does not exist in project '@theforeman/foreman-nightly-staging'.
Available repositories: 'rhel-9-x86_64', 'rhel-8-x86_64'

This is because we have RHEL buildroots, but it should be possible to use this with CentOS Stream. I could get it to work with this hack:

summary: Run with --help
prepare:
  - how: install
    copr: "@theforeman/foreman-nightly-staging rhel-9-x86_64"
    package: foreman-maintain
execute:
  - script: foreman-maintain --help

But in the end we still want to use https://stagingyum.theforeman.org/ so would it be a best practice to use Ansible here?

I noticed it's possible to pull a playbook from an HTTP URL. Is there caching of this playbook between various plans?

ekohl commented 3 months ago

Perhaps this should be moved from an issue to a discussion. I only noticed discussions are enabled after I submitted this.