-
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
[Bug] 5.6.5 Not finding Tag in master repo #2590
Comments
I don't know if it's related, but I'm also getting strange behavior. GitVersion 5.6.4 Behavior
GitVersion 5.6.6 Behavior
GitVersion-5.6.5.diagnostic.txt |
@gep13 might be related to your fix |
@Eneuman do you have a link to the project where this is occuring? |
It's a private project but you can repo it this way: On Azure Dev Ops create a git repo (branch name master). Use default settings and run a build. |
Would be great to have a fixture test that reproduce the issue |
I can also verify that going back to version 5.6.4 solves the problem so something have definitely changed. |
@Eneuman are you doing anything "extra" to download additional portions of the git repository? Or how is Azure DevOps performing the checkout of the git repostiory? Having a complete Azure DevOps yml file for what you are doing would certainly help in figuring out the underlying issue. A change was made in 5.6.5 to specifically address an issue where the incorrect version number was being asserted on a tagged commit when running on GitHub Actions, so it is possible that this change has had a negative impact when running on Azure DevOps, but in order to figure this out, we would need to complete set of steps to reproduce the problem. |
@gep13 The yml file is very basic:
and the config file:
My gut says this has something to do with the change from "master" to "main" (I diffed 5.6.4 with 5.6.6). |
@Eneuman again to my point, in order to figure this out, we need complete details on how your repository is set up, so that we can start to investigate what is going on. The ideal here, if possible, would be for you to setup a public repository, in a way that replicates the problem, and that way, we can start to attempt to figure out what is going on. Is this something that you can help with? |
@gep13 sure I can fix that. I have setup a public repo at https://caresoftab.visualstudio.com/Test/_git/Test
gitversion.exe /url https://caresoftab.visualstudio.com/Test/_git/Test /b master /nocache
A quick analysis showed me that LibGit2Sharp tagcollection only contains the 3.0.0 tag. |
thank you for the sample, we'll have a look |
I ran the
|
I used version 5.6.6, locally |
I added a new file and another tag 5.0.0 Can you try again now? |
I ran again same command
|
So it does not see the 5.0.0 tag |
Yeah, that's the bug. Should'nt you have revived 5.0.1? |
Try git tag |
git tag returns
|
I think I know the reason. When you run giversion in a dynamic way (by specifying url and branch) it clones the repository to temp location (C:\Users{user}\AppData\Local\Temp{repo}). That means when you run the same command the second time it will use the same path, and if you add new tags on the remote origin, and run the command it will not update your local copy in the temp folder, it will use the outdated repository. After I deleted the temp folder and ran the command again, it returned the correct version |
Can the same thing happen when running in a pipeline using the gitversion task? |
If that is on premise agent I guess it might have the same issue |
Is there a argument that will run git fetch on a existing dynamic repo when running gitversion? |
you can run the git fetch command, but I would suggest not to use dynamic repo, as we plan to remove the support for it |
I tried again (in my private project) using the task in the yaml pipeline but it still calculates the wrong version. Init task:
Execute:
Running What do I need to do to debug the gitversion code against a local repo? |
|
Checking the log it looks okey I think:
and if I switch back to version 5.6.4 it works. |
I can see now that this line is logged when it it working, but not when the version gets calculated wrong.
so maby it's not finding my remote repo and thats why it doesn't find my tags. |
As I said before, I don't know if I'm facing the same problem, but it seems so...
|
Thanks for the steps @Lukkian we'll have a look |
@Lukkian I can confirm the issue. Need to investigate |
Could this be related to the move from |
Yes @asbjornu, after renaming The curious thing is that the configuration file has the instruction below
FYI: I did the tests only locally and did not push, so if you want to test, the remote repo has not been changed. |
@Lukkian thanks for the update. I will check what missing piece was not updated. Please do not change the remote |
Hey @arturcic, sorry to bother you... |
This issues has forced us to leave gitversion on 5.6.4 for all of our projects that utilise it. I can only assume that it doesn't impact everyone, or it would have been given a higher priority. Does anyone know what the root cause is? |
That's unfortunate. 😞
Correct.
No, but @Lukkian has provided a reproduction in #2590 (comment). What's required is for someone with proper incentive and time to execute a local source build of GitVersion against that repository and through breakpoints or other debugging figure out where and what's causing the exception. Then the bug needs to be fixed and submitted as a pull request. |
Hello! New user of GitVersion here and it seems like I also stumbled into this issue. I understand this is not a high priority, but I just want to leave another example repository with the steps to reproduce the problem. Using #2590 (comment) as a template:
The same behavior happens with version 5.7.0. I'll continue using version 5.6.4 for now. |
I compiled GitVersion from source and run a git bisect on it between versions 5.6.4 and 5.6.5. The bug appears to have been introduced in commit 8b653e9:
|
Took a quick look at the code and found the following. Updating line 53 from TrackReleaseBranchesVersionStrategy.cs (MainTagsVersions method) from var main = this.repositoryStore.FindBranch(Config.MainBranchKey); to var main = this.repositoryStore.FindBranch(Config.MainBranchKey);
if (main == null)
{
// for compatibility reason try to find master if main cannot be found
main = this.repositoryStore.FindBranch(Config.MasterBranchKey);
} solves the issue. Now, I'm not familiar with the codebase at all and have no idea of any side effects, but it keeps all existing tests passing. |
@lbras, fantastic debugging! If changing from |
We are looking to replace the deprecated GitVersion with the latest GitTools task in Azure Pipelines but we also hit the versioning issue as our repo is using master naming @asbjornu @arturcic Is it safe to explicitly target 5.6.4 (no risk of depreciation)? Is there any plan to fix this in 5.x? or more likely to be addressed in 6.x? |
Already published versions of the GitTools task should continue to work, @superjulius. If they are removed, that's beyond our control and up to Microsoft, if anything. There is no plan to fix this beyond us accepting a pull request that fixes it. As none of the maintainers seem to have this issue, we have no incentive to work on it, unfortunately. |
Fall back to `master` if `main` is missing. Fixes GitToolsGH-2590.
Fall back to `master` if `main` is missing. Fixes GitToolsGH-2590.
Fall back to `master` if `main` is missing. Fixes GitToolsGH-2590.
Fall back to `master` if `main` is missing
🎉 This issue has been resolved in version 5.10.0 🎉 Your GitReleaseManager bot 📦🚀 |
My master branch has a Tag 6.1.0.
It get correctly picked up by version 5.6.4
but in version 5.6.5 it is not found:
The text was updated successfully, but these errors were encountered: