tests-trigger: add support for wildcard matches - #8129
allisonkarlitskaya wants to merge 2 commits into
Conversation
None of our repositories use this name anymore and I don't expect we'll ever see any others that do. Keep the infrastructure for per-project main branches in place in case some day we add another repo that uses a name other than 'main'.
This can be helpful if you want to trigger something like '*/networking@*', for example.
|
So I did this from the standpoint of running it from the bots repository itself, similar to |
| if branch.startswith('_'): | ||
| continue | ||
| for context in contexts: | ||
| c = context + '@' + repo |
There was a problem hiding this comment.
like you say this probably isn't right. I think this should work on the target repository so when I do
./tests-trigger --repo cockpit-project/cockpit 22330 '*/networking'
I'd like to trigger all images that run cockpit tests and their /networking scenario
|
I'd say it's fine to only support wildcard match for image variants and maybe contexts for specific image? So basically |
I kinda feel like doing it at the string level is actually easier... it might be "too powerful" in some sense, but it's also just kinda the easiest way to do it... But probably we do need to do something about the launch context: if we're in a repo other than bots we probably want to only refer to the contexts present in that repo. I'll redo this a bit... |
This supports triggering by wildcard patterns in either the bots repository or individual project repositories. Special care has to be given to our treatment of branches here: lib/testmap.py has a longstanding `# FIXME` noting that when checking the validity of a context we accept *any* branch as long as it's the correct project. That's because project-style contexts (like 'debian-trixie' or 'arch/other') don't specify a branch. That's not a problem when you're manually triggering, because we assume that the user knows which test they want, but for wildcards we need to limit ourselves to the correct branch. Add a `--branch` argument which does that, only for this specific case. This can also be used with the `--repo` argument when specifying a specific repo. For triggers from the bots repository we have the branch as part of the context (like `rhel-8-10/other@cockpit-project/cockpit/rhel-8`) and can filter on that via the wildcard either by specifying the branch or (in the case of main) excluding it. --branch is not considered at all in this case. This is consistent because when invoking tests in the bots repo, `--repo` is already `cockpit-project/bots` and we don't have an additional `--target-repo` option (nor do we want to add one), so having `--branch` mean `--target-branch` in this case would just be confusing and inconsistent: it doesn't make sense to filter by branch when you can't even filter by repo, and in any case, wildcards let you do both. Closes #8129
This supports triggering by wildcard patterns in either the bots repository or individual project repositories. Special care has to be given to our treatment of branches here: lib/testmap.py has a longstanding `# FIXME` noting that when checking the validity of a context we accept *any* branch as long as it's the correct project. That's because project-style contexts (like 'debian-trixie' or 'arch/other') don't specify a branch. That's not a problem when you're manually triggering, because we assume that the user knows which test they want, but for wildcards we need to limit ourselves to the correct branch. Add a `--branch` argument which does that, only for this specific case. This can also be used with the `--repo` argument when specifying a specific repo. For triggers from the bots repository we have the branch as part of the context (like `rhel-8-10/other@cockpit-project/cockpit/rhel-8`) and can filter on that via the wildcard either by specifying the branch or (in the case of main) excluding it. --branch is not considered at all in this case. This is consistent because when invoking tests in the bots repo, `--repo` is already `cockpit-project/bots` and we don't have an additional `--target-repo` option (nor do we want to add one), so having `--branch` mean `--target-branch` in this case would just be confusing and inconsistent: it doesn't make sense to filter by branch when you can't even filter by repo, and in any case, wildcards let you do both. Closes #8129
This can be helpful if you want to trigger something like '/networking@', for example.