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]: Azure DevOps task does not place dotnet-gitversion.exe in correct folder #1312

Open
2 tasks done
RasmusAaen opened this issue Oct 23, 2024 · 3 comments
Open
2 tasks done

Comments

@RasmusAaen
Copy link

RasmusAaen commented Oct 23, 2024

Prerequisites

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

GitVersion package

AzureDevops task

GitVersion version

5.12

Operating system

Windows

What are you seeing?

We are using the Azure DevOps GitVersion tasks in a pipeline running on a self-hosted windows build agent.

          - task: gitversion/setup@3
            inputs:
              versionSpec: "5.x"

          - task: gitversion/execute@3
            inputs:
              targetPath: $(Build.SourcesDirectory)/energyPRO

The install succeds:

Starting: Install GitVersion
==============================================================================
Task         : Setup GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org/) for projects using Git
Version      : 3.0.0
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
--------------------------
Acquiring GitVersion.Tool for version spec: 5.x
--------------------------
Querying tool versions for [email protected] 
Found matching version: 5.12.0
Looking for local tool [email protected]
Found tool [email protected] at C:\a\_tool\GitVersion.Tool\5.12.0
--------------------------
GitVersion.Tool version: 5.12.0 found in local cache at C:\a\_tool\GitVersion.Tool\5.12.0.
--------------------------
Prepending C:\a\_tool\GitVersion.Tool\5.12.0 to PATH
Updated PATH: C:\a\_tool\GitVersion.Tool\5.12.0;C:\agent\externals\git\cmd;...
Set GITVERSION_PATH to C:\a\_tool\GitVersion.Tool\5.12.0
GitVersion installed successfully
Finishing: Install GitVersion

But the execute function cannot find the dotnet-gitversion.exe

Starting: Calculate Build Version
==============================================================================
Task         : Execute GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org/) for projects using Git
Version      : 3.0.0
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
Executing GitVersion
Command: git -C C:/a/2/s/energyPRO rev-parse --is-shallow-repository
Command: C:\a\_tool\GitVersion.Tool\5.12.0\dotnet-gitversion.exe C:/a/2/s/energyPRO /output json /output buildserver
##[error]Command failed: C:\a\_tool\GitVersion.Tool\5.12.0\dotnet-gitversion.exe C:/a/2/s/energyPRO /output json /output buildserver
'C:\a\_tool\GitVersion.Tool\5.12.0\dotnet-gitversion.exe' is not recognized as an internal or external command,
operable program or batch file.

Finishing: Calculate Build Version

When looking at the file system on the agent, the folder "C:\a_tool\GitVersion.Tool\5.12.0" only contains a folder called "x64" and a file called "x64.complete". The x64 folder contains the dotnet-gitversion.exe

Reverting to the v2 of the setup and execute tasks seems to fix the issue.

What is expected?

That GitVersion can be found in the expected folder after install.

Steps to Reproduce

Create a pipeline with the tasks above on a x64 server.

RepositoryFixture Test

No response

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

No response

@arturcic arturcic transferred this issue from GitTools/GitVersion Oct 23, 2024
@Bibz87
Copy link

Bibz87 commented Oct 24, 2024

For what it's worth, I'm also having this problem on Linux agents.

@Bibz87
Copy link

Bibz87 commented Oct 24, 2024

Just had the issue on version 2.0.0 :(

Starting: Determine Version
==============================================================================
Task         : Execute GitVersion Task
Description  : Easy Semantic Versioning (https://semver.org/) for projects using Git
Version      : 2.0.0
Author       : GitTools Contributors
Help         : See the [documentation](https://gitversion.net/docs/) for help
==============================================================================
Running on: 'Azure Pipelines'
Disable Telemetry
Executing GitVersion
Command: git -C /agent/_work/22/s rev-parse --is-shallow-repository
Command: /opt/hostedtoolcache/GitVersion.Tool/5.12.0/dotnet-gitversion /agent/_work/22/s /output json /output buildserver /config /agent/_work/22/s/gitversion.yaml
##[error]Command failed: /opt/hostedtoolcache/GitVersion.Tool/5.12.0/dotnet-gitversion /agent/_work/22/s /output json /output buildserver /config /agent/_work/22/s/gitversion.yaml
/bin/sh: 1: /opt/hostedtoolcache/GitVersion.Tool/5.12.0/dotnet-gitversion: not found

Finishing: Determine Version

@arturcic
Copy link
Member

@RasmusAaen I see there is this

Found tool [email protected] at C:\a_tool\GitVersion.Tool\5.12.0

Can you remove the C:\a_tool\GitVersion.Tool and then in the setup set preferLatestVersion: true

example: https://github.com/GitTools/actions/blob/main/docs/examples/azure/gitversion/setup.md#example-4

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

No branches or pull requests

3 participants