-
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
System.InvalidOperationException - ignore commits-before in GitVersion.yml #2122
Comments
Sorry, but GitVersion is not designed to yield different version numbers on different paths in a single repository. Simply put: GitVersion does not support Monorepo. The only way to control how a specific part of a repo is versioned is to split it out into its own Git repository. |
Hi @asbjornu Thanks for your response. Got a few follow-up questions. The documentation seems to imply we can version folder differently or have we misunderstood it?
It, implying And the way we are currently trying to do, should it not work by ignoring all commits before a certain date and version then on? |
This flexibility stems more from the ability to have Now, I think it should be possible for GitVersion to ignore this exact exception and continue with a fallback strategy and only fail if no strategies yields a version number. So if you are able to figure out how to untie that knot in the codebase, we would warmly welcome a PR. 😃 🙏 |
Well played @asbjornu 😆 Will see what I can do. Bit busy so cannot promise anytime soon. If nobody picks this up will look to revisit. Thanks |
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. Thank you for your contributions. |
That's my thinking as well, especially when you can see in the logs: |
Exactly! |
I've started looking into this issue and so far I can't replicate it with integration test but I can replicate it when I run GitVersion tool on newly created git repo. [Test]
public void ShouldFallbackToDefaultVersionWhenAllCommitsAreSkipped2()
{
var config = new Config
{
VersioningMode = GitVersion.VersionCalculation.VersioningMode.Mainline,
Ignore = new IgnoreConfig
{
Before = DateTimeOffset.Now.AddHours(100)
}
};
using var fixture = new EmptyRepositoryFixture();
fixture.Repository.MakeACommit();
fixture.AssertFullSemver("0.1.0+0", config);
} I have noticed that configuration I pass to Am I missing something obvious? EDIT: |
Looks like the issue is caused by VersionFilters which apply to all version strategies. I think |
Yes, agreed. Would you care to submit a pull request implementing this change? I just hope we don't have (many) tests depending on this. I don't think we do. |
I am working on the PR. I haven't found any integration tests for ignore configuration, probably that's why there are some bugs there. |
If you're wandering into Configuration-land, please keep an eye on #2300 which refactors it quite a bit. You may want to put off your PR until after it is merged if you're going to touch many of the same files, @DamianKedzior. |
@asbjornu I am aware of #2300 and I am happy to see it coming. I will keep my modifications to minimum in Configuration classes, so far I think I have only 2 lines addition. If #2300 will be merged than I will just back-merge and refactor the code. |
@DamianKedzior, #2300 is now merged. |
@asbjornu , I have opened the PR which fixes this issue but I have discovered other issues related to
Should I open separate issue with failing test? I was hoping to fix it within this issue but it looks like more complex issue. |
@DamianKedzior, hm. I'm not sure I understand what you're expecting and I'm not sure what's the best way to deal with this and what exactly
I think alternative 2 is the current implementation and as you can see by the generated version number |
Exactly, looks like (2) is current behavior but it still counts the commits. I am not sure if this was intended or a bug. Probably it's not a big deal but my understanding of |
I think this can be argued one way or another. I don't know the intention behind the original design, but I think it's reasonable that only version sources are ignored and not all commits for counting. In other words; |
Definitely better documentation would help better understanding how this feature works. |
🎉 This issue has been resolved in version 5.3.6 🎉 Your GitReleaseManager bot 📦🚀 |
There are multiple folders in our repository with separate release cadence and different versions.
Adding a new folder, we would like it versioned starting from 0.0.0 hence we want it not to count the commits before the date it got added. The GitVersion.yml looks as below:
Running gitversion.exe or dotnet-gitversion.exe in the folder throws an exception:
It seems to works without the section below to get a version.
But it gets 2.0.235 or so which is not how we want the contents of that folder versioned.
Versions tried with:
gitversion /version
5.1.3+Branch.master.Sha.bef8ebc0b62b3ddd0cdafe09b66d68bbfcaf90d5
dotnet-gitversion.exe /version
5.1.3+Branch.master.Sha.bef8ebc0b62b3ddd0cdafe09b66d68bbfcaf90d5
Also tried with:
dotnet-gitversion.exe /version
5.1.4-beta.1+172.Branch.master.Sha.c602fbb304b8f39aecb39656f921c5898414283d
Are we doing something wrong?
Can anyone guide us please.
The text was updated successfully, but these errors were encountered: