Modify environment variable for entire workflow #26957
-
Hello, I have a workflow with 2 jobs. The first workflow must set an environment variable to some value, so that the value persists for access to the second job. But I could not figure out how to do that. Here is an example of my situtation:
So, I initially specified an environment variable TEST_RESULT, and set its value to ‘success’. Then, in the first job (job-1) I first printed TEST_RESULT and saw it was indeed ‘success’. I then changed the value of TEST_RESULT to ‘failure’, and additionally printed its value after modification - final result of TEST_RESULT in job-1 was ‘failure’. Then a second job (job-2) started. I also looked at the value of TEST_RESULT there, but the value was the original ‘success’ value. So, is the a possibility to persist values of environment variables, so that subsequent jobs have access to updated values and not the original value? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can use the outputs to pass the updated value of the environment variable from job-1 to job-2. I have tested the following example, it can work fine as expected (see here):
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
@alishstrong ,
You can use the outputs to pass the updated value of the environment variable from job-1 to job-2.
I have tested the following example, it can work fine as expected (see here):