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

Env Vars set using envman are not available in current step #206

Open
DamienBitrise opened this issue Apr 29, 2022 · 5 comments
Open

Env Vars set using envman are not available in current step #206

DamienBitrise opened this issue Apr 29, 2022 · 5 comments

Comments

@DamienBitrise
Copy link
Contributor

In a single script step do the following

envman add --key SOME_KEY --value 'some value'
echo $SOME_KEY

Note that the Env Var is not set

Ideally Envman would also set the env var using export so it is available in the current step

export SOME_KEY="some value"
@Nikoloutsos
Copy link

Facing this problem as well.

@tzuhan-bitrise
Copy link

Hi, thank you for contacting Bitrise.
This is the expected behavior and here's the response from our engineer.

Envman is a file-based env store tool. When you add an env var it writes to a file. When you execute a command with envman (like Bitrise steps) envman reads this file and passes it to the standard go execution package. So technically it does not know anything about how to set these or what an env var is.

You can check the Usage example: Simple Bash example in the Readme.md file for further explanation.

@DamienBitrise
Copy link
Contributor Author

Is there a command that can be run to load the new Env Vars into the current shell maybe?

@godrei
Copy link
Contributor

godrei commented Jan 16, 2023

Hi @DamienBitrise , adding the env to the current shell session and adding it to the envstore file when envman add is executed is a valid feature request, even if the current behavior is by design.

Is there a command that can be run to load the new Env Vars into the current shell maybe?

Unfortunetly there isn't a single command you could use.

envman print prints the content of the envstore file in the format:

KEY_1: VALUE_1
KEY_2: VALUE_2
...

, or in a json format --format json.

@Nikoloutsos
Copy link

Nikoloutsos commented Jan 16, 2023

i've overcome this problem long time ago by using:

export FOO="BAR"

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

4 participants