Open
Description
Prerequisites
- I have written a descriptive issue title
- I have searched issues to ensure it has not already been reported
GitVersion package
AzureDevops task
GitVersion version
6.0.5
Operating system
Linux
What are you seeing?
I recently updated to the new GitTools tasks from UseGitVersion@5
along with new config and have had no issues building code for approximately a week. When I opened a pull request today, the automatic build triggered by our PR requirement failed stating that GitVersion is undefined. Looking at the logs, I can see that the checkout process is working as expected with all our most recent commits to the repository and we automatically tag every commit into master/main branches so history shouldn't be an issue. Any suggestions/workarounds would be appreciated.
What is expected?
Pull request builds should behave the same way when using GitTools in Azure DevOps.
Steps to Reproduce
# azure-pipelines.yaml job template
parameters:
- name: DependsOn
type: object
default: []
jobs:
- job: AdoBuildNumber
dependsOn: ${{ parameters.DependsOn }}
pool:
name: 'ubuntu-latest'
steps:
- checkout: self
fetchDepth: 0
- task: gitversion/[email protected]
displayName: Install GitVersion
inputs:
versionSpec: '6.0.x'
- task: gitversion/[email protected]
displayName: Determine Version
name: git_version # variable to use in subsequent steps
inputs:
overrideConfig: |
update-build-number=false
- pwsh: |
$build_number = "$(git_version.majorMinorPatch)-$(git_version.preReleaseLabel)-$(git_version.buildMetaData)"
echo "##vso[build.updatebuildnumber]$($build_number)"
displayName: 'Set Build Number using GitVersion'
# GitVersion.yaml
workflow: GitHubFlow/v1
strategies:
- Mainline
assembly-versioning-format: '{MajorMinorPatch}-{PreReleaseLabel}-{BuildMetaData}'
RepositoryFixture Test
No response
Output log or link to your CI build (if appropriate).
Starting: Determine Version
==============================================================================
Task : Execute GitVersion Task
Description : Easy Semantic Versioning (https://semver.org) for projects using Git
Version : 3.1.1
Author : GitTools Contributors
Help : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
Command: git -C /agent/_work/15/s rev-parse --is-shallow-repository
Command: /opt/hostedtoolcache/GitVersion.Tool/6.0.5/dotnet-gitversion /agent/_work/15/s /output json /l console /overrideconfig update-build-number=false
##[error]GitVersion output is not valid JSON
dotnet-gitversion Output:
-------------------
undefined
-------------------
undefined
Finishing: Determine Version