GitTools / actions

GitHub Action that installs and uses the GitVersion and GitReleaseManager tools
MIT License
218 stars 63 forks source link

GitVersion6: GitVersion6 showconfig #1200

Closed damu9618 closed 1 month ago

damu9618 commented 1 month ago

Prerequisites

GitVersion package

AzureDevops task

What are you seeing?

We are using git version 6 latest for our azure devops pipelines to show our config in the pipelines

I have tried removing the /showconfig from the task then the logs were completely from the directory which was not expected attached the same for reference withoutshowconfig.txt

Could you please help us incase if we miss something hear for version 6

What is expected?

We would expect as showconfig with version 5.12.0

Steps to Reproduce

Please try to have the same way in azure devops pipelines and run the above task

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

No response

arturcic commented 1 month ago

@damu9618 please also update to the latest tasks

arturcic commented 1 month ago

The reason it fails for the /showconfig is because the gitversion/execute expects to get the GitVersion output variables as a json object, and then set the env vars from it. That is by design.

/showconfig is actually returning the configuration yaml file and not the json output variables.

Maybe we need to have a move specific action that actually sets the env vars and keep the execute for any other commands

arturcic commented 1 month ago

1203 will allow you to run the command when it's released in v3

damu9618 commented 1 month ago

Hi @arturcic Thanks for the update, However I still see the same issue with the same config as above. could you please help me If need to change something in my config below task: gitversion/execute@0 displayName: Show GitVersion config inputs: useConfigFile: true configFilePath: ${{ parameters.gitVersionConfigFilePath }} ${{ if eq(parameters.mainRepositoryName, '') }}: additionalArguments: /targetpath $(Build.SourcesDirectory) /showConfig ${{ else }}: additionalArguments: /targetpath {{ parameters.mainRepositoryName }} /showConfig

arturcic commented 1 month ago

task: gitversion/execute@0

this is version 0, please install the latest version which is 3, and then it should be task: gitversion/execute@3,

same for the setup

damu9618 commented 1 month ago

Hi @arturcic Thanks for the quick response. Please find the complete details below Actually we are using dotnet tool install $toolName --configfile $nugetConfigPath --tool-path $(Agent.ToolsDirectory) tool install git. I could successfully able to install it and see the logs Checking if 'GitVersion.Tool' is already installed... The tool is not yet installed, installing now into tools directory '/azp/_work/_tool' using NuGet config 'App/nuget.config'... You can invoke the tool using the following command: dotnet-gitversion Tool 'gitversion.tool' (version '6.0.0') was successfully installed. using v3 version

and my config file path is ConfigFilePath: App/GitVersion.yml However now i am getting different issue attached the logs git-logs.txt

Could you please help me to solve this issue?

arturcic commented 1 month ago

as you can see from the logs it cannot find the dotnet-gitversion and the reason is beacuse the task: gitversion/setup@3 that you are not using to install the GitVersion.Tool, is setting an environment variable that is later used by the execute task. https://github.com/GitTools/actions/blob/1b6eb626357cbaf7701cdc2ef54956e3b710d40d/src/tools/gitversion/tool.ts#L16

Another way would be to include the path where dotnet-gitversion is installed, to the $PATH environment variable