GitVersion
GitVersion copied to clipboard
[Docs] Azure Devops - Fetch Depth
For Azure devops build pipelines created later than a certain date, they started doing shallow clone's and subsequently this means the following gitversion AzDO
tasks fail.
- task: gitversion/setup@0
displayName: Install GitVersion
inputs:
versionSpec: '5.11.1'
- task: gitversion/execute@0
displayName: Determine Version
inputs:
There is a gitversion docs page for configuring the different build servers but nothing about this for azure devops that I could see.
The important piece of info is here: https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines#shallow-fetch
It basically boils down to this, you need to add an intial checkout
task to your yaml pipeline to control checkout behaviour and explicit set fetch depth to 0 (which means it won't do shallow fetch).
steps:
# this is rewquired for gitversion
- checkout: self
fetchDepth: 0
clean: true