teemtee / tmt

Test Management Tool
MIT License
83 stars 125 forks source link

Local provisioning on Ubuntu fails in prepare step #2673

Closed engelmi closed 7 months ago

engelmi commented 9 months ago

Describe the bug

In BlueChi we use tmt to run our integration tests in the GitHub CI on Ubuntu (since this is the only linux OS supported there). Since the new release 1.31.0 those tests keep failing due to Package manager "None" is not supported. in the prepare step:

    prepare
        queued push task #1: push to default-0

        push task #1: push to default-0

        queued prepare task #1: Prepare containers setup on default-0
        queued prepare task #2: requires on default-0

        prepare task #1: Prepare containers setup on default-0
        how: shell
        name: Prepare containers setup
        overview: 1 script found

        prepare task #2: requires on default-0
        how: install
        summary: Install required packages
        name: requires
        where: default-0
        fail: Package manager "None" is not supported.

We are using the following plan: https://github.com/eclipse-bluechi/bluechi/blob/main/tests/plans/tier0.fmf

Note:

After briefly investigating, I found that /usr/bin/flock is automatically added as a required dependency (added in https://github.com/teemtee/tmt/pull/2622). And when tmt tries to install it on the local host (due to the provision: how: local) it first determines the package manager - which throws the "None" package manager not supported error.

To Reproduce

On any OS with a package manager not supported (see list in code), e.g. Ubuntu, then execute a tmt run on a plan with

provision:
    how: local

It will automatically add /usr/bin/flock as a required dependency, try to install it on the local host and when determining the package manager throw the error for None package manager not supported.

Expected behavior

Ideally, we could use tmt 1.31 on hosts with an OS that doesn't use any of the package managers in the list of supported ones, e.g. Ubuntu.

Is it possible to skip or not add this automatically generated preparation step in those cases?

Note: We currently mitigate this by pinning the version to 1.30.

happz commented 9 months ago

Hello, I'm afraid this is an unexpected side effect of us recently identifying /usr/bin/flock as an essential requirement for running tests :/ As we discovered, /usr/bin/flock is not available by default in every distro we use, which means tmt needs to check for it & install it if necessary. In this sense, a package manager became part of the process so early.

For 1.32, I'd like to finish a refactoring of package manager implementations, https://github.com/teemtee/tmt/pull/2557, and it covers Ubuntu and other distros with apt. We can improve the error message for unsupported ones, and improve the behavior when an unsupported package manager is encountered. tmt can always display a warning, for example, "failed to install essential requirements, you're on your own", instead of crashing.

psss commented 7 months ago

I believe this has been covered by the new package manager implementation:

Verified with the following plan

provision:
    how: container
    image: ubuntu
prepare:
    how: shell
    script: apt update
execute:
    how: tmt
    script: bash --version

For ubuntu the current limitation is that apt update has to be explicitly called by the user.