-
Notifications
You must be signed in to change notification settings - Fork 114
feat: Enable cluster wide cancel-in-progress setting via PAC ConfigMap #2050
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
feat: Enable cluster wide cancel-in-progress setting via PAC ConfigMap #2050
Conversation
linteres is failing on 😕
|
can you send a pr ? |
yes |
91ee790
to
4cb54cb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces functionality to enable cancel‐in‐progress for both pull request and push events via the PAC ConfigMap. Key changes include:
- Adding new functions in test/pkg/github/setup.go to patch the PAC ConfigMap.
- Implementing cancel‐in‐progress logic in pkg/pipelineascode and updating the corresponding tests.
- Updating configuration, settings, and documentation to support the new cancel‐in‐progress flags.
Reviewed Changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
test/pkg/github/setup.go | Added helper functions to patch PAC ConfigMap and reset settings. |
test/github_pullrequest_test.go | New tests for verifying cancel‐in‐progress behavior for PR and push. |
pkg/pipelineascode/pipelineascode.go | Renamed and updated cancellation function invocation. |
pkg/pipelineascode/cancel_pipelineruns.go | Updated label selector construction and cancellation condition logic. |
pkg/params/settings/convert_test.go | Added new config fields for cancel‐in‐progress. |
pkg/params/settings/config_test.go | Added tests for new cancel‐in‐progress settings. |
pkg/params/settings/config.go | Integrated new boolean fields into Settings. |
docs/content/docs/install/settings.md | Added documentation for cancel‐in‐progress settings. |
docs/content/docs/install/operator_installation.md | Updated installation docs with new cancel‐in‐progress options. |
config/302-pac-configmap.yaml | Added new config keys for global cancel‐in‐progress behavior. |
Comments suppressed due to low confidence (2)
test/pkg/github/setup.go:124
- Instead of calling log.Fatalf on marshalling errors in PatchPACConfigMap, consider returning the error so that it can be handled gracefully by the caller.
if err != nil { log.Fatalf("Failed to marshal patch data: %v", err) }
test/pkg/github/setup.go:155
- In SetCancelInProgressToDefaults, returning the error instead of calling log.Fatalf would improve error propagation and allow the caller to handle the failure appropriately.
if err != nil { log.Fatalf("Failed to marshal patch data: %v", err) }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks good to me, just a comment about some duplication..
I'd like to enable this by default on our dogfooding cluster, please ping me to let you know how to do that
currently, cancel-in-progress can be configured only on PipelineRun level via cancel-in-progress annotation. This PR introduces new setting in Pipelines as Code ConfigMap with enable-cancel-in-progress-on-pull-requests and enable-cancel-in-progress-on-push to control cancel-in-progress functionality on deployment level. when enable-cancel-in-progress-on-pull-requests is set to true all the PipelineRun will be cancelled on PR close and on PR update when a commit is pushed on the head branch of PR and same for push setting. a PipelineRun will override configmap setting if it has cancel-in-progress annotation explicitly and PAC will do accordingly. https://issues.redhat.com/browse/SRVKP-6910 Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
before this, when source or head branch in cancel-in-progress matching code having full path weren't being matched. e.g. refs/heads/branch Signed-off-by: Zaki Shaikh <zashaikh@redhat.com>
4cb54cb
to
b1a4c89
Compare
Cancel-in-progress now can be enabled via PAC configMap using
enable-cancel-in-progress-on-pull-requests
andenable-cancel-in-progress-on-push
fields for pull request and push events respectively. if a PipelineRun is havingcancel-in-progress
annotation specified explicitly then it will override setting from PAC configMap.Changes
Submitter Checklist
📝 Ensure your commit message is clear and informative. Refer to the How to write a git commit message guide. Include the commit message in the PR body rather than linking to an external site (e.g., Jira ticket).
♽ Run make test lint before submitting a PR to avoid unnecessary CI processing. Consider installing pre-commit and running pre-commit install in the repository root for an efficient workflow.
✨ We use linters to maintain clean and consistent code. Run make lint before submitting a PR. Some linters offer a --fix mode, executable with make fix-linters (ensure markdownlint and golangci-lint are installed).
📖 Document any user-facing features or changes in behavior.
🧪 While 100% coverage isn't required, we encourage unit tests for code changes where possible.
🎁 If feasible, add an end-to-end test. See README for details.
🔎 Address any CI test flakiness before merging, or provide a valid reason to bypass it (e.g., token rate limitations).
If adding a provider feature, fill in the following details:
(update the provider documentation accordingly)