Hi all,
on a remote node I have a file that exports some variables:
$ cat myenv
export FOO=Hello
export BAR=World

My pipeline script tries to source that file, but the variables don't seem 
to stick:
node ('remote-server') {
    sh ('. /home/cmr/myenv')
    echo "My Variables: ${env.FOO} ${env.BAR}"
}

Output:

[set-remote-env] Running shell script
+ . /home/cmr/myenv
++ export FOO=Hello
++ FOO=Hello
++ export BAR=World
++ BAR=World[Pipeline] echoMy Variables: null null



When I source directly from the server's command prompt, the variables 
stick:
$ . myenv
$ echo "My Variables: $FOO $BAR"
My Variables: Hello World
$




How can I source environment variables in my pipeline script?

Thanks!







-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2bfd3d27-2fe7-4e49-9e9c-a7edaf416e60%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to