-
Notifications
You must be signed in to change notification settings - Fork 654
[Bug] GitVersion not producing the correct version when building a version tag in an Azure DevOps pipeline #2362
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
Comments
I'm facing the same problem. With the previous versions of GitVersion for Azure DevOps (UseGitVersion), setting |
If you take a look at #2231 of which this issue is a pretty precise duplicate, I believe you have stumbled upon #2074. The source of the problem is still unknown, I'm afraid. If anyone have time to investigate, reproduce a failing test, provide a public repository that demonstrates the problem or anything else to help, that would be much appreciated. Please read through and close as duplicate. |
@asbjornu - I've created a repo and pipeline that produces the problem in a public DevOps project.
With this, it should be possible to fork the repo for analysis, and hookup the I took a shot at creating an integration test that produces the problem, but I could not produce a failing test. I attempted to author a test that was as faithful a reproduction as possible of how we use GitFlow - PRs for Hopefully with this available to you, it can aid in a resolution. |
...further to my previous message. The plot thickens. Prior to staging the repo to produce the issue, I unintentionally created a repository state where building a tag did produce the correct version here. I triggered another build of the Now, after having produced the problem with the |
I can contribute my experience to the fact that, it seems to me the the problem arises only if there are other pushed branches. I mean that if (in a gitflow) I finish a hotfix branch (merge to master with tag and merge to dev), prepare a new hotfix branch from master and I push the 3 branches I get the wrong version on the tagged commit (master). |
@gerwinjansen was able to reproduce this issue, please refer to #2074 (comment) |
Closing this issue as it is a duplicate of more than one other issue, and appears to be now well on its way to being addressed in #2074. |
Describe the bug
When building a tag that represents a specific version (e.g.
1.1.2
) in and Azure DevOps pipeline, using thegitversion/execute@0
task, the version number in the tag is not honoured. Instead, it appears that the version is being incremented, and thetags/1.1.2
segment of the tag repo path (e.g.refs/tags/1.1.2
) is being assigned as aPreReleaseTag
. This results in the unexpected version number1.2.0-tags-1-1-2.1.1+8
instead of the expected1.1.2
.We use a GitFlow branch strategy, and CI triggers on tags (rather than the
master
branch itself) to trigger builds for Production deployments. For us, being able to produce the correct version number based on a version tag is critical, because our automated processes engage extra steps when build a tag vs merely building themaster
branch.We've observed this problem with both GitHub and Azure Repos.
This works as expected with the now deprecated
GitVerssion@5
(which I believe still invokes GitVersion5.1.2
) task, and worked fora time with the also obsoleteUseGitVersion@5
- but the issue also now manifests withUseGitVersion@5
. So, I imagine this is an issue that was introduced into GitVersion itself, rather than the Azure Pipelines task implementations.Expected Behavior
When building a version tag, such as
1.1.2
, the version number produced should be based on the tag, resulting in the version1.1.2
.Actual Behavior
The version number when building a tag, appears to be based on the tag repo path, and treated as a pre-release version, producing a version number like
1.2.0-tags-1-1-2.1+8
.Steps to Reproduce
All our affected repositories follow the same basic patterns. GitFlow, tagging the release commit with a version tag in the
master
branch, pushing the version tag to trigger the Production automated build and release process w/ Azure DevOps with a tag-base CI trigger.GitVersion.yaml
azure-pipelines.yml
gitversion/execute@0 Log file
See the log file DevOps task execution demonstrating the problem
See attached frrom
gitversion/execute@0
task execution, produced with system diagnostics enabled.Context
All of our existing automated release processes that leveraged tag CI triggers and GitFlow now produce the wrong version number. Now the previously automated process now requires manual intervention, across several different products and repos.
Your Environment
ubuntu-latest
The text was updated successfully, but these errors were encountered: