[workflow plugin] sh hangs when setting env.PATH

26 views
Skip to first unread message

Christoph Vogtländer

unread,
Feb 11, 2015, 8:33:25 AM2/11/15
to Jenkinsci Users
Hi,

I'm trying to append a path to env.PATH and then executing a "sh" step.

node('Linux') {
env.PATH = "/my/path/:${env.PATH}"
sh 'echo "$PATH"'
}

env.PATH now contains "/my/path:null" and the "sh" will hang (I can see
that the temporary script is created successfully in the workspace, but
Jenkins does not seem to be able to execute it). No output is generated
in the step (just the circular progress indicator will be shown).

When not setting env.PATH everything works as expected and the output
will be:
Running shell script
+ echo 'Path: /usr/bin:/bin:/usr/sbin:/sbin'
Path: /usr/bin:/bin:/usr/sbin:/sbin


Changing the above code to:
node('Linux') {
env.PATH = "/my/path/:/usr/bin:/bin:/usr/sbin:/sbin"
sh 'echo "$PATH"'
}

will solve the problem. Is this expected behaviour?

Thanks
Christoph


Scott Armit

unread,
Feb 24, 2015, 11:42:05 AM2/24/15
to jenkins...@googlegroups.com, jen...@mockies.de
Even on a separate node, the 'env' will cause the 'sh' task to hang. For example, I have a windows slave and master:

node('windows-doc') {
    echo "On my Windows slave"
    env.PATH = "C:\\Program Files (x86)\\MadCap Software\\MadCap Flare V10\\Flare.app;%PATH%"
}

node('master') {
    echo "On master"
    sh "ls -l"
}

Remove the 'env.PATH' from that, and it will not hang. I'm running on 1.580.3 LTS release line.

Checking to see if there's a bug for this. Very frustrating.

Scott Armit

unread,
Feb 24, 2015, 11:47:47 AM2/24/15
to jenkins...@googlegroups.com, jen...@mockies.de
Reply all
Reply to author
Forward
0 new messages