prowgen: add skip_branches support to ProwgenOverrides#5219
prowgen: add skip_branches support to ProwgenOverrides#5219redhat-chai-bot wants to merge 2 commits into
Conversation
Adds a skip_branches field to ProwgenOverrides that plumbs through to
the upstream Prow Brancher.SkipBranches field. This allows users to
exclude specific branches from matching presubmit jobs.
Currently, prowgen and determinize unconditionally inject both ExactlyBranch
and FeatureBranch regex patterns for every presubmit. This means branches
named $base-$suffix (e.g. main-pf5) inherit all presubmit jobs from
their base branch (e.g. main). There was no way to opt out.
With this change, users can add skip_branches to their ci-operator config
under the prowgen stanza:
prowgen:
skip_branches:
- ^main-pf5$
- ^main-pf4$
The patterns are passed through to the generated Prow job's
Brancher.SkipBranches field, which upstream Prow already handles
natively (SkipBranches takes precedence over Branches in ShouldRun).
Changes:
- pkg/api/types.go: Add SkipBranches field to ProwgenOverrides
- pkg/prowgen/prowgen.go: Thread skip_branches through all presubmit
generation paths (generatePresubmitForTest, handlePresubmit, images,
operator bundles)
- pkg/prowgen/prowgen_test.go: Add unit tests and integration test
- pkg/prowgen/testdata/: Add corresponding test fixtures
|
Pipeline controller notification For optional jobs, comment This repository is configured in: automatic mode |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: redhat-chai-bot The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
📝 WalkthroughWalkthroughThis PR adds a ChangesSkipBranches support for Prow presubmit branch exclusion
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 16 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (16 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @redhat-chai-bot. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Tip We noticed you've done this a few times! Consider joining the org to skip this step and gain Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
…pConfiguration Addresses review feedback: skip_branches should be configurable per test, not configuration-wide. A user might want to skip branch 'main-pf5' for the 'e2e-aws-ovn' test but not for 'e2e-gcp'. Moves SkipBranches from ProwgenOverrides (global) to TestStepConfiguration (per-test), and updates handlePresubmit to read from the element directly. Image and bundle presubmits no longer inherit a global skip_branches.
What
Adds a
skip_branchesfield toTestStepConfigurationin the ci-operator config, allowing individual tests to exclude specific branch patterns from their generated presubmit jobs.Why
Currently,
prowgenanddeterminizeunconditionally inject both exact-match (^main$) and feature-branch (^main-) regex patterns for every presubmit job. There is no way to opt out of the feature-branch pattern.This causes problems for repos that use branch names like
main-pf5ormain-pf4with separate CI pipeline configurations — themainbranch's presubmit jobs run on those branches too, interfering with their dedicated pipelines.Upstream Prow already supports
skip_brancheson theBrancherstruct (prow/pkg/config/jobs.go), butci-toolsdid not plumb it through job generation until now.How
SkipBranches []stringtoTestStepConfigurationinpkg/api/types.go(per-test, not global)handlePresubmitinpkg/prowgen/prowgen.goto readelement.SkipBranchesand populateBrancher.SkipBranchesThe field is per-test so users can selectively skip branches for specific tests — e.g. skip
main-pf5fore2e-aws-ovnbut not fore2e-gcp.Usage
In the ci-operator config for a specific test:
This will add those patterns to
skip_brancheson the generated presubmit job fore2e-aws, preventing it from triggering on branches matching those patterns while still running onmain.References