Skip to content

tests-trigger: add support for wildcard matches - #8129

Closed
allisonkarlitskaya wants to merge 2 commits into
mainfrom
trigger-wildcard
Closed

allisonkarlitskaya wants to merge 2 commits into
mainfrom
trigger-wildcard

Conversation

@allisonkarlitskaya

Copy link
Copy Markdown
Member

This can be helpful if you want to trigger something like '/networking@', for example.

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.
@allisonkarlitskaya

Copy link
Copy Markdown
Member Author

So I did this from the standpoint of running it from the bots repository itself, similar to image:. Maybe that's not right. I think maybe we also want to consider that it's run from the individual target repositories and then limit it to the scenarios defined on that repo?

Comment thread lib/testmap.py
if branch.startswith('_'):
continue
for context in contexts:
c = context + '@' + repo

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@tomasmatus

Copy link
Copy Markdown
Member

I'd say it's fine to only support wildcard match for image variants and maybe contexts for specific image? So basically */networking or fedora-42/* and the latter kinda only makes sense for cockpit. What do you think?

@allisonkarlitskaya

Copy link
Copy Markdown
Member Author

I'd say it's fine to only support wildcard match for image variants and maybe contexts for specific image? So basically */networking or fedora-42/* and the latter kinda only makes sense for cockpit. What do you think?

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...

@martinpitt
martinpitt marked this pull request as draft September 6, 2025 12:42
allisonkarlitskaya added a commit that referenced this pull request Sep 4, 2026
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
allisonkarlitskaya added a commit that referenced this pull request Sep 4, 2026
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants