Unable to update settable environment variables


#1

Hi all, I am not able to update any of the environment variables in my workspace. All of the environment variables are workspace level and I have already tried updating them by using following command:
export VARIABLE_KEY=$(cat filename.txt | grep key)
They contain default values (if provided), but not the updated ones when I print them:
echo $VARIABLE_KEY
or
echo ${VARIABLE_KEY}
I want to basically achieve a way to create multiple environment variables at workspace level. Then, update them by SSHing into my ec2-instance and computing their values from credential files present in there.
I wish to use those updated values in the next step of building a docker image.
Please let me know if I am incorrect about any of these steps that I’ve been following so far. Is there any other way of updating my environment variables

Kind Regards,


#2

Hello Raghvendra,

Please check the logs of the execution of the action in which you are setting this up and see if you can find something like this:

Setting environment variables
VARIABLE_KEY=YOUR_VALUE

If you will be missing this, please contact our support and provide an URL to the execution.


#3

Thanks for replying, @Jarek . I get the message saying:

`Setting environment variables`    
`VARIABLE_KEY=YOUR_VALUE`    

but this only happens in local shell not in ssh shell.

Is there a way where I can ssh into ec2 instance and update the env variables from there to further use them in next steps?


#4

Yes - SSH action is executed on a remote server and it won’t work with that. The variables, in that case, are only here during the remote server connection session.

Assigning variable works only for the build actions - variables are then exported from the container and saved as environment variables in Buddy.