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

Implement a label_trigger option for test jobs #2269

Closed
1 of 2 tasks
psss opened this issue Dec 6, 2023 · 20 comments · Fixed by #2333
Closed
1 of 2 tasks

Implement a label_trigger option for test jobs #2269

psss opened this issue Dec 6, 2023 · 20 comments · Fixed by #2333
Assignees
Labels
area/config Related to the Packit's configuration. area/testing-farm Related to Testing Farm integration. complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/high This issue impacts multiple/lot of users. kind/feature New feature or a request for enhancement.

Comments

@psss
Copy link
Contributor

psss commented Dec 6, 2023

Description

Similar to manual_trigger the label_trigger would enable specific test job only if given label is attached to the pull request.

Benefit

Once the pull request has passed basic sanity tests or an agreed level of code review, it would be marked for example with a full test label and all future pull request changes would be tested without need to again and again manually add /packit test --identifier full comments. Also this would resolve the problem with having to wait until the copr builds are ready, see #2265 for details.

Importance

This would substantially improve the several-tier-testing experience. And prevent unnecessary manual steps.

What is the impacted category (job)?

Testing Farm tests

Workaround

  • There is an existing workaround that can be used until this feature is implemented.

Participation

  • I am willing to submit a pull request for this issue. (Packit team is happy to help!)
@psss
Copy link
Contributor Author

psss commented Dec 7, 2023

As @lachmanfrantisek mentioned on the chat, this should behave like a condition (during the job scheduling the label would be just checked for presence) rather than a trigger (like watching the event when the label was added), so maybe the proposed option name is a bit misleading.

@lachmanfrantisek lachmanfrantisek added area/testing-farm Related to Testing Farm integration. complexity/single-task Regular task, should be done within days. impact/high This issue impacts multiple/lot of users. gain/high This brings a lot of value to (not strictly a lot of) users. area/config Related to the Packit's configuration. labels Dec 7, 2023
@lachmanfrantisek lachmanfrantisek moved this from new to backlog in Packit Kanban Board Dec 7, 2023
@psss
Copy link
Contributor Author

psss commented Jan 19, 2024

Is there any ETA on implementing this?

@lbarcziova lbarcziova moved this from backlog to ready-to-refine in Packit Kanban Board Jan 22, 2024
@lbarcziova
Copy link
Member

hi @psss, I have put this to ready-to-refine, so I hope we could get to this in the next 2-3 weeks.

@psss
Copy link
Contributor Author

psss commented Jan 22, 2024

Great, thanks for the update!

@majamassarini
Copy link
Member

If possible also check for labels to not be present. Think about one implementation that can be reused in more jobs.

@majamassarini majamassarini moved this from ready-to-refine to refined in Packit Kanban Board Jan 25, 2024
@mfocko
Copy link
Member

mfocko commented Jan 28, 2024

With regards to the previous comment, I would suggest something like:

label_trigger:
  present:
    - test_regressions
  absent:
    - skip_tests
    - ci_skip

To clarify what we discussed during the refinement, we also considered being able to run jobs only if there are labels missing, the example above probably explains it well.

@psss
Copy link
Contributor Author

psss commented Jan 29, 2024

Negative filter sounds useful. The proposed syntax looks good. Perhaps, one more brainstorming idea: What about this?

trigger:
    label:
        present:
          - test_regressions
        absent:
          - skip_tests
          - ci_skip

@mfocko
Copy link
Member

mfocko commented Jan 29, 2024

Did you have something like

trigger:
    label:
        present:
          - test_regressions
        absent:
          - skip_tests
          - ci_skip
    manual: true

in mind? With manual_trigger as backwards-compatible and to-be-deprecated it sounds pretty reasonable 🤔

@psss
Copy link
Contributor Author

psss commented Jan 29, 2024

Yeah, that was the idea, to group all triggers under a single trigger umbrella.

@lbarcziova lbarcziova self-assigned this Jan 31, 2024
@lbarcziova lbarcziova moved this from refined to in-progress in Packit Kanban Board Jan 31, 2024
@lbarcziova
Copy link
Member

As @lachmanfrantisek mentioned on the chat, this should behave like a condition (during the job scheduling the label would be just checked for presence) rather than a trigger (like watching the event when the label was added), so maybe the proposed option name is a bit misleading.

Getting back to this, I would probably omit the trigger word from these options and go with

labels:
  present:
    - test_regressions
  absent:
    - skip_tests

or maybe

label_conditions:
  present:
    - test_regressions
  absent:
    - skip_tests

WDYT?

@psss
Copy link
Contributor Author

psss commented Jan 31, 2024

rather than a trigger (like watching the event when the label was added)

Maybe it would be good to clarify the expected behavior first: What will happen if a new label is added to the pull request and there are jobs (marked with that label) already waiting in the queue? I'd say it would be nice if the missing jobs are started right away.

@lbarcziova
Copy link
Member

From your comment and also checking the thread on Slack, I think we agreed it would behave only like a condition, so adding/removing a label would not trigger Packit's action.

@psss
Copy link
Contributor Author

psss commented Jan 31, 2024

Ok, so it should behave only as a condition. Do we expect there will/could be other conditions? If so, the following would be a bit more extensible syntax:

condition:
    label:
        present:
          - test_regressions
        absent:
          - skip_tests
          - ci_skip

Single key labels would collide with packit job labels, or not?

@lbarcziova
Copy link
Member

Single key labels would collide with packit job labels, or not?

oh yes, that's true

I don't recall any other conditions discussed so far, but I am still for the idea to have if extensible, so your suggestion sounds good to me.

lbarcziova added a commit to lbarcziova/packit that referenced this issue Feb 2, 2024
lbarcziova added a commit to lbarcziova/packit that referenced this issue Feb 5, 2024
softwarefactory-project-zuul bot added a commit to packit/packit that referenced this issue Feb 5, 2024
Introduce require.label in package config

Needed for packit/packit-service#2269
RELEASE NOTES BEGIN
N/A
RELEASE NOTES END

Reviewed-by: Maja Massarini
lbarcziova added a commit to lbarcziova/packit-service that referenced this issue Feb 6, 2024
For PR events, check whether the labels on PR match the labels
configuration (require.label.present and require.label.absent)
if present when getting matching jobs for events.
Fixes packit#2269
@lbarcziova lbarcziova moved this from in-progress to in-review in Packit Kanban Board Feb 6, 2024
softwarefactory-project-zuul bot added a commit that referenced this issue Feb 7, 2024
Conditions on PR labels

TODO:

 docs

Fixes #2269 #2186

RELEASE NOTES BEGIN
We have introduced new configuration options require.label.present and require.label.absent. By configuring these you can specify labels that need to be present or absent on a pull request for Packit to react on such PR.
RELEASE NOTES END

Reviewed-by: František Lachman <[email protected]>
@github-project-automation github-project-automation bot moved this from in-review to done in Packit Kanban Board Feb 7, 2024
@psss
Copy link
Contributor Author

psss commented Feb 12, 2024

Thanks for implementing this! Trying in:

Seems that the internal jobs have been scheduled. I guess the change has not been deployed yet?

@mfocko
Copy link
Member

mfocko commented Feb 12, 2024

That would fail on parsing the config 👀

@psss
Copy link
Contributor Author

psss commented Feb 12, 2024

I see. Then, it seems, it does not work as expected.

@lbarcziova
Copy link
Member

lbarcziova commented Feb 12, 2024

@psss yes, there is still one piece for build- > test mapping missing, I hope I will get it to prod until tomorrow, I will let you know :) (at the moment, you would need to add the require.label also for the build job to make it work)

@psss
Copy link
Contributor Author

psss commented Feb 12, 2024

Understood. Thanks for the quick response! The build workaround is probably not an option because we still need the build to be completed for the basic sanity jobs which are enabled by default.

By the way, the manual_trigger is not needed when the require key is used, right?

@lbarcziova
Copy link
Member

By the way, the manual_trigger is not needed when the require key is used, right?

Hmm not sure I follow. If there is the require.label and the labels will not match, nothing will happen. On the other hand, if the PR will have the needed labels, but there will be no manual_trigger: True, also the pushes to PR will trigger tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config Related to the Packit's configuration. area/testing-farm Related to Testing Farm integration. complexity/single-task Regular task, should be done within days. gain/high This brings a lot of value to (not strictly a lot of) users. impact/high This issue impacts multiple/lot of users. kind/feature New feature or a request for enhancement.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

5 participants