-
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
[Bug] GitVersion generated version number is not sequential but increases by "CommitsSinceVersionSource" on each commit #2795
Comments
GitVersion doesn't handle version numbers below |
I can confirm the same strange numbering for the numbers above We use The scenario with only calculating, i.e. without applying the tags (clean sequence, we like it):
The scenario with applying the tags (resulting in unexpected sequence, we don't like it):
Expected behaviorWhether we apply the tags or not, the sequence of the suffixes should be 1, 2, 3, 4, and so on. Actual BehaviorWhen the versions become applied as tags on the commits, the sequence of the suffixes is 1, 3, 6, 10, and so on. Our current workaroundWe have a PowerShell script that, if relevant, replaces the "wrong" suffix with the value of GitVersion in useUsing GitVersion |
Wonder if #3041 may be related ? |
Yes, you can read the reasoning behind the current behavior in #465. I suppose the best we could do on the short term is to document this more clearly. |
@asbjornu how about letting the users to customize the tag format themselves like letting them to use this tag pattern for example?
And the default could be something like this:
Or just have a config option to use |
I can tell you it is really hard to get into such issues and answer the question: Has it already been solved or not with the actual refactoring initiative!? Please provide integration tests any time. It makes life easier for the people who wants to make GitVersion stable. Thank you very much. Maybe it has been solved with #3438. Anyway if I take the following integration test I don't see your point: [Test]
public void ActualBehavior()
{
var configuration = GitFlowConfigurationBuilder.New.Build();
using var fixture = new EmptyRepositoryFixture("develop");
fixture.MakeATaggedCommit("1.0.39");
// ✅ succeeds as expected
fixture.AssertFullSemver("1.0.39", configuration);
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("1.1.0-alpha.1", configuration);
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("1.1.0-alpha.2", configuration);
fixture.ApplyTag("1.1.0-alpha.2");
// ✅ succeeds as expected
fixture.AssertFullSemver("1.1.0-alpha.2", configuration);
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("1.1.0-alpha.3", configuration);
} |
Hi. This report is perhaps not quite a bug report but rather a question which I could not find an answer for hence I am posting it here.
I have recently took over a project (a C# class library) which had a classic (ie. GUI based) Azure DevOps build pipeline which used "GitVersion@5" task in it.
The project uses GitFlow branching strategy (with default config ie. "git flow init -d").
NuGet package "GitVersion.MsBuild" (latest version available ie. at the time being "5.6.11") is used by the project as well to automatically stamp the built DLL files with the generated version information.
I have decided to move over to a YAML based pipeline and on that occasion I also wanted to move to latest version of GitVersion tasks (ie. "gitversion/setup@0" and "gitversion/execute@0") considering "GitVersion@5" is now obsolete.
The build pipeline produces some artifacts ie. NuGet packages.
The GitVersion tool uses a default config which was saved to "GitVersion.yml" file (see attachments in this issue).
My YAML build pipeline works as such however I am both a bit confused and curious why I am getting the version number that I get.
The case is that on each and every single commit I make to the development branch the version number calculated by GitVersion is incremented by exactly the amount indicated by GitVersion's own variable "CommitsSinceVersionSource".
For instance my current version is "0.1.0-ALPHA.483", then a single commit is done to development branch and the next build has version of "0.1.0-ALPHA.967".
See excerpt from file "GitVersionExecuteLog.txt"
Is this behavior standard and by-design or is it due to my current configuration of GitVersion?
What I would rather have is the version number to be incremented solely by one on each and every commit to the development branch so from "0.1.0-ALPHA.483" I would like to go to "0.1.0-ALPHA.484".
The current behavior results in version numbers (and the resulting build number and produced NuGet package artifacts) not being exactly sequential.
I am attaching the following files to the report
(postfixed with ".txt" as some of the file types are apparently not accepted by GitHub as attachments):
I am willing to provide more details/other config files if/when needed.
Any clarifications for the above described situation will be appreciated. Thanks in advance.
Expected Behavior
On each and every single commit I make to the development branch the version number should be incremented solely by one so from "0.1.0-ALPHA.483" I would like to go to "0.1.0-ALPHA.484".
Actual Behavior
On each and every single commit I make to the development branch the version number calculated by GitVersion is incremented by exactly the amount indicated by GitVersion's own variable "CommitsSinceVersionSource".
Possible Fix
N.A.
Steps to Reproduce
N.A.
Context
I would like to have an exact sequential version/build number which makes it easier to get and overview over what was built when.
Your Environment
AzureDevOps, vmImage: windows-2019
The text was updated successfully, but these errors were encountered: