prowgen: add skip_branches support to ProwgenOverrides#5219
prowgen: add skip_branches support to ProwgenOverrides#5219redhat-chai-bot wants to merge 4 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 |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Enterprise Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughAdds a ChangesSkipBranches for presubmit generation
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 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.
|
/ok-to-test |
|
/retest-required |
|
/test e2e |
|
/hold Revision 28c5775 was retested 3 times: holding |
Run `make generate` to update generated files after adding SkipBranches field to TestStepConfiguration: - Regenerate deepcopy functions (zz_generated.deepcopy.go) - Regenerate CI operator reference docs - Fix test fixture filename: sanitizeFilename replaces hyphens with underscores, so rename the fixture to match Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/lgtm |
|
/override ci/prow/e2e |
|
@deepsm007: Overrode contexts on behalf of deepsm007: ci/prow/e2e DetailsIn response to this:
Instructions 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. |
|
/test codegen |
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danilo-gemoli, deepsm007, redhat-chai-bot The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/test images |
|
Scheduling tests matching the |
|
/override ci/prow/e2e |
|
@deepsm007: Overrode contexts on behalf of deepsm007: ci/prow/e2e DetailsIn response to this:
Instructions 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. |
|
@redhat-chai-bot: all tests passed! Full PR test history. Your PR dashboard. 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. I understand the commands that are listed here. |
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
Feature: Per-Test Branch Exclusion for Presubmit Jobs
This pull request introduces
skip_branchessupport to ci-operator's test configuration, enabling repositories to selectively exclude branch patterns from specific presubmit tests.Problem Solved
Previously, ci-operator would unconditionally generate presubmit jobs that run on all branch patterns (exact matches like
^main$and feature branches like^main-). This caused conflicts for repositories using branch naming schemes likemain-pf5ormain-pf4with separate CI pipelines, as the main branch's presubmit jobs would incorrectly trigger on those branches.What's New
CI operators can now specify
skip_branchesin their ci-operator configuration on a per-test basis:This prevents the
e2e-awstest from running on matched branch patterns while still executing on the basemainbranch. The per-test design enables fine-grained control—for example, one test can skipmain-pf5while another test runs on it.Technical Changes
SkipBranchesfield toTestStepConfigurationinpkg/api/types.gopkg/prowgen/prowgen.goto propagate theskip_branchesconfiguration into Prow'sBrancher.SkipBranchesfield on generated presubmit jobsThe feature leverages existing upstream Prow support and maps directly to Prow's standard
Brancher.SkipBranchesmechanism.