teemtee / tmt

Test Management Tool
MIT License
82 stars 123 forks source link

TMT/Prepare/Installation/Copr. Support setting custom chroot. #2518

Open jackorp opened 10 months ago

jackorp commented 10 months ago

Working with specific chroots on internal copr instance requires additional argument for the DNF copr plugin. I'd like a way to specify this in TMT with the Copr installation step. I didn't notice anything that would help me in the docs (aside from raw shell).

Let's say: I want to test Fedora system with a copr package that is built and present in my-chroot-x86_64. To enable it manually, I have to run

dnf copr enable -y copr.instance.org/<username>/<project> my-chroot-x86_64

with the last argument being more than one would usually need.

I can already specify custom copr instance via a link, similarly to the example, via tmt, I can use:

$ tmt run ... prepare -h install --copr copr.instance.org/<username>/<project>

As the copr instance has a custom chroot that fits my needs (in terms of RPM package requires et al), I'd like to also set it in TMT like I would do manually via DNF.

Kind of like so:

$ tmt run ... prepare -h install --copr copr.instance.org/<username>/<project> --copr-chroot my-chroot-x86_64

I think in YAML the following would make sense:

prepare:
    install:
        copr: copr.instance.org/<username>/<project>
            chroot: my-chroot-x86_64

I made myself some proof of concept implementation that "works" for my purposes, but I think its less than ideal for anything other than showcase (and I don't know if it works in yaml form): https://github.com/jackorp/tmt/commit/29026784fcee47b46a69dd3a80e9c78563ad8060

One problem is hardcoding architecture, but that is solveable if we know the arch (should be known since the provision step) And we know that expected chroot format for the DNF copr plugin is distribution-version-architecture (verified by supplying my-chroot to the example DNF command up top, it will complain), then user only needs to specify distribution-version and TMT can fill in architecture.

Not sure if relevant but:

$ tmt --version
tmt version: 1.28.2
$ rpm -qa tmt
tmt-1.28.2-1.fc40.noarch

Running on reasonably up-to-date Fedora Rawhide.

thrix commented 10 months ago

@jackorp thanks for filing, basically this is part of the functionality of our new installation plugin, part of this discussion topic:

https://github.com/teemtee/tmt/discussions/2226