We're trying to use GitVersion configured for GitFlow for some internal NuGet packages, published to an Azure DevOps feed.
A problem arises when we make commits to a release branch. They will be versioned like this by GitVersion:
0.3.0-rc.1+0 --> 0.3.0-rc.1+1 --> 0.3.0-rc.1+2 --> ...
In other words, the number of commits in the release branch is appended as build metadata in the FullSemVer string. We do get the package marked as this FullSemVer
string, but the Azure DevOps feed rejects the packages with error "409 (Conflict - The feed already contains 'PackageName 0.3.0-rc.1+1'[...]". This happens even though the existing package has version "0.3.0-rc.1+0".
The behavior is correct with respect to how SemVer specifies version precedence, i.e. that build metadata should be ignored, so I suppose a solution would be to find a way to place the commit number in the prerelease part instead of in build metadata. But I can't seem to figure out how to achieve that using GitVersion.
Version like this would be acceptable:
0.3.0-rc.1.0 --> 0.3.0-rc.1.1 --> 0.3.0-rc.1.2 --> ...
Or like this (even better? seems to make sense to me):
0.3.0-rc.1 --> 0.3.0-rc.2 --> 0.3.0-rc.3 --> ...
How should I configure gitversion.yml
to achieve that?
I'm kind of ruling out the alternative to get the feed to accept duplicates that only differ in the build metadata part, but if this option exists and would solve my problem I'm willing to consider it.
Here's our current gitversion.yml
:
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatch
mode: ContinuousDelivery
tag-prefix: '[vV]'
continuous-delivery-fallback-tag: ci
major-version-bump-message: '\+semver:\s?(breaking|major)'
minor-version-bump-message: '\+semver:\s?(feature|minor)'
patch-version-bump-message: '\+semver:\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
tag-pre-release-weight: 60000
commit-message-incrementing: Enabled
branches:
develop:
mode: ContinuousDeployment
tag: dev
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: true
regex: ^dev(elop)?(ment)?$
source-branches: []
tracks-release-branches: true
is-release-branch: false
is-mainline: false
pre-release-weight: 0
main:
mode: ContinuousDelivery
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: ^master$|^main$
source-branches: [ 'develop', 'release' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: true
pre-release-weight: 55000
release:
mode: ContinuousDelivery
tag: rc
increment: None
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: ^releases?[/-]
source-branches: [ 'develop', 'main', 'support', 'release' ]
tracks-release-branches: false
is-release-branch: true
is-mainline: false
pre-release-weight: 30000
feature:
mode: ContinuousDelivery
tag: feature-{BranchName}
increment: Inherit
prevent-increment-of-merged-branch-version: false
track-merge-target: false
regex: ^features?[/-]
source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: false
pre-release-weight: 30000
pull-request:
mode: ContinuousDelivery
tag: PullRequest
increment: Inherit
prevent-increment-of-merged-branch-version: false
tag-number-pattern: '[/-](?<number>\d+)'
track-merge-target: false
regex: ^(pull|pull\-requests|pr)[/-]
source-branches: [ 'develop', 'main', 'release', 'feature', 'support', 'hotfix' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: false
pre-release-weight: 30000
hotfix:
mode: ContinuousDelivery
tag: rc
increment: Patch
prevent-increment-of-merged-branch-version: false
track-merge-target: false
regex: ^hotfix(es)?[/-]
source-branches: [ 'develop', 'main', 'support' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: false
pre-release-weight: 30000
support:
mode: ContinuousDelivery
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: ^support[/-]
source-branches: [ 'main' ]
tracks-release-branches: false
is-release-branch: false
is-mainline: true
pre-release-weight: 55000
merge-message-formats: {}
update-build-number: true
Any ideas?