-
Notifications
You must be signed in to change notification settings - Fork 652
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
[Fix/Feature] Set Hotfix as release branch by default #2346
[Fix/Feature] Set Hotfix as release branch by default #2346
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The implementation and added tests are great, I'm just torn about the change in functionality. There's quite a few tests that needed change to get this through, making me think we may have a breaking change on our hands here. 🤔
@@ -63,7 +63,7 @@ public void CanTakeVersionFromHotfixesBranch() | |||
|
|||
// create hotfix branch | |||
Commands.Checkout(fixture.Repository, fixture.Repository.CreateBranch("hotfixes/1.1.1")); | |||
fixture.AssertFullSemver("1.1.0"); // We are still on a tagged commit | |||
fixture.AssertFullSemver("1.1.1-beta.1+0"); // Version in branch name takes precedence over Tag if it's greater |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I'm torn and don't really know what to think here. My knee-jerk reaction is that tags should always take precedence over everything else, but then again the entire point with versioned hotfix
and release
branches is to affect the version number.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense that even if we are on tagged commit on release branch, greater version wins between tag and branch name.
As at first Release branch for X version is just created and optionally some Hotfixes are provided.
But the whole release process on such branch may end with no additional commits.
In the end I just documented what I experienced when I had to update this test case scenario.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I agree with 1.1.1-beta.1+0 as a result for this scenario. If you think about it: You are going to create a hotfix branch from the current tagged version from main (RTM version). Thus your plan is to fix something maybe your CI pipeline has changes or what ever. The point is: This version number gives you an indication that something different happens comparing to the previous version 1.1.0 but no code changes are involved (beta.1+0). ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you have changed from x64 to x32 or used the self-contained flag in dotnet because on your production environment dotnet is not installed.
[TestCase("Merge branch 'feature-4.6.6' into support-4.6", true)] | ||
[TestCase("Merge branch 'Feature-10.10.50'", true)] | ||
[TestCase("Merge branch 'Features-10.10.50'", true)] | ||
[TestCase("Merge branch 'fix/10.10.50' into hotfix-10.0.0", true)] | ||
[TestCase("Merge branch 'feature/0.1.5'", true)] | ||
[TestCase("Merge branch 'feature-4.2.2' into support-4.2", true)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume these test cases broke when the branches were named hotfix*
and not feature*
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, every test case scenario which is changed in this PR was failing due to the change.
Yes, my first thought after running the tests were the same. I don't really know what to think of it as well. |
I think we'll target this for version 6, since it introduces breaking changes. |
|
I have taken a look into the source code and see that we have two IVersionStrategy implementations in the current version 5.10.3 of GitVersion which are using the IsReleaseBranch property to determine the version. It is on the one hand the VersionInBranchNameVersionStrategy and on the other hand the MergeMessageVersionStrategy class. So far so good. I'm just wondering why we are not separating this two aspects and make it configurable. For instance we can introduce a new property with the name VersionInBranchNamePattern="{Major}.{Minor}.{Patch}^" or VersionInBranchNamePattern="{Major}.{Minor}^" to specify explicit how the version can be determined. This has the following advantages:
|
Sure, that's even something we could introduce in v5 since it's a new configuration property. |
Hi @dramdrung. Please rebase your PR with the main branch and give me feedback when you are done. |
Has been resolved with PR #2336 without the need of specifing IsRelease to true for Hotfix branches. |
Description
By the definition in the documentation it seems that the Hotfix branches should by default have is-release-branch set to true.
Discussion can be followed at #2336.
This change not only modifies how version in Hotfix branch name is treated but as well how merge messages with such branches are handled.
Related Issue
#2336
Motivation and Context
Version in Hotfix branch names should be taken into consideration when resolving base version by default.
This change enables this behavior with default configuration.
How Has This Been Tested?
The branch was build locally and tested manually.
is-release-branch: true
Additionally there were added a few tests and current test scenarios were adjusted to the change.
Checklist: