-
Notifications
You must be signed in to change notification settings - Fork 648
-
Notifications
You must be signed in to change notification settings - Fork 648
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] Build number in Azure DevOps wrong #3351
Comments
Seems like this is related to #2074, #2301, #2838, #2852, #3104 and probably more, which should have been fixed in #3033. In particular, #3033 (comment) may be of interest. I don't think @ThomasPiskol managed to automate testing of that, so perhaps we've somehow reverted his fixes somehow? |
@asbjornu - I can confirm that we had this problem with 5.12.0 (5.x as of this comment) where our master is tagged as |
Any ideas on how to get around this one guys? Or is it going to have to be another fix? Thanks! |
I am seeing this issue as well. Anything built off of a tag adds the -tags---*- into the prerelease tag |
I will give this a shot, but I may not get around to it in a few weeks :(
sorry!
|
I'm going to close this issue because of missing steps to reproduce. Please try your scenario on the preview version 6.0.0-beta.1 which reflects the latest develop initiaitves and give me feedback if your issue still persists. Thank you very much. |
I'm facing the same issue using version |
Please provide steps to reproduce for the 6.x version. Thank you |
Hi @HHobeck, I've finally gotten around to making a test file. I hope we can re-open this issue and get the core team to look into it for us. The test file I came up with is the following: TagCheckoutInBuildAgentTests2.cs
I have run a git bisect between the
Looking at
If I remove that portion, it works as it used to before. I hope this helps sort out the issue at hand! Let me know if you need more information please. Regards, |
Sorry, but tagging in @enriqueraso as he was the committer, and may miss this issue since he's not a full time contributor. @enriqueraso , could you please explain this part of the code, and what cases it's meant to solve? Thanks, |
If you revert the change that I introduced this bug will appear again. #3223 I have releases branch configured with '' empty tag and defined as mainline, and main branch as '-rc' tag and also as mainline. Feature and bug branches are created from releases branch and they increase Minor or Patch when merging in releases branch. Main branch is used to create a new releases branch. |
Hi there. Your scenario seems to me not common and maybe your workflow is not properly configured. You have a main branch with a pre-release label empty and tag it with a beta label and expecting that GitVersion detects it. Please have a look to the following tests:
In the integration test you define this: var env = new Dictionary<string, string>
{
{ AzurePipelines.EnvironmentVariableName, "true" },
{ "BUILD_SOURCEBRANCH", "refs/tags/0.2.0-beta.1" }
}; which results in: What I'm supprised is that in your scenario the current branch is tags/0.2.0-beta.1. Thus the resulting calculation of the version To change the behavior you need to either:
Good to know: If you don't care about what the pre-release label might be you need to specify the label on branch and on root level to null. Edit: I have used the 6.0.0-beta.3 version of GitVersion. |
Hi @HHobeck, thanks for your thorough explanation. I will have a shot at these suggestions and let you know if I 'm still stuck. Regards, |
Hi @KiLLeRRaT . Yes please try it out. Maybe you need to go two steps back and change your workflow or at least change the configuration. To specify every time the Regards |
I think it is related to: |
I'll briefly explain our workflow, which I thought was quite simple: For all our internal frameworks, we have a master branch. We don't use or need the automatic versioning. When we want to version a commit, we tag that commit, and run the CICD pipeline. We then expect the DLLs and so on to be that version. If we want to release a beta version, we'd tag the commit in master with We have had this workflow for many years, and it's been working well for us. Do you have any config recommendations for us to achieve that? Here is an example config of one of our libraries: assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
branches:
master:
regex: ^master$|^main$
mode: ContinuousDelivery
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tracks-release-branches: false
is-release-branch: false Thank you for your time! Regards, |
What about this (with 6.00-beta.3 version)? assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
branches:
tags:
mode: ContinuousDelivery
label:
increment: None
prevent-increment-of-merged-branch-version: true
track-merge-target: false
regex: ^tags[/-]
source-branches:
- develop
- main
- release
- feature
- pull-request
- hotfix
- support
tracks-release-branches: false
is-release-branch: false
is-mainline: false
pre-release-weight: 0
ignore:
sha: []
label: Edit: Maybe you can skip the source-branches and some other properties: assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
branches:
tags:
mode: ContinuousDelivery
label:
regex: ^tags[/-]
ignore:
sha: []
label: |
Hi @HHobeck 5.11.1This is the config: assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
mode: ContinuousDelivery
increment: Inherit
branches:
master:
regex: ^master
mode: ContinuousDelivery
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tracks-release-branches: false
is-release-branch: true 6.0.0-beta.4Config (your last minimal version, I've also tried your full config version suggestion): assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
branches:
tags:
mode: ContinuousDelivery
label:
regex: ^tags[/-]
ignore:
sha: []
label: Heh all I want is the version to be exactly what the tag is, I have tried my old working config with 6.0.0-beta.4 too, also no luck. Thanks for you help with this in advance. |
I have this problem as well and have also reverted to 5.11.1. It only seems to happen during the build on the DevOps agent because it doesn't actually clone the branch of say master when a build triggers based on a tag, it instead downloads the tag via refs/tags/{tagname}. I'm not sure how to do this locally in order to try and replicate it. |
Actually it is quite better then the initial behaviour right!? ;) I'm not sure if your test scenario is the same like on the azure devops pipeline because the Can you mabe try this: assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
branches:
main:
label:
tags:
mode: ContinuousDelivery
label:
regex: ^tags[/-]
ignore:
sha: []
label: |
It is very difficult for me to help you because I have no inside into your repository. I have tried it with beta.4 on azure devops and it is working: next-version: 1.0.0
mode: ContinuousDeployment
branches:
main:
mode: ContinuousDelivery
label:
tags:
mode: ContinuousDelivery
label:
regex: ^tags[/-]
feature:
mode: ContinuousDeployment
increment: Minor
hotfix:
mode: ContinuousDeployment
increment: Patch
ignore:
sha: []
merge-message-formats: {}
label: |
Your first execution:
Edit: Please try Your Second execution: |
Is this on a public repo? If so I could take a look and compare it to my structure :) Please let me know. |
Nope it's not public |
Righto, I have some sort of success :) Using the config you last posted (I removed a couple of things): assembly-versioning-scheme: Major
assembly-informational-format: '{Major}.{Minor}.{Patch}{PreReleaseTagWithDash}+{CommitsSinceVersionSource}.Branch.{EscapedBranchName}.Sha.{ShortSha}'
mode: ContinuousDeployment
branches:
main:
mode: ContinuousDelivery
label:
tags:
mode: ContinuousDelivery
label:
regex: ^tags[/-]
ignore:
sha: []
label: I think it was because we didn't have the I then tried it via the nuget package, but got a build error, so I will stay on I just want to say thanks a lot of helping out with this, and I can understand that it's very tricky because of everybody's repos being different and private etc. 6.0.0-beta.4 Build Error when referencing via NugetI think unrelated, and probably needs a separate issue created. When I try to build using a nuget reference to Currently running Linux, .NET 8.
|
|
Nope.
|
Describe the bug
The build number in Azure DevOps has changed and most likely not respecting my GitVersion.yml file anymore.
Expected Behavior
The build number should be
2.4.0-beta.24
when building off a tag called2.4.0-beta.24
.Actual Behavior
The build number is set to
2.4.0-tags-2-4-0-beta-24.1
when building off of the tag2.4.0-beta.24
Possible Fix
This seems to have been introduced in
5.12.0
. If I revert back to5.11.x
, it works as it should. Could this somehow be related to the prerelease tag changes that were made? Is it because I don't have abeta
tag against themaster
branch in my config but I'm specifying it in a tag or something?Here is the compare between the two versions for reference: 5.11.1...5.12.0
Context
this is making a mess of my NuGet packages, as they are all now submitted with the weird version.
Your Environment
My GitVersion.yml file:
The text was updated successfully, but these errors were encountered: