Using Mainline mode, patch is being increased oddly on Jenkins
I am using Jenkins for my CICD and every time I commit a fix, on the build server the versioning starts from x.y.1 and only increases to the next odd number, so to 3 and then to 5, skipping all the even numbers. But when I run gitversion locally, for the same project, the versioning is correct. Also, the minor increment starts from x.y.1 not x.y.0 on the build server, but locally starts from 0.
This is my yml:
mode: Mainline
assembly-versioning-scheme: MajorMinorPatch
assembly-file-versioning-scheme: MajorMinorPatchTag
tag-prefix: '[vV]'
major-version-bump-message: '.*BREAKING CHANGE:.*?'
minor-version-bump-message: '(?i)feat(\(.+\))?:'
patch-version-bump-message: '(?i)fix(\(.+\))?:'
no-bump-message: '^((?!.*BREAKING CHANGE|fix|feat).)*$|fix\s*?(\(\))|feat\s*?(\(\))'
legacy-semver-padding: 4
build-metadata-padding: 4
commits-since-version-source-padding: 4
commit-message-incrementing: disabled
branches: {}
ignore:
sha: []
Any thoughts?
How does it behave if you delete GitVersion.yml?
@asbjornu after deleting the yml and writing the commit messages using the default structure (+semver: breaking|feat|fix), it seem to be working fine on the build server, but it's not working locally anymore..
@asbjornu
The source of this behavior is because by default Jenkins will get origin/master as a local branch called origin/master
This means the code in the MainlineVersionCalculator will increment the patch because it thinks that it isn't master and the last commit wasn't a merge :
https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/VersionCalculation/MainlineVersionCalculator.cs#L67
We worked around this by making Jenkins checkout to a local branch name called master.
Aha, that explains it. Thanks for figuring that out, @ben3005. Would you be interested in submitting a PR that fixes the comparison? I believe we compare against different variations of master elsewhere, so that comparison should probably be moved to an extension method or similar so we do it the same way everywhere.
Hi all,
I've got this problem today. Is there any update or workaround about this issue ? :(
@HotdogWang: Sorry, we need a PR to fix it. None has been provided so far and I don't have time to invest in fixing this as of now.
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.