GitVersion
GitVersion copied to clipboard
[Bug] Dynamic repo skips fetch when used by Azure/TFS pipelines resulting in incorrect version
Describe the bug When attempting to use the dynamic repository feature in our Azure pipelines, we found that the dynamic repository was not getting updated, and therefore the calculated version was incorrect. After the initial clone of the dynamic repository, the version remained constant.
Expected Behavior
For an Azure pipeline, GitVersion should skip the fetch of the target repository, as this is handled by the build steps, however it should still update the dynamic repository so that the correct version is calculated.
Actual Behavior
Fetching is skipped if GitVersion detects that an Azure pipeline is executing. This appears to be by design, but does not seem to account for the dynamic repo use case.
Possible Fix
Don't automatically skip the fetch for Azure pipelines if a dynamic repository is used.
Steps to Reproduce
- Create a build pipeline using TFS/Azure DevOps
- Add a GitVersion step with the following parameters to access the repo: /url <repoUrl> /u <userName> /p
/b $(Build.SourceBranch) /c $(Build.SourceVersion) - Execute a build (repo will clone to %temp%). Note the version.
- Make changes to the repo
- Execute another build
- Note that the calculated version is unchanged (FAIL)
Context
The dynamic repository feature of GitVersion preserves a copy of the repository in a temporary location, which results in significant time savings when used within an Azure Dev Ops pipeline, because GitVersion needs a deep clone to correctly calculate the version. Our team needs to utilize the dynamic repository feature due to network constraints and cloning time, however this does not work with Azure Dev Ops.
Your Environment
Azure Dev Ops
- Version Used:
- GitVersion: 5.5.0
Same here with gitversion 5.10.3, after the inital clone versioning doesn't increment anymore because the dynamic repo isn't updated. Any progress on this?
There is no progress on this since I don't use either AzDO nor dynamic repositories myself. I would recommend that you do a clone of the repository instead of using dynamic repositories. Support for dynamic repositories is going away in the future.
that's a shame :/ a simple checkout takes us around 3min to complete and that twice (PR, CI) every time. Shallow fetching and dynamic repos did speed that up by a lot. Atm we do a git fetch --all manually to update the dynamic repo
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.
This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions
There is no progress on this since I don't use either AzDO nor dynamic repositories myself. I would recommend that you do a clone of the repository instead of using dynamic repositories. Support for dynamic repositories is going away in the future.
We have finally integrated dynamic repository with MSBuild and we discover that DR is destined to disappear... It's a real shame because letting jenkins do a shallow clone instead of a full clone saves us many hours. @asbjornu What will it be replaced with?
Atm we do a git fetch --all manually to update the dynamic repo
@b3go How did you update the dynamic repository? How to get the dynamic repository folder path? Could you please share some details, I would be very grateful?
Atm we do a git fetch --all manually to update the dynamic repo
@b3go How did you update the dynamic repository? How to get the dynamic repository folder path? Could you please share some details, I would be very grateful?
We moved away from dynamic repos because of this. There was a lot of inconsistency in the versioning, I can not recommend using this broken feature.
To answer your question: I used a PowerShell Step, the dynamic repo folder name is the name of your repository, you get the temp path with $env:Temp. With Azure DevOps I had to enable that the system access token is passed to the jobs, so the git fetch step can access the repository with this token. This somehow seemed to work most of the time but we still sometimes got inconsistencies.
Because of that we ultimately split the repository, which was too big for a full checkout, into multiple smaller repositories and stoppes using dynamic repos. Which actually had a lot of benefits for our daily work.