-
-
Notifications
You must be signed in to change notification settings - Fork 98
feat: Allow to customize temporary working branch created by Updatecli #5589
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
Conversation
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 adds support for customizing the prefix and separator used when Updatecli creates temporary working branches. Key changes include:
- Introduce
workingBranchPrefix
andworkingBranchSeparator
parameters in SCM plugin specs and propagate them through each provider implementation. - Update the branch sanitization logic to trim leading separators and adjust replacement behavior.
- Add an example to the Venom integration test configuration showing how to set the new parameters.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
updatecli/updatecli.d/venom.yaml | Example test updated with workingbranchprefix and workingbranchseparator |
pkg/plugins/utils/gitgeneric/main.go | Trim leading separators and adjust replacement array |
pkg/plugins/scms/stash/scm.go | Use strings.Join with custom prefix/separator in GetBranches |
pkg/plugins/scms/stash/main.go | Add WorkingBranchPrefix /Separator fields and initialization |
pkg/plugins/scms/gitlab/scm.go | Use strings.Join with custom prefix/separator in GetBranches |
pkg/plugins/scms/gitlab/main.go | Add WorkingBranchPrefix /Separator fields and initialization |
pkg/plugins/scms/github/scm.go | Use strings.Join with custom prefix/separator in GetBranches |
pkg/plugins/scms/github/main.go | Add WorkingBranchPrefix /Separator fields and initialization |
pkg/plugins/scms/gitea/scm.go | Use strings.Join with custom prefix/separator in GetBranches |
pkg/plugins/scms/gitea/main.go | Add WorkingBranchPrefix /Separator fields and initialization |
pkg/plugins/scms/git/scm.go | Use strings.Join with custom prefix/separator in GetBranches |
pkg/plugins/scms/git/main.go | Add WorkingBranchPrefix /Separator fields and initialization |
pkg/plugins/scms/bitbucket/scm.go | Use strings.Join with custom prefix/separator in GetBranches |
pkg/plugins/scms/bitbucket/main.go | Add WorkingBranchPrefix /Separator fields and initialization |
Comments suppressed due to low confidence (3)
updatecli/updatecli.d/venom.yaml:38
- [nitpick] The change to the version filter pattern (
<1
) in the Venom test appears unrelated to branch customization. Consider removing or documenting it separately to keep the test focused.
pattern: "<1"
pkg/plugins/scms/bitbucket/main.go:193
- Typo in variable name
workingBranchhPrefix
(extra 'h'). Rename toworkingBranchPrefix
for clarity and consistency.
workingBranchhPrefix := "updatecli"
pkg/plugins/utils/gitgeneric/main.go:698
- There are no unit tests covering custom separator trimming. Add tests for
SanitizeBranchName
, especially cases with leading slashes and varied separators.
branch = strings.TrimPrefix(branch, "/")
Fix #1399
Today temporary working branch looks like
updatecli_<the targeted branch>_<pipelineid>
This pullrequest allows to override the default separator from
_
to whatever defined by the parameterworkingbranchseparator
The prefix
updatecli_
can also be replace by setting the parameterworkingbranchprefix:
For example
Test
Test manually
Additional Information
Checklist
Tradeoff
I see two risks here that are not Updatecli related.
deps/main/bumpversion
if there is already a branch named deps which It's a git limitationPotential improvement