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

Allow filtering tags via regex configuration options #2030

Merged

Conversation

lbarcziova
Copy link
Member

@lbarcziova lbarcziova commented Aug 7, 2023

Introduce 2 configuration options, upstream_tag_include and upstream_tag_exclude to allow filtering the tags. This will be used in the service to allow filtering the propose_downstream runs.

Fixes packit/packit-service#2118

TODO:

  • Write new tests or update the old ones to cover new functionality.
  • Update doc-strings where appropriate.
  • Update or write new documentation in packit/packit.dev.

RELEASE NOTES BEGIN
2 new configuration options for filtering when getting latest upstream release tag were introduced: upstream_tag_include and upstream_tag_exclude. They should contain a Python regex that can be used as an argument in re.match.

RELEASE NOTES END

@lbarcziova lbarcziova requested a review from nforro August 7, 2023 06:50
@softwarefactory-project-zuul

This comment was marked as outdated.

packit/upstream.py Outdated Show resolved Hide resolved
packit/upstream.py Outdated Show resolved Hide resolved
packit/upstream.py Outdated Show resolved Hide resolved
@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/cb9f60879e664cc8a8200bf7ef6956c4

✔️ pre-commit SUCCESS in 1m 29s
✔️ packit-tests-rpm SUCCESS in 12m 48s
✔️ packit-tests-pip-deps SUCCESS in 12m 30s
✔️ packit-tests-git-main SUCCESS in 12m 44s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 06s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 26s
✔️ reverse-dep-packit-service-tests SUCCESS in 3m 10s

Copy link
Member

@nforro nforro left a comment

Choose a reason for hiding this comment

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

Since upstream_tag_template is no longer used to filter tags, what happens with projects that rely on it? Should they migrate to upstream_tag_include?

Edit: I mean projects/repos with mixed tag names that use upstream_tag_template for both filtering and extracting version.

@lbarcziova
Copy link
Member Author

lbarcziova commented Aug 7, 2023

@nforro that's a good point, I was thinking of opening a PR for the repo that in the past requested the change of utilising upstream_tag_template for filtering (#1885), but not sure whether someone else relies on this/how to find out 🤔 Do you have any suggestions?

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/91883a8fc8d24b21966c7e0fb05c4338

✔️ pre-commit SUCCESS in 1m 26s
✔️ packit-tests-rpm SUCCESS in 13m 37s
✔️ packit-tests-pip-deps SUCCESS in 13m 48s
✔️ packit-tests-git-main SUCCESS in 13m 51s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 01s
✔️ packit-tests-git-main-sess-rec SUCCESS in 2m 18s
✔️ reverse-dep-packit-service-tests SUCCESS in 3m 49s

@nforro
Copy link
Member

nforro commented Aug 7, 2023

Do you have any suggestions?

Let me try to go through configs using upstream_tag_template and detect mixed tag names usage, I think it shouldn't be too diffcult to do.

@lbarcziova
Copy link
Member Author

@nforro for that the configuration-migrations can be used, I can take care of that :)

@nforro
Copy link
Member

nforro commented Aug 7, 2023

I used configuration-migrations to download the configs and then run a simple script to match the template against all tags:

https://github.com/ansible/pylibssh v{version} 0.4.0
https://github.com/fedora-copr/copr.git python-copr-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git python-copr-common-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-backend-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-dist-git-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-keygen-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-messaging-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-rpmbuild-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-selinux-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-cli-{version} copr-1.1-1
https://github.com/fedora-copr/copr.git copr-frontend-{version} copr-1.1-1
https://github.com/mawww/kakoune v{version} master-0e1afb
https://github.com/sdaps/sdaps v{version} 1.0.0
https://github.com/vcrhonek/hwdata v{version} hwdata-0.146.33.EL-12

That's 5 projects, https://github.com/evgeni/bley is not there because it doesn't actually use upstream_tag_template.

It would probably make sense to check if the "offending" tags are just historical and not a pattern that's still used.

@nforro
Copy link
Member

nforro commented Aug 7, 2023

@lbarcziova Feel free to check yourself, maybe I missed something.

Introduce 2 configuration options, upstream_tag_include and
upstream_tag_exclude to allow filtering the tags. This will be used
in the service to allow filtering the propose_downstream runs.

Fixes packit/packit-service#2118
@softwarefactory-project-zuul

This comment was marked as outdated.

@lbarcziova lbarcziova added the mergeit When set, zuul wil gate and merge the PR. label Aug 8, 2023
@lbarcziova
Copy link
Member Author

lbarcziova commented Aug 8, 2023

@nforro thanks! I will check those and open PRs where needed once this lands in production

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded.
https://softwarefactory-project.io/zuul/t/packit-service/buildset/9ab7086010dd47309968fc684c41a684

✔️ pre-commit SUCCESS in 1m 44s
✔️ packit-tests-rpm SUCCESS in 13m 15s
✔️ packit-tests-pip-deps SUCCESS in 13m 28s
✔️ packit-tests-git-main SUCCESS in 14m 06s
✔️ packit-tests-pip-deps-sess-rec SUCCESS in 2m 53s
✔️ packit-tests-git-main-sess-rec SUCCESS in 3m 06s
✔️ reverse-dep-packit-service-tests SUCCESS in 4m 11s

@softwarefactory-project-zuul
Copy link
Contributor

Build succeeded (gate pipeline).
https://softwarefactory-project.io/zuul/t/packit-service/buildset/d9ff69417f354406abb8bd87eccae2a3

✔️ pre-commit SUCCESS in 1m 28s

@softwarefactory-project-zuul softwarefactory-project-zuul bot merged commit 4c510b5 into packit:main Aug 8, 2023
14 of 16 checks passed
@lbarcziova lbarcziova deleted the upstream-tag-filter branch August 8, 2023 11:20
lbarcziova added a commit to lbarcziova/copr that referenced this pull request Aug 14, 2023
We have changed the behaviour of getting latest tags from the repository in Packit
(packit/packit#2030)
and therefore, for repositories with multiple versioning schemas, it
is needed to add these options.

For more details, see https://packit.dev/docs/configuration#upstream_tag_include
praiskup pushed a commit to fedora-copr/copr that referenced this pull request Aug 15, 2023
We have changed the behaviour of getting latest tags from the repository in Packit
(packit/packit#2030)
and therefore, for repositories with multiple versioning schemas, it
is needed to add these options.

For more details, see https://packit.dev/docs/configuration#upstream_tag_include
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mergeit When set, zuul wil gate and merge the PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it possible to filter out pre-release tags (or, in general, any unwanted tags)
2 participants