-
Notifications
You must be signed in to change notification settings - Fork 663
Support for Dotenv output format #4413
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
Conversation
|
@asbjornu we probably should rebase this branch onto main instead of merge main into this branch |
Indeed. I wish that was possible in the GitHub UI! |
c02db41 to
8f34dbd
Compare
|
I rebased my changes on top of main and thus also removed the merge ;-) |
|
I assume the Windows tests fail because of the |
|
@Bi0T1N I will take this one for a spin before merging |
|
@Bi0T1N please rebase this one on main (no merge) |
0954bdf to
09888cb
Compare
|
I decided to wrap all values into single quotes thus it should be more future proof as it might not break The |
|
Next week I have a bit of time, will review the PR |
927d47a to
0a1974a
Compare
|
@mergify rebase |
✅ Nothing to do for rebase action |
will be more future proof as it might not break on values that contain whitespaces etc
0a1974a to
2602d51
Compare
arturcic
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!, Great job
Description
This PR implements the functionality to export the GitVersion variables in the Dotenv format that can be consumed by your environment.
Related Issue
Closes #4174
Motivation and Context
Exporting the variables in the Dotenv format provides a simple mechanism to use the GitVersion variables in your shell environment. Additonallty some CI systems like GitHub or GitLab allow to pass around and expanding the jobs environment with artifacts in the Dotenv format.
It can be discussed how the output should look like e.g. wrap all values in
'<value>', write nothing for empty lines or use''(that's what I've decided for). The parsing rules for nodejs projects are here while the ones for GitLab CI can be found here.How Has This Been Tested?
With the provided unit tests as well as with a Python script and a library for handling Dotenv files (see Examples section below).
Examples:
Running the following commands
results in a
gitversion.envfile with the following contentLoading that file in Python (
pip install python-dotenv) with the following scriptwrites
to the console (and thus proves it can load/understand the generated Dotenv format from GitVersion) and results in a
python_gitversion.envfile with the contentChecklist: