-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug] GitVersion no longer calculates version correctly for mainline mode #2441
Comments
Thanks for the bug report. Are you able to submit a failing test in a pull request that reproduces this behaviour? |
Sure, I will try to set up something :) |
While setting up the test's to verify the bug I actually found the actual cause of this bug. It is the use of So, my question now is this the actual behaviour? And if yes then maybe the documentation needs to be more explicit and explain better. |
If you remove |
I can update the documentation but I first want to confirm the behaviour of At present, to me, it looks like If that is the case, I don't see much value in |
I can confirm this issue as well - this is a clear change in behavior from 5.3.x and earlier. We had to continue using the older versions since we use next-version. Was it a conscious choice, or is it a bug? :-) |
I was of the impression that until 5.5, @techgeek03, how were you using
Yes, this sounds like how
Then don't use |
There is a definite change in behaviour with regards to main mode here. Currently affecting all of my (over 100) pipelines. For now, the only choice for me is a downgrade back to version 5.3.7 |
Can you please explain how you used |
@asbjornu Sure - for us the next-version property serves a single purpose, we use it as part of initializing a repo into our GitVersion process. When we on board a new repo, the first version used by GitVersion will come from the next-version property. From then on in, the next-version property has been ignored in our experience. At the end of our build pipeline we tag the commit using the version calculated by GitVersion, this then becomes the base version detected the next time the build is run. We squash all commits into master from PRs and allow the semver to be incremented by merge message only. When there is no specific merge message, we expect patch to be incremented, otherwise we use +semver: minor or +semver: major to bump a major or minor version on merge. Since the change to 5.5, I am now seeing that when committing with no merge message, the version was not actually incremented at all - the version remained as per the last tag in the repo. Our very simple config, which we have been using for a long time, is shown below. mode: Mainline
commit-message-incrementing: MergeMessageOnly
next-version: 0.1.0
branches:
feature:
regex: feature(s)?[/-]
mode: ContinuousDeployment
tag: useBranchName
increment: None
prevent-increment-of-merged-branch-version: true
track-merge-target: false
pull-request:
regex: (pull|pull\-requests|pr)[/-]
mode: ContinuousDeployment
tag: PullRequest
increment: None
prevent-increment-of-merged-branch-version: true
track-merge-target: false
track-merge-target: false
hotfix:
regex: (hotfix(es)?|config)[/-]
mode: ContinuousDeployment
tag: useBranchName
increment: None
prevent-increment-of-merged-branch-version: true
track-merge-target: false
ignore:
sha: [] |
Thanks, @clawrenceks. From my understanding, the old behaviour seems like an oversight in the initial implementation of For everyone having problems with |
@asbjornu In our case we used Intentionally or unintentionally it is a clear change of behaviour and in my view this constitutes as a breaking change, but since there is a workaround it is fine :) |
I have to agree on the breaking change. For now, I am going to test on one repo and if it works, I will go and update the other 100+ repos that have a GitVersion configuration. Seems like the version number of GitVersion should be bumped to 6.0.0 if this change is going to remain and the docs updated accordingly though. |
If we knew beforehand that What we can do now is either document the new behavior and discourage the use of |
That won't do anything to mitigate this issue causing problems for potentially many other people. At least if you bump the version, it could prevent peoples pipelines from automatically using a broken version - giving them chance to read about the breaking change before they move to the next major version. |
GitVersion bug, GitTools/GitVersion#2441
Just discovering this, as the author of the change that wrecked all this havoc. The reason I wrote this change is that, as far as I could figure out, next-version didn't work in Mainline mode. My use case was the same as @clawrenceks: boot strap a project with an initial version before it had any tags in Git to reference. You can see in #2335 the behavior I was seeing before. I wanted the next released version to be 1.0.0, and so I wanted my prerelease versions to be 1.0.0-branch01, 1.0.0-branch02, etc. But it was generated 1.0.1-branch01, 1.0.1-branch02, etc. I believe that when I would run against master with next-version set to 1.0.0 that it would properly generate 1.0.0, but I needed those pre-release versions to be correct. The code was treating next-version as the current version when doing prerelease builds, which would produce an incorrect version (by incrementing that next-version rather than using it directly). Walking through the code, I reasoned that, well, if you're specifying a next-version, then it must because you want the next-version to be that, and if you didn't want the next version to be the version specified, then you wouldn't include it. Maybe it would have made more sense to introduce something like |
The fact that |
@asbjornu I just came across this issue (after spending 2h of debugging this), and we pretty much have the same issue where the version gets reset to whatever I was under the impression that this combination of mainline and |
@b10-dslappendel sorry, but |
I'm very sorry to hear that, but as I said, tags are just not reasonable to us. Since mainline is used where the master branch is the release branch, and the versions are calculated based on a base version, I don't see how next-version is even remotely usable anymore. Please consider this a feature request for a base-version, because we're now forced to change a lot of internal projects, or stay on 5.3.7. However, that version seems to also have a bug related to |
@b10-dslappendel, why is adding |
Alright, I probably let my frustration go too far because of the wasted hours I had today, and therefore didn't notice that you're saying that a single tag can serve as a base version. I noticed that the deprecated GitVersion DevOps task somehow started failing this week on the Ubuntu agent, whereas it still worked last week, started trying to fix it, noticed that the task had been deprecated and had been renamed, installed that, still didn't work, came across another (this time Windows) agent issue that I already mentioned, and also somehow had this versioning change. Forgive me. So, can you confirm that using a tag on a commit somewhere in history will allow the version calculation to work again, in a monorepo with projects that have independent versioning, combined with Azure DevOps that auto-tags builds with a project-prefixed version tag with the version that GitVersion puts out? For context, we're using git-filter-repo to strip out commits that have nothing to do with a specific project folder, otherwise we would end up similar versions.
Because if that works, we don't have to tag stuff ourselves manually. That's the main reason why I asked for a |
Okay, no problem.
No, sorry, GitVersion doesn't support monorepo.
For monorepo, I can see how Catering to monorepo features eventually leads us into having to explicitly support every monorepo feature, something that in the end will require a massive rearchitecture and rewrite of GitVersion for a use-case none of the current maintainers of GitVersion use themselves. Unless someone with monorepo requirements invests the time required to both do the initial work and commit to maintaining it "forever", GitVersion can't support it. Sorry. |
Hi, Just wanted to mention that the documentation on https://gitversion.net/docs/reference/configuration reflects what was mentioned here but the documentation on https://gitversion.net/docs/reference/version-increments still says |
@ejdre-vestas, thanks for pointing that out. It's a miss that needs fixing. |
Describe the bug
Since version 5.5 when using Mainline mode GitVersion is not calculating the version at all and it gives ether the value in
next-version
or the version from the last tag.Expected Behavior
To have correct version
Actual Behavior
Version is stacked at
next-version
or the version from the last tagSteps to Reproduce
Here is a simple GitVersion.yaml file I have been using
After many commits in
master
branch this is the output of GitVersionI tried using
main
as default branch as well but it had the same problem.Context
We are using GitVersion in all our Azure DevOps pipelines and we have configured the pipeline task to use the latest version of GitVersion, so currently all our pipelines are reporting wrong versions.
Your Environment
The text was updated successfully, but these errors were encountered: