Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 tasks done
jochenjonc opened this issue Nov 18, 2024 · 0 comments · Fixed by #1349
Closed
2 tasks done

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

jochenjonc opened this issue Nov 18, 2024 · 0 comments · Fixed by #1349
Milestone

Comments

@jochenjonc
Copy link

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/setup@3.0.2
      displayName: 'Install GitVersion'
      inputs:
        versionSpec: '6.x'

    - task: gitversion/execute@3.0.2
      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.
...
@arturcic arturcic added this to the v3.0.3 milestone Nov 20, 2024
@arturcic arturcic linked a pull request Nov 20, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants