Skip to content

[ISSUE]: Overwriting readonly variable 'GitVersion.Major' is not permitted #1344

@jochenjonc

Description

@jochenjonc

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?

Since the last update, all build using GitVersion are broken with the following error:

##[error]Unable to process command '##vso[task.setvariable variable=GitVersion.Major]5' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
##[error]Overwriting readonly variable 'GitVersion.Major' is not permitted. See https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/readonly-variables.md for details.

It seems that changes in #1343 are executing the GitVersion tool twice and the second time it tries to overwrite the readonly variables that were set in the first run.

What is expected?

It's expected that GitVersion is only run once.

Steps to Reproduce

Make sure to run GitVersion with the latest version:

    - task: gitversion/[email protected]
      displayName: 'Install GitVersion'
      inputs:
        versionSpec: '6.x'

    - task: gitversion/[email protected]
      displayName: 'Determine application version with GitVersion'
      name: 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      : 3.0.2
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
Executing GitVersion
Command: git -C /home/vsts/work/1/s rev-parse --is-shallow-repository
Command: /opt/hostedtoolcache/GitVersion.Tool/6.0.5/dotnet-gitversion /home/vsts/work/1/s /output json /output buildserver /config /home/vsts/work/1/s/GitVersion.yml
GitVersion executed successfully
GitVersion output:
...
Executing GenerateSetVersionMessage for 'AzurePipelines'.
Executing GenerateBuildLogOutput for 'AzurePipelines'.
...

-------------------
GitVersion executed successfully
...
Executing GenerateSetVersionMessage for 'AzurePipelines'.
Executing GenerateBuildLogOutput for 'AzurePipelines'.
##[error]Unable to process command '##vso[task.setvariable variable=GitVersion.Major]5' successfully. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
##[error]Overwriting readonly variable 'GitVersion.Major' is not permitted. See https://github.com/microsoft/azure-pipelines-yaml/blob/master/design/readonly-variables.md for details.
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions