Closed johlju closed 1 year ago
@johlju, Is it the reasons why I'm having this issue when deploying the pipeline (it was my first attempt on this project today)
Starting: Calculate ModuleVersion (GitVersion)
==============================================================================
Task : PowerShell
Description : Run a PowerShell script on Linux, macOS, or Windows
Version : 2.212.0
Author : Microsoft Corporation
Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/powershell
==============================================================================
Generating script.
========================== Starting Command Output ===========================
/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command . '/home/vsts/work/_temp/0f944673-58bd-4ea6-8125-ce009ad98b07.ps1'
You can invoke the tool using the following command: dotnet-gitversion
Tool 'gitversion.tool' (version '5.12.0') was successfully installed.
ConvertFrom-Json: /home/vsts/work/_temp/0f944673-58bd-4ea6-8125-ce009ad98b07.ps1:4
Line |
4 | $gitVersionObject = dotnet-gitversion | ConvertFrom-Json
| ~~~~~~~~~~~~~~~~
| Conversion from JSON failed with error: Error parsing Infinity value.
| Path '', line 1, position 1.
##[error]PowerShell exited with code '1'.
Finishing: Calculate ModuleVersion (GitVersion)
My GitVersion.yml
is the following:
mode: ContinuousDelivery
next-version: 0.0.1
major-version-bump-message: '(breaking\schange|breaking|major)\b'
minor-version-bump-message: '(adds?|features?|minor)\b'
patch-version-bump-message: '\s?(fix|patch)'
no-bump-message: '\+semver:\s?(none|skip)'
assembly-informational-format: '{NuGetVersionV2}+Sha.{Sha}.Date.{CommitDate}'
branches:
master:
tag: preview
regex: ^main$
pull-request:
tag: PR
feature:
tag: useBranchName
increment: Minor
regex: f(eature(s)?)?[\/-]
source-branches: ['master']
hotfix:
tag: fix
increment: Patch
regex: (hot)?fix(es)?[\/-]
source-branches: ['master']
ignore:
sha: []
merge-message-formats: {}
feature:
tag: useBranchName
increment: Minor
regex: f(eature(s)?)?[/-]
source-branches: ['master']
hotfix:
tag: fix
increment: Patch
regex: (hot)?fix(es)?[/-]
source-branches: ['master']
Yes it is. Either add the above line to azure-pipelines.yml
or manually uncheck the box in the pipeline
I haven't verified that the line works in Azure Pipelines, but assuming since I saw that @raandree did add it in a PR and Raimund first reported the issue. 🙂
I tried this but it was not successful for me
variables:
buildFolderName: output
buildArtifactName: output
testResultFolderName: testResults
defaultBranch: main
Agent.Source.Git.ShallowFetchDepth: 0
But I'm not used to work with pipeline, so maybe I didn't update it the right way.
BTW, unchecking the option manually worked
@fslef looks like you did it correctly. Thanks for confirming that it might not work. I will double check with @raandree.
I am using this in my repo with AZ Pipelines since quite some time. Sorry that I didn't forward it earlier.
And yes, that solved the issue with GitVersion.
Maybe as my pipeline was not yet merged to main was the root cause. (I was stuck to approve a PR)
Problem description
New Azure Pipelines do shallow fetch by default which make GitVersion to fail since all commit history is not available.
Verbose logs
How to reproduce
Run the current pipeline in a newly created Azure Pipelines pipeline.
Expected behavior
Should not do shallow fetch.
Current behavior
Does shallow fetch.
Suggested solution
Add the following to azure-pipelines.yml:
Operating system the target node is running
PowerShell version and build the target node is running
Module version used