FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Allow to customize temporary working branch created by Updatecli by olblak · Pull Request #5589 · updatecli/updatecli · GitHub

feat: Allow to customize temporary working branch created by Updatecli - #5589

Merged
olblak merged 8 commits into
updatecli:mainfrom
olblak:issue/1399
Jul 13, 2025
Merged

feat: Allow to customize temporary working branch created by Updatecli#5589
olblak merged 8 commits into
updatecli:mainfrom
olblak:issue/1399

Conversation

olblak commented Jul 9, 2025
edited
Loading

Copy link
Copy Markdown
Member

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 parameter workingbranchseparator
The prefix updatecli_ can also be replace by setting the parameter workingbranchprefix:

For example

  scms:
    default:
      kind: github
      spec:
        branch: "{{ .scm.branch }}"
        email: "{{ .scm.email }}"
        owner: "{{ .scm.owner }}"
        repository: "{{ .scm.repository }}"
        token: '{{ requiredEnv "GITHUB_TOKEN" }}'
        user: "{{ .scm.user }}"
        username: '{{ requiredEnv "GITHUB_ACTOR" }}'
        workingbranchprefix: "deps"
        workingbranchseparator: '/' 
      disabled: false

Test

Test manually

Additional Information

Checklist

  • I have updated the documentation via pull request in website repository.

Tradeoff

I see two risks here that are not Updatecli related.

  1. Reusing an existing branch not created by Updatecli and resetting its content
  2. Failing to create a branch. For example, Updatecli won't be able to create the branch deps/main/bumpversion if there is already a branch named deps which It's a git limitation

Potential improvement

olblak added enhancement New feature or request scm-github SCM of type GiHhub scm-git SCM of kind "Git" scm-gittea scm-gitlab scm-stash scm-bitbucket All things related to the bitbucket integration labels Jul 9, 2025
olblak requested a review from Copilot July 10, 2025 05:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

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 and workingBranchSeparator 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 to workingBranchPrefix 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, "/")

olblak merged commit ca9e27f into updatecli:main Jul 13, 2025
5 checks passed
olblak deleted the issue/1399 branch July 13, 2025 06:25
olblak mentioned this pull request Jul 22, 2025
1 task
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

Labels

enhancement New feature or request scm-bitbucket All things related to the bitbucket integration scm-git SCM of kind "Git" scm-github SCM of type GiHhub scm-gitlab scm-gittea scm-stash

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature Request: Allow configuration of commit branch

2 participants


Back | FazBrowse Home | New Git URL