Description
Context
We are trying to merge a solution that build nuget packages from one repo to another.
This repo already has a tagging structure for other nuget packages. we do not want to mix up these tags.
The most obvious thing for us, seems to be able to have a filter, in which we can state a prefix or regex, so that a certain git version task, will only analyze the ones having this prefix or regex.
Other issue that we see: the analysis of the already existing tags takes about 10 minutes, because we have a lot of them. having the filter possibility, just as command git tag -l "prefix*" has, would make the analysis a lot quicker. Or is there any other way?
Solution that we think would help:
specify a prefix, that is used both for tagging and for filtering during the analysis to specify which git tag will have to be added.
Or am I missing a feature that already does this?
Activity
brendankowitz commentedon Nov 14, 2020
I'm looking for something similar, it looks like something like this might exist already:
https://github.com/GitTools/GitVersion/blob/master/src/GitVersionCore/Model/Configuration/Config.cs#L41
tag-prefix: prefixRegex
dagophil commentedon Dec 3, 2020
You can put a
GitVersion.yml
into each project folder and usetag-prefix: '...'
. For example, this folder structure should work well:If you now run GitVersion inside the FooLib directory, it only considers
Foo-v*
tags and if you run it inside the BarLib directory, it only considersBar-v*
tags.However, you will run into problems if you checkout tagged commits for one package and try to get the version of the other package. For example, if you checkout
Foo-v1.2.3
, GitVersion cannot compute the version of BarLib.asbjornu commentedon Dec 3, 2020
GitVersion operates on the basic principle of having one versionable entity per repository. Monorepo and similar methodologies is explicitly not supported. If you manage to get GitVersion to work in your environment regardless, please consider that a hack and not something you can be confident GitVersion will support in the future.
stale commentedon Mar 19, 2021
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.
sebastienwarin commentedon Apr 2, 2021
Hello there,
FYI, I have forked GitVersion in Oct,2019 (based on the version 4.0), to add a new
IVersionFilter
called "Path filters" : https://github.com/sebastienwarin/GitVersion/commits/feature/pathfilters to include or exclude commit based on the file paths.To use it, you have just to add in the GitVersion files the new section "paths" to include (or exclude) paths under the section "ignore" :
When GitVersion calculate the next version, the path filter check each commit to ignore those that not modifiy any files within the list.
You can add paths to "include" or to "exclude".
I use this forked version since Oct, 2019 for all my projects, It works like a charm. I also suggest to use this with the "tag-prefix".
Take an example : you have 1 git repository with 2 projects/directories (to make it simple) :
You create one GitVersion config file (.yml) per project :
MyLib.yml :
MyWebApp.yml :
Then :
GitVersion.exe /config MyLib.yml
: to generate the version for the class lib projectGitVersion.exe /config MyWebApp.yml
: to generate the version the web app projectIn the build pipelines, tag
MyLib/X.X.X
andMyWebApp/X.X.X
after each build.Enjoy!
asbjornu commentedon Apr 6, 2021
That looks interesting, @sebastienwarin. If you are able to rebase those changes on
HEAD
ofmain
, add support for file globbing to the path specs, tests for the functionality and accompanying documentation, I'd welcome a pull request adding this functionality to GitVersion.stale commentedon Jul 9, 2021
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.
marc-mueller commentedon Sep 24, 2021
The described feature looks very good and is actually exactly what we need. Is there any ETA when a PR would be ready?
asbjornu commentedon Sep 24, 2021
@marc-mueller, someone would have to take @sebastienwarin's code, rebase it against
GitTools:main
and submit a PR.11 remaining items
github-actions commentedon Sep 29, 2023
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.
smietanka commentedon Feb 7, 2025
@sebastienwarin wow, really cool feature that we would like to have. Is there any plan to manage this feature into GitVersion?