-
Notifications
You must be signed in to change notification settings - Fork 653
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] Regression: GitVersion 5.12.0 uses only MajorMinorPatch from tag instead of SemVer #3487
Comments
I believe this is fixed in 6.0.0-beta.2, can you please test it to verify? |
The results are different but not according to my expectations. Is it a bug or a feature? I don't know. Summary7576b44b1 3a6b12348
Relevant addition to // set the updated prerelease tag when it doesn't match with prerelease tag defined in branch configuration
if (preReleaseTagDoesNotMatchConfiguration)
{
taggedSemanticVersion.PreReleaseTag = semver.PreReleaseTag;
}
6.0.0-beta.2
ConclusionCulprit for 'breakage' in 5.12.0 currently looks like a feature to me. Full test results for 6.0.0-beta.2Result 1 (without tag-prefix):
Result 2 (with tag-prefix):
|
Hi there. Please consider that in your scenario the pre-release label of the main branch is set to an empty string. That means the resulting versions on this branch are always pre-release versions without a label name. Also the pre release number e.g. coming from a tag will be only incremented if it matches with the pre-release label of the branch. Same is for alpha and beta release stages. The number of beta starts with one independent how many alpha releases have been deployed previously. It makes sense right? If you want to detect all pre-release labels in one branch because you have a trunk base strategy or whetever you need to specify the pre-release label to null. Happy Branching. |
Hello @HHobeck, thanks for your explanation. Also, I am confused whether this is a bug that requires fixing (as you added the milestone tag) or it is not a bug (as you closed the issue without a commit reference). Am I missing something?
I modified my tests to include this recommendation. Summary5.11.1All of my tests pass (as they have without setting the branch tag to 5.12.0All of my tests fail (as they have without setting the branch tag to 6.0.0-beta.2All of my tests fail but the result is different from before.
Apart from this synthetic test, I also tested setting the branch tag to Test code5.11.1 [Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndSemVerTag1()
{
// Arrange
var config = new Config()
{
Branches = new Dictionary<string, BranchConfig>()
{
{ "main", new BranchConfig() { Tag = null } }
}
};
// Act
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3-beta.14";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(taggedVersion, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndSemVerTag2()
{
// Arrange
var config = TestConfigurationBuilder.New.WithTag("main", null).Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3-beta.14";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(taggedVersion, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndPrefixedSemVerTag1()
{
// Arrange
var config = new Config()
{
Branches = new Dictionary<string, BranchConfig>()
{
{ "main", new BranchConfig() { Tag = null } }
}
};
// Act
using var fixture = new EmptyRepositoryFixture();
const string semVer = "1.0.3-beta.14";
const string taggedVersion = $"v{semVer}";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(semVer, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndPrefixedSemVerTag2()
{
// Arrange
var config = TestConfigurationBuilder.New.WithTag("main", null).Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string semVer = "1.0.3-beta.14";
const string taggedVersion = $"v{semVer}";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(semVer, config);
} 5.12.0Same test code as with 5.11.1. 6.0.0-beta.2I had to modify the tests for 6.0.0-beta.2 as [Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndSemVerTag1()
{
// Arrange
var config = GitFlowConfigurationBuilder.New
.WithBranch("main", builder => builder.WithLabel(null))
.Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3-beta.14";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(taggedVersion, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndSemVerTag2()
{
// Arrange
var config = GitHubFlowConfigurationBuilder.New
.WithBranch("main", builder => builder.WithLabel(null))
.Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3-beta.14";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(taggedVersion, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndPrefixedSemVerTag1()
{
// Arrange
var config = GitFlowConfigurationBuilder.New
.WithBranch("main", builder => builder.WithLabel(null))
.Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string semVer = "1.0.3-beta.14";
const string taggedVersion = $"v{semVer}";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(semVer, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndPrefixedSemVerTag2()
{
// Arrange
var config = GitHubFlowConfigurationBuilder.New
.WithBranch("main", builder => builder.WithLabel(null))
.Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string semVer = "1.0.3-beta.14";
const string taggedVersion = $"v{semVer}";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(semVer, config);
} Failing test results5.12.0Result 1
Result 2
Result 3
Result 4
6.0.0-beta.2Result 1
Result 2
Result 3
Result 4
|
You need to set the fallback configuration of the label property to null as well on the root level. Please try the following: [Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndSemVerTag1()
{
// Arrange
var config = GitFlowConfigurationBuilder.New.WithLabel(null)
.WithBranch("main", builder => builder.WithLabel(null)
.WithVersioningMode(VersioningMode.ContinuousDelivery)
).Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3-beta.14";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(taggedVersion, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndSemVerTag2()
{
// Arrange
var config = GitHubFlowConfigurationBuilder.New.WithLabel(null)
.WithBranch("main", builder => builder.WithLabel(null)
.WithVersioningMode(VersioningMode.ContinuousDelivery)
).Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string taggedVersion = "1.0.3-beta.14";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(taggedVersion, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndPrefixedSemVerTag1()
{
// Arrange
var config = GitFlowConfigurationBuilder.New.WithLabel(null)
.WithBranch("main", builder => builder.WithLabel(null)
.WithVersioningMode(VersioningMode.ContinuousDelivery)
).Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string semVer = "1.0.3-beta.14";
const string taggedVersion = $"v{semVer}";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(semVer, config);
}
[Test]
public void GivenARepositoryWithSingleCommitAndSingleBranchAndPrefixedSemVerTag2()
{
// Arrange
var config = GitHubFlowConfigurationBuilder.New.WithLabel(null)
.WithBranch("main", builder => builder.WithLabel(null)
.WithVersioningMode(VersioningMode.ContinuousDelivery)
).Build();
// Act
using var fixture = new EmptyRepositoryFixture();
const string semVer = "1.0.3-beta.14";
const string taggedVersion = $"v{semVer}";
fixture.Repository.MakeATaggedCommit(taggedVersion);
fixture.Checkout(taggedVersion);
// Assert
fixture.AssertFullSemver(semVer, config);
} |
You need to forget the previous version and focus on the version 6.x because it's the next version with alot of changes. |
To understand the different between manually deployment, continues deployment, continues delivery and trunk based (main line) I would suggest you to read the following integration tests: /src/GitVersion.Core.Tests/IntegrationTests/ComparingTheBehaviorOfDifferentVersioningModes.cs In advance this might be informative:
|
Thank you @HHobeck, this was very helpful! |
🎉 This issue has been resolved in version 6.0.0-beta.3 🎉 Your GitReleaseManager bot 📦🚀 |
Describe the bug
For tagged commits, GitVersion 5.12.0 ignores PreReleaseTagWithDash and applies only MajorMinorPatch from tag.
For versions before that (e.g. GitVersion.MsBuild 5.11.1) the full SemVer from the tag would be used.
Expected Behavior
If i tag a git commit with or without the appropriate tag-prefix followed by a SemVer, GitVersion should use that SemVer.
Actual Behavior
If i tag a git commit with or without the appropriate tag-prefix followed by a SemVer, GitVersion uses only MajorMinorPatch and ignores any PreReleaseTagWithDash
Possible Fix
Steps to Reproduce
Test1 (without tag-prefix):
Result:
Test2 (with tag-prefix):
Result:
Context
Your Environment
The text was updated successfully, but these errors were encountered: