How to set environment variables in Jenkins?

I would like to be able to do something like:

AOEU=$(echo aoeu)

and have Jenkins set AOEU=aoeu.

The Environment Variables section in Jenkins doesn’t do that. Instead, it sets AOEU='$(echo aoeu)'.

How can I get Jenkins to evaluate a shell command and assign the output to an environment variable?

Eventually, I want to be able to assign the executor of a job to an environment variable that can be passed into or used by other scripts.

16 Answers
16

Leave a Comment