question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Save variables as environment variables

See original GitHub issue

When writing scripts to customise version formatting to our needs, it has been difficult to access GitVersion variables. It would be easier if GitVersion variable(s) could optionally be exposed as environment variables.

Detailed Description

When using a batch file (say) or an MsBuild task (target file) to customise version formatting to our needs we need to read the GitVersion variable from a file (this may be mutually exclusive to using command line output option of buildsystem).

If we could, by configuration, nominate all or some variables to be made available as system variables (current session only) then we could access those in many languages including even (shock) a batch file.

Context

Reduce dev time to use the tool.

Possible Implementation

Another retrospective solution. Done by awful means.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
asbjornucommented, Jun 11, 2021

I see. gitversion.exe should set environment variables if it detects that it’s running within a supported build server.

itself, that’s done by the different build tasks (as how environment variables are set differs from build server to build server). You can see how it’s done in AzDO here:

https://github.com/GitTools/GitVersion/blob/dca800837bb34e3cda8be4fb28b0bc72964e656f/src/GitVersion.Core/BuildAgents/AzurePipelines.cs#L20-L27

#2722 seeks to improve the documentation in this area.

0reactions
stale[bot]commented, Mar 2, 2022

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Set Environment Variables
To persist the environment variables across processes, you can store them in the user and/or machine registry using the setx command.
Read more >
How to permanently set environmental variables
To change the environmental variable "permanently" you'll need to consider at least these situations: Login/Non-login shell ...
Read more >
Python: Three Different Ways to Store Environment Variables
Environment variables are typically used to store configurations or pass in parameters for your projects. Some have used them to store security credentials, ......
Read more >
How to set environment variables for your web apps ...
env file and a tool called python-dotenv to load it. Start by saving your environment variables into a .env file in your project...
Read more >
How to List, Set and Manage Linux Environment Variables
A few key points to keep in mind when working with Linux environment variables are: Environment variables follow <NAME>=<VALUE> formatting.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found