Skip to content

[ISSUE]: GitVersion-execute Devops Task verion 4 - GitVersion output is not a valid JSON #1679

@Hoang-Minh

Description

@Hoang-Minh

Prerequisites

  • I have written a descriptive issue title
  • I have searched issues to ensure it has not already been reported

GitVersion package

AzureDevops task

What are you seeing?

I keep getting error when trying to execute GitVersion Task version 4 in Azure Devops saying that the output is not a valid JSON.

This is my config file:

azure-pipelines.yml:


---
variables:
  - name: buildConfiguration
    value: Release
  - name: agentPool
    value: Azure Pipelines 
  - name: workingDirectory
    value: "src/RabbitMq/Build"
  - name: rootPath
    value: "./../../../"
trigger:
  - main
  - dev
  - feature/*
jobs:
  - job: null
    displayName: Build and Publish Artifacts
    pool:
      name: $(agentPool)
      vmImage: ubuntu-latest
    steps:
    - checkout: self
      fetchDepth: 0
    - task: UseDotNet@2
      displayName: 'Install .NET 9 SDK'
      inputs:
        packageType: 'sdk'
        version: '9.x'
    - task: Bash@3
      displayName: 'Check what account is running'
      inputs:
        targetType: 'inline'
        script: 'whoami'
        workingDirectory: $(workingDirectory)    
    - task: gitversion-setup@4
      displayName: 'Install Git Version'
      inputs:
        versionSpec: '6.3.x'
        preferLatestVersion: true    
    - task: gitversion-execute@4
      displayName: 'Determine application version with GitVersion'
      name: version_step # step id used as reference for output values
      inputs:
        disableCache: true
        disableShallowCloneCheck: true
        # --- IMPORTANT CHANGE HERE ---
        # The configFilePath should be relative to the repository root ($(Build.SourcesDirectory))
        # Assuming GitVersion.yml is inside src/RabbitMq/Build
        configFilePath: '$(workingDirectory)/GitVersion.yml'
        # --- END IMPORTANT CHANGE ---
        buildNumberFormat: '${GitVersion_FullSemVer}'      

My GitVersion.yml:

mode: ContinuousDelivery
branches:
  main:
    tag: ''
  dev:
    tag: 'preview'
  feature:
    tag: 'feature'

What is expected?

A Valid GitVersion Json

Steps to Reproduce

Install GitTools on my organization
Create azure-pipelines.yml and add task to install and execute gitversion

Output log or link to your CI build (if appropriate).

Starting: Determine application version with GitVersion
==============================================================================
Task         : Execute GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org/) for projects using Git
Version      : 4.0.0
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
Command: /opt/hostedtoolcache/GitVersion.Tool/6.3.0/dotnet-gitversion --roll-forward Major /home/vsts/work/1/s /output json /l console /nocache /config /home/vsts/work/1/s/src/RabbitMq/Build/GitVersion.yml
##[error]GitVersion output is not valid JSON, see output details
undefined
Finishing: Determine application version with GitVersion

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy