Skip to content

How to retrieve GitVersion variables in GitLab CI ? #2085

@pitetb

Description

@pitetb

Hello,

Thanks for this amazing library.

I'am using dotnet core 3.1 for a library project. I added GitVersionTask nuget package in my project. I setup a custom Gitversion.yml file to manage branches and my workflow.
When I generate the project with dotnet build or dotnet pack commands locally (windows env), everything is fine.

Then, I try to put use the Gitlab-Ci tool to generate my project. My runner is the official microsoft linux container: mcr.microsoft.com/dotnet/core/sdk.
The build is working, the nuget package has the correct name following rules defined in my GitVersion.yml file... However, I would like to access later in my CI script to all the variables generated by GitVersion. How can I do that ?
The documentation is not very clear for me, apparently Gitversion task should have generated a 'gitversion.properties' file but I can't find it. The "Gitversion variables" (like GitVersion_NuGetVersion, etc..) are not exported in my environment variables.

How can I do to have access to them to use them later in my CI file?

Thank you for any help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions