Have you looked at the Environment Script Plugin?
I use it to generate parameters that I need to use later in my builds.

https://wiki.jenkins.io/display/JENKINS/Environment+Script+Plugin









From: jenkinsci-users@googlegroups.com 
[mailto:jenkinsci-users@googlegroups.com] On Behalf Of Victoria Kozel
Sent: Monday, June 12, 2017 1:49 PM
To: Jenkins Users
Subject: Injecting environment variables - sourcing shell script

Hello,

I need to use a certain variable in my Shell Build Step that is figured in a 
shell script stored on the node. When I "source" this script in the same step 
in which I need the variable, it works. However sourcing it in the EnvInject 
step under Build Environment phase does not seem to transfer the variable to 
the Build Step. Here's how the job is configured:

X . Inject environment variables to the build process

Script Content: source /home/jenkins/setInventoryVar.sh



I can see at this point the output of the script in the console, yet the Build 
Step does not inherit a variable set in Inject Env.

Suggestions are greatly appreciated.
--
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
jenkinsci-users+unsubscr...@googlegroups.com<mailto:jenkinsci-users+unsubscr...@googlegroups.com>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/dd621d0a-5a08-40a3-913c-54535f12cc5f%40googlegroups.com<https://groups.google.com/d/msgid/jenkinsci-users/dd621d0a-5a08-40a3-913c-54535f12cc5f%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
________________________________
This email is intended solely for the named addressee(s) and may be 
confidential or contain privileged information. Review, disclosure, copying, 
distribution, or use of this email by anyone other than an intended recipient 
is strictly prohibited. If you received this email in error, please delete it 
from your system and notify the sender immediately. While precautions have been 
taken to help ensure no computer viruses are present, there is a risk whenever 
transmitting emails or downloading attachments. The sender will not be liable 
for any loss or damage resulting from any malware in this communication or for 
improper or incomplete transmission of its contents or for any delay in its 
receipt.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3994D3AA09885B4CACC3D00FFD60221F010BA4A4BA%40MX-EXMB1-PRD.infarmbureau.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to