GitVersion
GitVersion copied to clipboard
[ISSUE]: 6.x Does not work as expected on different merge types / commit history
Prerequisites
- [x] I have written a descriptive issue title
- [x] I have searched issues to ensure it has not already been reported
GitVersion package
AzureDevops task
GitVersion version
6.3.0
Operating system
Windows
What are you seeing?
When we upgraded to the new task: gitversion/execute@3 we started seeing unexpected behavior with versioning.
Mainly the two issues we found were
- main branch version can only be bumped up with Patch, regardless of the provided +semver: Major or Minor
- release branch version can only be bumped with Minor , regardless of provided +semver: Patch or Major
What is expected?
It was expected that the SemVer and other versioning variables set by the gitversion/execute@3 are controlled and directly representing what is set by the developer with +semver: <Change> in the commit .
Steps to Reproduce
azure-pipelines.yml
- task: gitversion/setup@3
displayName: Install GitVersion
inputs:
versionSpec: '6.x'
- task: gitversion/execute@3
displayName: Calculate Semantic Version
inputs:
disableCache: true
disableShallowCloneCheck: true
GitVersion.yml
assembly-versioning-scheme: MajorMinorPatchTag
strategies:
- Mainline
branches:
main:
mode: ContinuousDeployment
is-main-branch: true
pull-request:
regex: ^refs/pull/(?<Number>\d+)/merge$
release:
regex: ^releases?[\/-](?<BranchName>.+)
increment: Inherit
ignore:
sha: []
merge-message-formats: {}
commit-message-incrementing: MergeMessageOnly
update-build-number: true
The above described behavior is seen only on some merge types .
In Azure DevOps there are 4 merge types settings available.
- Basic merge - versioning works as expected for main and release branches (representing what is described in commit message with +semver: <Change> )
- Rebase and fast-forward - versioning of Main only bumps Patch regardless of +semver: Major or Minor in the commit message and versioning of release/branch only bumps Minor regardless of +semver: Patch or Major in the commit message
- Rebase with merge commit - versioning of Main works as expected , but versioning of release/branch only bumps Minor regardless of +semver: Patch or Major in the commit message
- Squash merge - versioning of Main only bumps Patch regardless of +semver: Major or Minor in the commit message and versioning of release/branch only bumps Minor regardless of +semver: Patch or Major in the commit message
Example :
- Main Using Basic merge Main is on 1.0.0 . A commit is made with +semver: Major . The new build is versioned with 2.0.0 Using Squash merge Main is on 1.0.0 . A commit is made with +semver: Major . The new build is versioned with 1.0.1
Using Basic merge Main is on 1.0.0 . A commit is made with +semver: Minor. The new build is versioned with 1.1.0 Using Squash merge Main is on 1.0.0 . A commit is made with +semver: Minor. The new build is versioned with 1.0.1
Using Basic merge Main is on 1.0.0 . A commit is made with +semver: Patch. The new build is versioned with 1.0.1 Using Squash merge Main is on 1.0.0 . A commit is made with +semver: Patch. The new build is versioned with 1.0.1
- Release/branch Using Basic merge Release/branch is on 1.0.0 . A commit is made with +semver: Major . The new build is versioned with 2.0.0 Using Squash merge Release/branch is on 1.0.0 . A commit is made with +semver: Major . The new build is versioned with 1.1.0
Using Basic merge Release/branch is on 1.0.0 . A commit is made with +semver: Minor. The new build is versioned with 1.1.0 Using Squash merge Release/branch is on 1.0.0 . A commit is made with +semver: Minor. The new build is versioned with 1.1.0
Using Basic merge Release/branch is on 1.0.0 . A commit is made with +semver: Patch. The new build is versioned with 1.0.1 Using Squash merge Release/branch is on 1.0.0 . A commit is made with +semver: Patch. The new build is versioned with 1.1.0
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).