Description
Describe the bug
In our Azure DevOps Pipeline, we are trying to specify the path to an externalized GitVersion.yaml which is in the Resources repo we also use for ADO templates.
When we specify the configFilePath to the yaml, we receive the error:
##[error]SyntaxError: Unexpected end of JSON input
I can confirm the file is physically available in the working directory and also the GitVersion.yaml works on my local macbook without issues.
We are running on a self-managed linux vm
Expected Behavior
We would expect the extension to be able to take the input for the location where the configuration file is located, read it, and use it during the pipeline duration.
Actual Behavior
We receive an error:
##[error]SyntaxError: Unexpected end of JSON input
Full log output of task:
starting: Execute GitVersion
==============================================================================
Task : Execute GitVersion Task
Description : Easy Semantic Versioning (http://semver.org) for projects using Git
Version : 0.9.9
Author : GitTools Contributors
Help : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Command: dotnet-gitversion /home/azureado/agent/_work/6/s /output json /output buildserver /config /home/azureado/agent/_work/6/s/ado-templates/vars/GitVersion.yml
/home/azureado/agent/_work/_tool/GitVersion.Tool/5.6.9/x64/dotnet-gitversion /home/azureado/agent/_work/6/s /output json /output buildserver /config /home/azureado/agent/_work/6/s/ado-templates/vars/GitVersion.yml
Cannot find the .git directory
INFO [05/13/21 19:24:29:60] Working directory: /home/azureado/agent/_work/6/s
INFO [05/13/21 19:24:29:64] Done writing
##[error]SyntaxError: Unexpected end of JSON input
Finishing: Execute GitVersion
Possible Fix
The only workaround we have is to commit the GitVersion.yaml directly into the repo being built.
So far, have not found any way to get an external file to read successfully
Steps to Reproduce
- stage: DetermineVersion
jobs:
- job: ExecuteGitVersion
workspace:
clean: all
steps:
- checkout: self
- checkout: templates
- task: gitversion/setup@0
inputs:
versionSpec: '5.6.x'
- task: gitversion/execute@0
displayName: Execute GitVersion
name: Version
inputs:
useConfigFile: true
configFilePath: '$(Build.SourcesDirectory)/$(reponame)/GitVersion.yml'
The contents of GitVersion.yaml:
branches:
main:
regex: ^master$|^main$
mode: ContinuousDelivery
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tracks-release-branches: true
is-release-branch: false
release:
regex: ^releases?[/-]
mode: ContinuousDelivery
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tracks-release-branches: false
is-release-branch: true
pre-release-weight: 1000
feature:
regex: ^features?[/-]
mode: ContinuousDelivery
tag: useBranchName
increment: Inherit
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
pull-request:
regex: ^(pull|pull\-requests|pr)[/-]
mode: ContinuousDelivery
tag: PullRequest
increment: Inherit
prevent-increment-of-merged-branch-version: false
tag-number-pattern: '[/-](?<number>\d+)[-/]'
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
hotfix:
regex: ^hotfix(es)?[/-]
mode: ContinuousDelivery
tag: beta
increment: Patch
prevent-increment-of-merged-branch-version: false
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
support:
regex: ^support[/-]
mode: ContinuousDelivery
tag: ''
increment: Patch
prevent-increment-of-merged-branch-version: true
track-merge-target: false
tracks-release-branches: false
is-release-branch: false
develop:
regex: ^dev(elop)?(ment)?$
mode: ContinuousDeployment
tag: unstable
increment: Minor
prevent-increment-of-merged-branch-version: false
track-merge-target: true
tracks-release-branches: true
is-release-branch: false
Context
We are trying to tune gitversion to provide semantic versions differently than the plugin defaults, so we can control the versioning increment as desired by our organization. Without this, we are getting alpha and beta tags on our releases, which is not desired.
Your Environment
- Version Used:
GitVersion Task version: 0.9.9, GitVersion.Tool 5.6.9 x64
ADO agent version 2.184.2
Linux, CentOS 7