The patch version is being incremented , even if the increment tag is set to none #3430
-
Describe the bug Expected BehaviorTo patch version should not be incremented , if the increment attribute in gitversion.yml is set to None under the specified branch
Actual BehaviorThe patch version is being incremented ContextWe are working on hotfixes on release branch ( refer the below sc for the graph) -We create a release tag(on Gitlab using release-cli) only on master/main branch based on semversion ( gitversion tool) issue is when we start having bugs on release branches
i have taught of below way of tagging. Your EnvironmentGitlab : 14.10.5 |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
It's quite difficult for me to follow your thoughts. The default supported workflow in GitVersion is the GitHub workflow (see https://gitversion.net/docs/learn/branching-strategies/gitflow/examples). If you want to customize the workflow then you can do this and overwrite the configuration file. Are you sure this is a bug or do you want to know how you are going to setup GitVersion properly? If it is a bug please try to simplify your scenario and create a integration test like: [Test]
public void Just_A_Test()
{
// * 2373a87 58 minutes ago (HEAD -> main)
var configuration = GitFlowConfigurationBuilder.New
.WithVersioningMode(VersioningMode.ContinuousDeployment)
.WithBranch("main", builder => builder
.WithLabel("ci")
.WithVersioningMode(VersioningMode.ContinuousDeployment)
)
.Build();
using var fixture = new EmptyRepositoryFixture();
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("0.0.1-ci.1", configuration);
// or
// ❌ expected: 0.0.1-ci.5"
fixture.AssertFullSemver("0.0.1-ci.1", configuration);
fixture.Repository.DumpGraph();
} Please use the latest version in the main branch which contains the latest development initiatives. Thank you. |
Beta Was this translation helpful? Give feedback.
-
I have already setup the gitversion, but based on the gitversion.yml setting, the hotfix branch should not increment. but it is Secondly, is it possible to have a dynamic tag ? example i have made the tag as hotfix. Can it prefix with a dynamic variable say commitid ? hotfix.commitid
|
Beta Was this translation helpful? Give feedback.
-
You can think of that the increment strategy is used to determine the next version. Therefor the tool calculates:
Using the Anyway if you take this integration test you see that the [TestCase(IncrementStrategy.None, "1.1.0-just_a_label.1+1")]
[TestCase(IncrementStrategy.Patch, "1.1.1-just_a_label.1+1")]
public void Just_A_Test(IncrementStrategy incrementStrategy, string expectedVersion)
{
// * 5245f56 56 minutes ago (HEAD -> main)
// * 5b3b55d 58 minutes ago (tag: 1.1.0)
var configuration = GitFlowConfigurationBuilder.New
.WithBranch("main", builder => builder
.WithLabel("just_a_label")
.WithIncrement(incrementStrategy)
).Build();
using var fixture = new EmptyRepositoryFixture("main");
fixture.MakeATaggedCommit("1.1.0");
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver(expectedVersion, configuration);
fixture.Repository.DumpGraph();
} |
Beta Was this translation helpful? Give feedback.
@HHobeck
Thanks for the help, We did the below change and it worked for us.
git fetch origin $CI_COMMIT_SHA:$CHECKOUT_BRANCH
git checkout $CHECKOUT_BRANCH
/tools/dotnet-gitversion /output buildserver /c $CI_COMMIT_SHA /nonormalize $VERBOSITYSETTING \