feat(release): add create-release-branch command#4587
Open
radTuti wants to merge 4 commits intotigera:masterfrom
Open
feat(release): add create-release-branch command#4587radTuti wants to merge 4 commits intotigera:masterfrom
radTuti wants to merge 4 commits intotigera:masterfrom
Conversation
6009212 to
bcd4ff3
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new release branch subcommand (and make create-release-branch target) to automate release-branch creation, while refactoring release prep to reuse the shared branch/config/commit logic.
Changes:
- Add
release branchcommand to create a release branch, update version configs, commit, tag, and optionally push. - Refactor
release prepto share common branch creation + config update logic via shared helpers. - Add new flags (
--stream,--calico-ref,--enterprise-ref) and update release documentation.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
hack/release/branch.go |
New command + shared helpers for branching/config updates/commit/tag/push. |
hack/release/prep.go |
Refactors prep to reuse shared branch/config/commit logic and uses shared cleanup. |
hack/release/main.go |
Registers the new branch command with the CLI. |
hack/release/flags.go |
Adds new flags for stream and component refs/prefix. |
hack/release/checks.go |
Adds shared validation helpers for prep/branch. |
hack/release/README.md |
Documents the new release branch command and Makefile target. |
RELEASING.md |
Updates the release-branch preparation process docs to point at the new automation. |
Makefile |
Adds create-release-branch target. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bcd4ff3 to
2b1aeaa
Compare
2b1aeaa to
562ab74
Compare
danudey
approved these changes
Mar 24, 2026
Enhance validateBranchRefs to check that the operator branch doesn't already exist in the remote and that calico/enterprise refs exist as branches or tags. Similarly enhance validatePrepRefs to verify version tags exist in their respective remote repositories. Move validation logic from prepBefore into validatePrepRefs for consistency.
Support branching from both master and release branches. Add isReleaseBranch validation, skip-branch-check flag, and dev tag creation only when branching from non-release branches. Consolidate development flags under a shared category and fix error message conventions.
f28aa08 to
cd28b20
Compare
- Add unit tests for isReleaseBranch, dev tag version logic, stream format validation, and refExistsInRemote - Replace bare context type assertions with contextString helper to produce clear errors instead of panics - Use regexp.QuoteMeta on release branch prefix to prevent regex injection from custom prefixes - Add stream format validation (vX.Y) in validateBranchRefs - Fix ls-remote substring matching: parse output lines and match exact ref names instead of using strings.Contains
2019bcd to
3858f49
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
branchsubcommand andcreate-release-branchMakefile target to automaterelease branch creation, config updates, and dev tag tagging
release branches (skips dev tag)
and branch-already-exists guard
branchandprepcommands (branchBeforeCommon,branchActionCommon,switchBranch,modifyConfigVersions,commitConfigChanges)contextStringhelper to replace bare context type assertions--skip-branch-checkand--skip-validationdevelopment flagsRELEASING.mdandhack/release/README.mddocumentationValidation
isReleaseBranch,isValidStream,refExistsInRemote, and dev tagversion arithmetic (
hack/release/branch_test.go)make create-release-branch STREAM=vX.Y CALICO_REF=<ref> ENTERPRISE_REF=<ref>make release-prep VERSION=vX.Y.Z CALICO_VERSION=<ver>on a release branch to verify prep still works after refactor