I am trying to configure GitVersion to work with the Release Flow branching strategy.
Basically, I have a mainline Master branch, Release, Feature and Fix branches. The Feature and Fix branches are created from the Master branch and merged back into Master via a pull request. At the end of a sprint, I create a Release branch from Master, which will last till the end of the next sprint, when a new Release branch will be created. The Release branches are not merged back into master. They can even be deleted after a new Release branch has been created. If there's a hotfix needed, it will be developed on a Fix branch created from and merged back into master and then cherry-picked into the current Release branch. I only use git tags for major releases.
Going back to GitVersion, I want to configure it so that the minor version number will increase when I create a new release branch and the patch number to increase when there's a new commit on the release branch (cherry-picked from a Fix branch).
Is this possible? How?
I also asked the question on stack overflow.
Same question I asked yesterday. Ignore Tags on Release Branches #1576
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.
I'd be interested in this too. Trying to find a solution to handle versioning on Azure DevOps when we use a strategy similar to ReleaseFlow.
Exactly as marius said: I want to configure it so that the minor version number will increase when I create a new release branch (i.e. master is always last release major.minor + 1, with increasing patch number for each commit to master or release.
@marius-stanescu @alarobric I can provide a working solution for everything up until incrementing the patch automatically when you do a fix on the release branch - I solve that by tagging. I can't get the patch increment to work in any capacity if the cherry picked branch is created from master :(
The GitVersion.yml file for my working setup
mode: ContinuousDeployment
continuous-delivery-fallback-tag: ''
branches:
master:
mode: ContinuousDeployment
tag: '-dev'
increment: Minor
track-merge-target: true
tracks-release-branches: true
is-release-branch: false
prevent-increment-of-merged-branch-version: false
release:
regex: release?[/]
mode: ContinuousDeployment
increment: Patch # not working, when merging a bugfix from master
tag: ''
is-release-branch: true
prevent-increment-of-merged-branch-version: true
feature:
regex: feature?[/]
mode: ContinuousDeployment
increment: Inherit
tag: '-alpha'
is-release-branch: false
prevent-increment-of-merged-branch-version: true
bugfix:
regex: bugfix?[/]
mode: ContinuousDeployment
increment: Inherit
tag: '-bugfix'
is-release-branch: false
prevent-increment-of-merged-branch-version: true
source-branches: ['master', 'feature', 'release']
pull-request:
mode: ContinuousDeployment
tag: '-pr'
ignore:
sha: []
If anyone manages to make ReleaseFlow working fully please ping me!
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.
There's no explicit support for release flow in GitVersion, but I suppose it can be configured. The Stack Overflow question has an accepted answer, is that a working solution for everyone?
As someone attempting to implement Release Flow with GitVersion in Azure DevOps, the accepted answer is not suitable for me since it's primarily geared toward TeamCity and not as flexible as GitVersion.
From what I can tell the limitation for Mainline is incrementing on the wrong branch.
The main branch is master, but the release branch is special (in my mind) in that it should increment the minor on the initial commit and the patch on the subsequent commits. I think hotfix can be designated a release branch and increment patch on each commit so long it's built from release.
I don't think I'm attempting to use GitVersion wrong, but here's the process flow I was thinking:
That said, I may be confused because it's pretty late for me but that seems to be the process for release flow.
This may be a bug or my misunderstanding of the configuration but the release branch appears to be incrementing twice: one for the merge commit and another for the current branch.
Merge commit b1bdb incremented base versions Minor, now 1.1.0
0 commits found between b1bdb and b1bdb
Performing Minor increment for current branch
Which outputs 1.2.0
And when I set it to not increment, it's not incrementing any value:
Merge commit b1bdb incremented base versions None, now 1.0.0
0 commits found between b1bdb and b1bdb
Performing None increment for current branch
Which outputs 1.0.0
As mentioned above, I would think it would increment because Master (although it's just incrementing the pre-release number) being the mainline had incremented independently of the release branch.
Has anyone figured out the best way to implement this for other deployment systems, like Azure DevOps?
If GitVersion would just add functionality to count commits on the branch, and use release name as the base, this could be simple.
(for speed it would default to false so it doesnt run on branches like master) basically it would perform a (git rev-list --count HEAD ^
Or even better, allow different ways of versioning on different branches, like Master would be specified to Major.Minor.Patch, and Release could be Major.Minor.CommitsSinceBranchCreated
If for example, you create a release branch as
GitVersion Yaml:
branches:
releases:
CommitsSinceBranchCreationAsPatch: true
Release Branch examples
releases/release-1.0
First commit 1.0.1
Second Commit 1.0.2
releases/release-1.0.5
First Commit 1.0.6
Second Commit 1.0.7
@stoopered, branch names aren't a stable source of version information, since they are deleted – usually right after they are merged.
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.
Most helpful comment
The GitVersion.yml file for my working setup
If anyone manages to make ReleaseFlow working fully please ping me!