gitazure-devopsyamlcontinuous-integrationgitversion

GitVersion doesn't cause error in Azure Devops Pipeline


I'm creating an Azure Devops pipeline to build a small library. As it's a tiny project, I don't use branches to develop functionalities. I work inside the master branch.

Here is the beginning of my azure-pipelines.yml :

trigger:
  branches:
    include:
      - master

pool:
  vmImage: 'windows-latest'

variables:
  # Numéro de version du package NuGet.
  # Exemple : Pour la version  1.3.x => majorVersion=1, minorVersion=3
  # GitVersion calculera le nméro de patch.
  majorVersion: 1
  minorVersion: 0
  buildConfiguration: 'Release'

steps:
- checkout: self
  displayName: 'Checkout du dépôt'
  fetchDepth: 0

- task: gitversion/setup@3.0.0
  displayName: 'Installation de GitVersion'
  inputs:
    versionSpec: '6.x'

- task: gitversion/execute@3.0.0
  displayName: 'Calcul du numéro de version'
  inputs:
    useConfigFile: true
    configFilePath: 'XafUtils/GitVersion.yml'
    overrideConfig: |
        next-version=$(majorVersion).$(minorVersion).0

Here is the content of the GitVersion.yml file :

mode: ContinuousDeployment
branches:
  master:
    regex: ^master$
    tag: ''
    increment: Patch
ignore:
  sha: []

And this is the log for the gitversion/execute task :

2024-09-18T11:46:03.1000103Z ##[debug]Evaluating condition for step: 'Calcul du numéro de version'
2024-09-18T11:46:03.1001227Z ##[debug]Evaluating: SucceededNode()
2024-09-18T11:46:03.1001505Z ##[debug]Evaluating SucceededNode:
2024-09-18T11:46:03.1002278Z ##[debug]=> True
2024-09-18T11:46:03.1002749Z ##[debug]Result: True
2024-09-18T11:46:03.1003072Z ##[section]Starting: Calcul du numéro de version
2024-09-18T11:46:03.1010647Z ==============================================================================
2024-09-18T11:46:03.1010813Z Task         : Execute GitVersion Task
2024-09-18T11:46:03.1010914Z Description  : Easy Semantic Versioning (https://semver.org) for projects using Git
2024-09-18T11:46:03.1011037Z Version      : 3.0.0
2024-09-18T11:46:03.1011106Z Author       : GitTools Contributors
2024-09-18T11:46:03.1011208Z Help         : See the [documentation](https://gitversion.net/docs/) for help
2024-09-18T11:46:03.1011380Z ==============================================================================
2024-09-18T11:46:03.1106405Z ##[debug]Resource Utilization warnings is disabled, switch "DISABLE_RESOURCE_UTILIZATION_WARNINGS" variable to "false" if you want to enable it
2024-09-18T11:46:03.1632441Z ##[debug]Using node path: C:\agents\3.243.1\externals\node20_1\bin\node.exe
2024-09-18T11:46:03.2837413Z Running on: 'Azure Pipelines'
2024-09-18T11:46:03.2840123Z ##[debug]Disabling telemetry
2024-09-18T11:46:03.2840656Z Disable Telemetry
2024-09-18T11:46:03.2845926Z ##[debug]Processed: ##vso[task.setvariable variable=DOTNET_CLI_TELEMETRY_OPTOUT;isOutput=false;issecret=false;]true
2024-09-18T11:46:03.2846901Z ##[debug]Processed: ##vso[task.setvariable variable=DOTNET_NOLOGO;isOutput=false;issecret=false;]true
2024-09-18T11:46:03.2847461Z Executing GitVersion
2024-09-18T11:46:03.2848037Z ##[debug]getVariable - INPUT_TARGETPATH: 
2024-09-18T11:46:03.2848667Z ##[debug]getVariable - INPUT_DISABLECACHE: false
2024-09-18T11:46:03.2849159Z ##[debug]getVariable - INPUT_DISABLENORMALIZATION: false
2024-09-18T11:46:03.2849677Z ##[debug]getVariable - INPUT_DISABLESHALLOWCLONECHECK: false
2024-09-18T11:46:03.2850338Z ##[debug]getVariable - INPUT_USECONFIGFILE: true
2024-09-18T11:46:03.2850867Z ##[debug]getVariable - INPUT_CONFIGFILEPATH: D:\a\1\s\XafUtils\GitVersion.yml
2024-09-18T11:46:03.2851402Z ##[debug]getVariable - INPUT_OVERRIDECONFIG: next-version=1.0.0
2024-09-18T11:46:03.2852007Z ##[debug]getVariable - INPUT_UPDATEASSEMBLYINFO: false
2024-09-18T11:46:03.2852864Z ##[debug]getVariable - INPUT_UPDATEASSEMBLYINFOFILENAME: 
2024-09-18T11:46:03.2853374Z ##[debug]getVariable - BUILD_SOURCESDIRECTORY: D:\a\1\s
2024-09-18T11:46:03.2853955Z Command: git -C D:/a/1/s rev-parse --is-shallow-repository
2024-09-18T11:46:03.3495320Z ##[debug]getVariable - INPUT_CONFIGFILEPATH: D:\a\1\s\XafUtils\GitVersion.yml
2024-09-18T11:46:03.3496181Z ##[debug]getVariable - BUILD_SOURCESDIRECTORY: D:\a\1\s
2024-09-18T11:46:03.3509373Z ##[debug]getVariable - GITVERSION_PATH: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2
2024-09-18T11:46:03.3512070Z Command: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s /output json /output buildserver /config D:\a\1\s\XafUtils\GitVersion.yml /overrideconfig next-version=1.0.0
2024-09-18T11:46:04.3917404Z ##[debug]GitVersion failed
2024-09-18T11:46:04.3918383Z ##[debug]task result: Failed
2024-09-18T11:46:04.3968025Z ##[error]Command failed: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s /output json /output buildserver /config D:\a\1\s\XafUtils\GitVersion.yml /overrideconfig next-version=1.0.0

2024-09-18T11:46:04.3977288Z ##[debug]Processed: ##vso[task.issue type=error;]Command failed: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s /output json /output buildserver /config D:\a\1\s\XafUtils\GitVersion.yml /overrideconfig next-version=1.0.0

2024-09-18T11:46:04.3982049Z ##[debug]Processed: ##vso[task.complete result=Failed;done=true;]Command failed: C:\hostedtoolcache\windows\GitVersion.Tool\6.0.2\dotnet-gitversion.exe D:/a/1/s /output json /output buildserver /config D:\a\1\s\XafUtils\GitVersion.yml /overrideconfig next-version=1.0.0

2024-09-18T11:46:04.4042132Z ##[section]Finishing: Calcul du numéro de version

As you can see there is nothing explaining the error. I'm lost here ...

If any of you has an idea, I will listen carefully :)

Many thanks in advance, Julien


Solution

  • I can reproduce the issue when using your azure-pipelines.yml and GitVersion.yml file. It seems that the git with 6.x version is incompatible with gitversion/execute@3 or there are other problems.

    Changing the git version to 5.x in task gitversion/setup@3 can resolve the issue.

    - task: gitversion/setup@3
      displayName: 'Installation de GitVersion'
      inputs:
        versionSpec: '5.x'
    

    Result:

    enter image description here