Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Discover step fails if beakerlib library not found in the repo #397

Closed
sopos opened this issue Oct 7, 2020 · 7 comments
Closed

Discover step fails if beakerlib library not found in the repo #397

sopos opened this issue Oct 7, 2020 · 7 comments
Assignees
Labels
area | libraries Issues related to beakerlib libraries support step | discover Stuff related to the discover step
Milestone

Comments

@sopos
Copy link

sopos commented Oct 7, 2020

If there's an existing repo on github.com/beakerlib/<COMPONENT> but the library is not there the discover step fails as git command cannot find the library there. This way it even does not try to satisfy the requirements from possibly enabled dnf repo.
I.e. if I want to move one of the distribution libraries to github I will break the others.
The correct behaviour should be to continue and try to satisfy the library requirement in different execution phases.

@psss psss self-assigned this Oct 8, 2020
@psss
Copy link
Collaborator

psss commented Oct 8, 2020

This should be already fixed by #382. What version of tmt are you testing with?

@sopos
Copy link
Author

sopos commented Oct 8, 2020

$ rpm -q tmt
tmt-1.0-1.20201007135237127416.master.37.gb5844a7.fc31.noarch

$ tmt run -vvvddd -a provision -h connect -g 10.0.138.145 prepare -h shell -s 'dnf config-manager --enable beaker-tasks' execute -h beakerlib.tmt tests --name .
...
    discover
        workdir: /var/tmp/tmt/run-011/plans/default/discover
        how: fmf
        order: 50
            Run command 'git rev-parse --show-toplevel'.
            out: /home/dapospis/test/git/SP_components/tests
        directory: /home/dapospis/test/git/SP_components/tests
            Copy '/home/dapospis/test/git/SP_components/tests' to '/var/tmp/tmt/run-011/plans/default/discover/default/tests'.
            Check metadata tree in '/var/tmp/tmt/run-011/plans/default/discover/default/tests/'.
            Detected library 'library(distribution/dpcommon)'.
            Fetch library 'distribution/dpcommon'.
            Run command 'git clone https:/beakerlib/distribution /var/tmp/tmt/run-011/plans/default/discover/default/libs/distribution'.
            err: Cloning into '/var/tmp/tmt/run-011/plans/default/discover/default/libs/distribution'...
            err: remote: Invalid username or password.
            err: fatal: Authentication failed for 'https:/beakerlib/distribution/'
            Command returned '128'.
            Repository 'https:/beakerlib/distribution' not found.
            Detected library 'library(epel/epel)'.
            Fetch library 'epel/epel'.
            Run command 'git clone https:/beakerlib/epel /var/tmp/tmt/run-011/plans/default/discover/default/libs/epel'.
            err: Cloning into '/var/tmp/tmt/run-011/plans/default/discover/default/libs/epel'...
            Run command 'git checkout master'.
            err: error: pathspec 'master' did not match any file(s) known to git
            Command returned '1'.

@psss
Copy link
Collaborator

psss commented Oct 8, 2020

The problem above is that the epel repository does not have a master branch. It only has the main one, which seems to be the new github default for main branches. So far (according to the spec) we expect only master. Let's fix the repo. We could also check for main in the future but that needs some discussion.

@sopos
Copy link
Author

sopos commented Oct 8, 2020

I did not even notice that. Shouldn't tmt look at the default branch instead of hard-coded master?

@sopos
Copy link
Author

sopos commented Oct 8, 2020

ok, adding master branch moved me a bit forward

...
go
    discover
        workdir: /var/tmp/tmt/run-012/plans/default/discover
        how: fmf
        order: 50
            Run command 'git rev-parse --show-toplevel'.
            out: /home/dapospis/test/git/SP_components/tests
        directory: /home/dapospis/test/git/SP_components/tests
            Copy '/home/dapospis/test/git/SP_components/tests' to '/var/tmp/tmt/run-012/plans/default/discover/default/tests'.
            Check metadata tree in '/var/tmp/tmt/run-012/plans/default/discover/default/tests/'.
            Detected library 'library(distribution/dpcommon)'.
            Fetch library 'distribution/dpcommon'.
            Run command 'git clone https:/beakerlib/distribution /var/tmp/tmt/run-012/plans/default/discover/default/libs/distribution'.
            err: Cloning into '/var/tmp/tmt/run-012/plans/default/discover/default/libs/distribution'...
            err: remote: Invalid username or password.
            err: fatal: Authentication failed for 'https:/beakerlib/distribution/'
            Command returned '128'.
            Repository 'https:/beakerlib/distribution' not found.
            Detected library 'library(epel/epel)'.
            Fetch library 'epel/epel'.
            Run command 'git clone https:/beakerlib/epel /var/tmp/tmt/run-012/plans/default/discover/default/libs/epel'.
            err: Cloning into '/var/tmp/tmt/run-012/plans/default/discover/default/libs/epel'...
            Run command 'git checkout master'.
            err: Already on 'master'
            out: Your branch is up to date with 'origin/master'.
    finish
        workdir: /var/tmp/tmt/run-012/plans/default/finish
        summary: 0 tasks completed
        status: done
        Write file '/var/tmp/tmt/run-012/plans/default/finish/step.yaml'.
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/tmt/beakerlib.py", line 105, in fetch
    library = self.parent._library_cache[self.repo]
KeyError: 'epel'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/tmt", line 8, in <module>
    tmt.cli.main()
  File "/usr/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.7/site-packages/click/core.py", line 1290, in invoke
    return _process_result(rv)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 1224, in _process_result
    value = ctx.invoke(self.result_callback, value, **ctx.params)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/click/decorators.py", line 21, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/lib/python3.7/site-packages/tmt/cli.py", line 254, in finito
    context.obj.run.go()
  File "/usr/lib/python3.7/site-packages/tmt/base.py", line 944, in go
    plan.go()
  File "/usr/lib/python3.7/site-packages/tmt/base.py", line 536, in go
    step.go()
  File "/usr/lib/python3.7/site-packages/tmt/steps/discover/__init__.py", line 124, in go
    plugin.go()
  File "/usr/lib/python3.7/site-packages/tmt/steps/discover/fmf.py", line 165, in go
    test.require, test.recommend, parent=self)
  File "/usr/lib/python3.7/site-packages/tmt/beakerlib.py", line 180, in dependencies
    library = Library(dependency, parent=parent)
  File "/usr/lib/python3.7/site-packages/tmt/beakerlib.py", line 91, in __init__
    self.fetch()
  File "/usr/lib/python3.7/site-packages/tmt/beakerlib.py", line 140, in fetch
    self.tree = fmf.Tree(directory)
  File "/usr/lib/python3.7/site-packages/fmf/base.py", line 75, in __init__
    self._initialize(path=data)
  File "/usr/lib/python3.7/site-packages/fmf/base.py", line 101, in _initialize 
    os.path.abspath(path)))
fmf.utils.RootError: Unable to find tree root for '/var/tmp/tmt/run-012/plans/default/discover/default/libs/epel'.

@sopos
Copy link
Author

sopos commented Oct 8, 2020

just for the record, previously I was using tmt-0.21-1.fc31.noarch

@psss
Copy link
Collaborator

psss commented Oct 8, 2020

Ok, we should nicely handle when there are no fmf metadata in the library repository. Should be fixed by #399.

@psss psss added step | discover Stuff related to the discover step area | libraries Issues related to beakerlib libraries support labels Oct 8, 2020
@psss psss changed the title discover step fail if beakerlib library not found in the repo Discover step fails if beakerlib library not found in the repo Oct 8, 2020
@psss psss closed this as completed in 1919021 Oct 15, 2020
@psss psss added this to the 1.1 milestone Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area | libraries Issues related to beakerlib libraries support step | discover Stuff related to the discover step
Projects
None yet
Development

No branches or pull requests

2 participants