GitVersion icon indicating copy to clipboard operation
GitVersion copied to clipboard

CommitsSinceVersionSource/BuildMetaData Counter Not Consistently Incrementing Forward

Open jklaus opened this issue 6 years ago • 8 comments

I'm leveraging NuGetVersionV2 to set the package version on library/nuget package builds. For some reason at random the CommitsSinceVersionSource/BuildMetaData portion of the NuGetVersionV2 string, for pre-release packages, will jump around. In general it increments forward as you would expect but out of nowhere it will start decrementing, and sometimes just jump around all together.

Here's is what I'm seeing in the builds each time I push a commit, in chronological order:

6.20.0-blah0001
6.20.0-blah0002
6.20.0-blah0003
6.20.0-blah0004
6.20.0-blah0005
6.20.0-blah0001  <-- Conflicts, bumping next-version 6.20.1 to work around the issue.
6.20.1-blah0003  <-- Sequence started at 0003, I would have expected 0001
6.20.1-blah0002  <-- Decrements but doesn't result in a conflicting package as 6.20.1-blah0002 doesn't yet exist
6.20.1-blah0003  <-- Conflicts, just committed a minor touch commit to get past 0003
6.20.1-blah0004
6.20.1-blah0001  <-- Sequence jumps down to 0001, expected this should be 0005

Note, we are in Azure DevOps on hosted agents. We have .Net Core 2.1 and 3.1 installed. The version of GitVersion.Tool that was installed on the latest attempt (which yielded 6.20.1-blah0001) was version 5.3.7.

On a couple of those occasions I may have had a couple local commits which were pushed at the same time, but I'm seeing the same inconsistencies even when I'm pushing a single commit. I have our packaging build produce release packages anytime a commit lands on origin/develop (currently limited to PRs by means of branch policies), and pre-release packages anytime a commit(s) is pushed to origin/features/*. The issue I'm currently experiencing is related to pushes occurring on said feature branch. These repos are main-lining off of develop and no other branches have been committed to while all this was going on.

Here's my GitVersion.yml:

mode: ContinuousDeployment
assembly-versioning-scheme: MajorMinorPatch
continuous-delivery-fallback-tag: ''
increment: Patch
next-version: 6.20.1

branches:
  develop:
    regex: dev(elop)?(ment)?$
    tag: ""
    is-mainline: true

jklaus avatar Aug 04 '20 00:08 jklaus

The builds continue to be very sporadic. Sometimes yielding the next incrementation but most times they're all over the place.

jklaus avatar Aug 04 '20 17:08 jklaus

May something have happened on other branches that can affect the version number? Merged release branches, tags, etc.

asbjornu avatar Aug 04 '20 18:08 asbjornu

@asbjornu I considered that but looked through all the branches and nothing has changed. I'm the only person working on this repo, and I'm entirely in my singular feature branch. I mean commit to commit, pushing with every commit, I'm seeing that trailing segment of the pre-release tag jump all over the place. Anymore its not even attempting to iterate really. I think I saw it move sequentially forward once today, otherwise it's just jumping all over the map. Interestingly it is staying in the single digits.

jklaus avatar Aug 04 '20 19:08 jklaus

The only difference I see between the last build to work correctly vs when it started jumping around is that they are on different agents but both hosted 2019 machines, both pulled .Net Core 3.1.302. Hmm

jklaus avatar Aug 04 '20 19:08 jklaus

Are you able to reproduce this problem in a RepositoryFixture test and submit a pull request with it?

asbjornu avatar Aug 05 '20 00:08 asbjornu

@asbjornu - I'll try to find some time to attempt to reproduce it later today / this evening. I'm swamped with work right now. Its interesting to me that it started at 8~9pm EST the other day. We experienced this in the past and it seemed to align with a sprint release of Azure DevOps. We resolved it in the past by migrating off of version 4.x of git-version IIRC. I'll try to talk to my counter part and see if I'm remembering correctly, it was a while ago.

jklaus avatar Aug 05 '20 13:08 jklaus

May I ask you to provide an integration test please (or at least steps to reproduce)? I can tell you it is really hard to get into such issues and answer the question: Has it already been solved or not with the actual refactoring initiative!? Please provide integration tests any time. It makes life easier for the people who wants to make GitVersion stable. Thank you very much.

HHobeck avatar Mar 20 '23 07:03 HHobeck

Alot of work has been done and it's not clear for me if this issue persists. I'm going to close ithis issue because there are no steps to reproduce. Please use the latest pre-release version and verify your scenario again... it might be solved. If not please re-open this issue or create a new bug. Thank you very much.

HHobeck avatar Mar 21 '23 07:03 HHobeck