Skip to content
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] 5.12.0 does not respect tag in Continuous Deployment mode #3614

Closed
g7ed6e opened this issue Jun 29, 2023 · 10 comments
Closed

[Bug] 5.12.0 does not respect tag in Continuous Deployment mode #3614

g7ed6e opened this issue Jun 29, 2023 · 10 comments

Comments

@g7ed6e
Copy link

g7ed6e commented Jun 29, 2023

Describe the bug
With 5.12.0, in ContinuousDeployment mode, the tag applied to a commit is not took into account and is overriden.

Expected Behavior

If i tag a commit with 1.1.0-preview1 on a master branch i would expect that NuGetVersion and NuGetVersionV2 to be 1.1.0-preview0001 (this is the behavior of GitVersion 5.10.3)

Actual Behavior

  • If build is queued by selecting the tag, build is tagged 1.1.0-tags-1-1-0-prev-0001
  • If build is queued by selecting the branch master (HEAD is the tagged commit), build is tagged 1.1.0

Possible Fix

GitVersion Documentation is mentionning

Tagging commit
By tagging a commit, GitVersion will use that tag for the version of that commit, then increment the next commit automatically based on the increment rules for that branch (some branches bump patch, some minor).

Steps to Reproduce

Context

Azure DevOps git repo that output nuget packages, GitHub flow. GitVersion used to ship preversion from the master branch.

@HHobeck
Copy link
Contributor

HHobeck commented Jun 30, 2023

Hi Guillaume. Please provide steps to reproduce!! In advance does this happen in the pre-release 6.0.0-beta.3 as well?

@norigeist
Copy link

This bug resembles the closed one in #3351.

Is version 6.0.0-beta.3 supposed to work on a project with target framework 4.7.2? I want to test that version if this issue is solved already, but unfortunately, get this error when building the project. In version 5.12.0, I am still able to build the project.

The command "dotnet --roll-forward Major "C:\<some-path>\packages\GitVersion.MsBuild.6.0.0-beta.3\tools\net6.0/gitversion.dll" "C:\<some-path>\src\TestProject"  -output file -outputfile gitversion.json"

@g7ed6e
Copy link
Author

g7ed6e commented Jun 30, 2023

Hi Guillaume. Please provide steps to reproduce!! In advance does this happen in the pre-release 6.0.0-beta.3 as well?

Thanks @HHobeck for quick reply I will send a link to a public repo and build repro asap.

@g7ed6e
Copy link
Author

g7ed6e commented Jul 1, 2023

@HHobeck This azure devops repo reproduces the issue: https://dev.azure.com/guillaume-delahaye/_git/GitVersion-Issue3614
There are 2 yaml pipelines. (pipeline-5-10-3 and pipeline-5-12-0).
To see the issue just queue a build with pipeline-5-12-0, selecting either the master branch (you will get a stable build number instead of the tag linked to the HEAD commit), or the tag 1.1.0-preview2 (in that case the build number is a preversion containing the keyword tag).
To see previous behavior queue builds with pipeline-5-10-3

@HHobeck
Copy link
Contributor

HHobeck commented Aug 5, 2023

Finally the question remains: Is this issue also existing on the pre-release version of git-version? It would be nice to find out the answer.

@HHobeck
Copy link
Contributor

HHobeck commented Aug 5, 2023

I think it has something to do with the circumstance how the git repository will be checked out. Maybe try the following (see attachment [1]):

steps:
- checkout: self
  clean: true
  fetchDepth: 0

Generally, I don't understand your scenario. Why would you tag a pre-release version on main? The logic how it is implemented is that the pre-release label will be not considered when it's not matching with the branch (see attachment [2]). Thus your expectation to get the version 1.1.0-preview0001 will be never fulfilled even if the git repository will be checked out with branch information (main has an empty tag specification by default).

Attachment [1]:
image

Attachment [2]:
image

@igiona
Copy link

igiona commented Aug 30, 2023

I think it has something to do with the circumstance how the git repository will be checked out. Maybe try the following (see attachment [1]):

steps:
- checkout: self
  clean: true
  fetchDepth: 0

Generally, I don't understand your scenario. Why would you tag a pre-release version on main? The logic how it is implemented is that the pre-release label will be not considered when it's not matching with the branch (see attachment [2]). Thus your expectation to get the version 1.1.0-preview0001 will be never fulfilled even if the git repository will be checked out with branch information (main has an empty tag specification by default).

Attachment [1]: image

Attachment [2]: image

If I get you correctly, in order for the pre-release to work I need to create a "-rc" tag in a "rc" branch?
Why would this restriction be needed?

In my workflow I kind of follow the flow suggested by @g7ed6e as well.
Whenever the main is ready for the RC to be created, I simply pre-release it by adding a tag such as "v1.2.3-rc.1".
I only create a release branch if the RC fails the release tests and it requires changes while the main already got new commits.
Otherwise the next rc is simply the next commit on the main, I agree on the fact that this seldemly happen because the main moves on fast with the next release.
But regardless of this detail, hardly my stabilization branch will never match the pre-release tag, I don't see why I should create a "rc" branch in this case?
I would rather create a "release/" branch in which the next release-candidates are consolidated and finally result into the release.

@HHobeck
Copy link
Contributor

HHobeck commented Aug 31, 2023

If I get you correctly, in order for the pre-release to work I need to create a "-rc" tag in a "rc" branch?
Why would this restriction be needed?

Please see the answer of the following discussion: Using prerelease tag in git tag is removed from version numbers #3663 (reply in thread)

In my workflow I kind of follow the flow suggested by @g7ed6e as well.
Whenever the main is ready for the RC to be created, I simply pre-release it by adding a tag such as "v1.2.3-rc.1".
I only create a release branch if the RC fails the release tests and it requires changes while the main already got new commits.
Otherwise the next rc is simply the next commit on the main, I agree on the fact that this seldemly happen because the main moves on fast with the next release.
But regardless of this detail, hardly my stabilization branch will never match the pre-release tag, I don't see why I should create a "rc" branch in this case?
I would rather create a "release/" branch in which the next release-candidates are consolidated and finally result into the release.

If you want to define a branch with multiple pre-release labels you need to specifiy the label with null value (on branch and root level).

public void EnsurePreReleaseTagLabelWillBeConsideredIfNoLabelIsDefined(long patchNumber)

Copy link

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.

@github-actions github-actions bot added the stale label Nov 29, 2023
@HHobeck
Copy link
Contributor

HHobeck commented Dec 7, 2023

I'm going to close this issue because I think it is the same problem like I have analysed here in the issue:

You need to ensure that the tag matches with the label on the branch with continues delivery mode.

@HHobeck HHobeck closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants