Does the Declarative Pipeline Plugin Assume /bin/sh for Shell Command Step (sh) when Running on Agent Node?

12 views
Skip to first unread message

Meg Watson

unread,
Sep 26, 2018, 2:33:21 PM9/26/18
to Jenkins Users
Hi there,

I have a Jenkins Master on RHEL (v 2.121.3), and an Agent running on NonStop, which looks and smells like Unix.  On NonStop I have 2 choices for the shell, /bin/sh (which is symlinked to /bin/ksh) and /bin/bash.  I normally use /bin/bash.  I have a pipeline job that is pegged to run on the NonStop Agent (via node ()) with a pipeline declarative script.  One of the steps is an sh with several lines.  Problem is, the shell run by the sh step is /bin/sh.  I cannot figure out how to change it.  I tried #!/bin/bash as the first line of the sh step, but to no avail.  It seems like the agent may be assuming /bin/sh when executing the sh step.  Any ideas on how I can change the script used by the sh step in the pipeline?

Declarative Pipeline Plugin 1.3.1; Pipeline: Nodes and Processes Plugin 2.19

Thanks in advance! 

Meg

Andrew Bayer

unread,
Sep 27, 2018, 4:43:58 PM9/27/18
to jenkins...@googlegroups.com
It uses the default shell, yes - i.e., "sh -c ...", as you can see at https://github.com/jenkinsci/durable-task-plugin/blob/c1ee6607c6939e8917762419c8474fecec06172c/src/main/java/org/jenkinsci/plugins/durabletask/BourneShellScript.java#L141-L165. The actual content of the step, i.e., "ls -la" in "sh('ls -la')", though, gets written to a file on the agent, and then that file is executed. So "#!/bin/bash" should have done the trick...

A.  

--
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-use...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/923a2542-30e3-4ec6-b0f0-e142f0b5f439%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages