-
Notifications
You must be signed in to change notification settings - Fork 653
[Bug] Tag not used as version when running in GitLab Pipeline (Mainline) #2928
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
Comments
This seems like a duplicate of #2301? |
Hmm, I am not quite sure. In my case GitVersion runs just fine, without any errors and generates also the version number. It just bumps the patch version unexpected by one. For me it seems because, for some reason, when running in the GitLab pipeline it detects a forward merge:
Which it does not when running locally (with the exacte same state of the repo):
(See also the full logs above) Maybe it is because of some "magic" of how gitlab clones the repo but as I have configured the dynamic repo it should probably not matter. I had even disabled the git clone form GitLab but the behavior of GitVersion kept the same. |
Sounds like the effect of repository normalization, @J0F3. Are you able to turn that off when running on GitLab? If so, how does that affect the version calculation? |
Yes that what I tough too. But I set
But this does not changed anything so I disabled the Git cloning in the GitLab pipeline completely and configured dynamic repositories for GitVersion. If I understand it correctly the normalisation of GitLab should then no be a problem as GitVersion clones the repository itself. But the problem kept the same. |
It may be a little side topic: the docs say Git Flow and Github Flow is supported, is GitLab Flow not supported? |
@J0F3, I see. Does passing
I've never heard about GitLab Flow before today, but I think it should be possible to configure GitVersion to work with it. |
@asbjornu would it be possible to create an improvement feature based on this suggestion (make GirVersion compatible with GitLab Flow)? |
I would start with figuring out a configuration that allows GitVersion to properly version GitLab Flow and then move from there. If it's possible to solve this through configuration, we can always document that configuration on gitversion.net. If not, a PR with the required code changes and tests would be welcome, @GolamRashed. |
I have the same issue as @J0F3 and tried -nonormalize as suggested by @asbjornu. It doesn't change anything. For me it looks like gitlab creates a branch refs/heads/tagname to run the pipeline on. There it detects a 'forward merge' and is 'rewinding mainline to previous commit'. As a result it finds one commit and increments the patch number. |
That is interesting and relevant information, @svenmoon. Perhaps the oddity in build server testing discovered in #3033 (review) may be that not only GitHub Actions is having this problem? Ending up with a branch called |
🎉 This issue has been resolved in version 5.10.0 🎉 Your GitReleaseManager bot 📦🚀 |
Describe the bug
I am experience a very strange behavior while using GitVersion with GitLab. When I tag the last commit of the repo GitVersion always takes the version of the tag and bumps patch version to 1. E.g when the Git Tag is '2.0.0' the version calculated by GitVersion is then '2.0.1'
Not sure what exactly happens here but when I clone the repo locally and run GitVersion locally it works as expected and use the tag as the version.
I also already disabled the git cloning in GitLab an configured dynamic repositories like it is done in this example:
https://gitlab.com/guided-explorations/devops-patterns/utterly-automated-versioning/-/blob/develop/gitversion-ci-cd-plugin-extension.gitlab-ci.yml
But the behavior did not change.
So while I am not sure if this is really a bug I am still apricate any inputs how to fix that.
Thx!
Expected Behavior
When the last commit in the repos is tagged with e.g. '2.0.0' the calculated version of GitVersion is '2.0.0'.
Actual Behavior
Instead '2.0.0' the calculated version is '2.0.1'. (Always one patch version higher than what in the git tag is set).
Possible Fix
?
Steps to Reproduce
dotnet-gitversion -overrideconfig mode=Mainline -output buildserver -url $CI_REPOSITORY_URL -u gitlab-ci-token -p $CI_JOB_TOKEN -b $CI_COMMIT_REF_NAME -c $CI_COMMIT_SHA -dynamicRepoLocation $CI_PROJECT_DIR
But when cloning the Repository locally and running
dotnet-gitversion -overrideconfig mode=Mainline -diag
against the local clone it calculates the version '2.0.0' as expected:Context
Your Environment
dotnet tool install --global GitVersion.Tool --version 5.*
The text was updated successfully, but these errors were encountered: