Back

Explore Courses Blog Tutorials Interview Questions

Explore Tech Questions and Answers

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

+1 vote
2 views
by (11.4k points)

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.

1 Answer

+1 vote
by (32.3k points)

You can try using EnvInject plugin in the following way:

  1. Create an "Execute shell" build step that runs

         echo AOEU=$(echo aoeu) > propsfile

   2. Create an Inject environment variables build step and set "Properties File Path" to propsfile.

Note: Usually, this plugin is not compatible with the Pipeline plugin.

Related questions

0 votes
2 answers
0 votes
1 answer
+1 vote
1 answer
0 votes
1 answer

Browse Categories

...