How can we concatenate multiple env vars at workflow and job level? #26179
-
I’m trying to concatenate a Workflow env var (PREFIX) with other Workflow and Job env vars, but it looks like I can only concatenate within the Step scope. Using Jenkins I could do this:
Here is my failing example Workflow:
Currently, if I want to use concatenated env vars across multiple steps, I have to repeat the Step level env var definitions like so:
Is there a way to concatenate env vars higher up, in Workflow or Job scope? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi @adamrushuk , The worklfow&job level env doesn’t support variable expression, hence cannot concatenate other workflow/job env vars. Currently it’s only supported for step level env. You don’t need to repeat step level env definition, you can use ‘set-env’ to create and update env variable for any actions running next in a job. Code sample as below:
Thanks. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the workaround weide-zhou; this works perfectly! |
Beta Was this translation helpful? Give feedback.
Hi @adamrushuk ,
The worklfow&job level env doesn’t support variable expression, hence cannot concatenate other workflow/job env vars. Currently it’s only supported for step level env.
You don’t need to repeat step level env definition, you can use ‘set-env’ to create and update env variable for any actions running next in a job. Code sample as below:
Thanks.