[work-flow plugin]How to set cygwin path for shell script

573 views
Skip to first unread message

Rupali

unread,
Nov 26, 2014, 7:23:49 AM11/26/14
to jenkins...@googlegroups.com
I am trying to run a shell script on Windows Server.
Usually we set start line in shell script as "#!d:\cygwin\bin\bash.exe -l" to point to bash under cygwin.
This is not working in work-flow step.
I have written shell script execution step as below:
sh '''#!d:\\cygwin\\bin\\bash.exe -l

cd $WORKSPACE
perl engine/deploy.pl
exit $?'''

I get below error:

java.io.IOException: Cannot run program "nohup" 
CreateProcess error=2, The system cannot find the file specified

I have written shell script execution step as below:

Can you advise on how do I setup path to cygwin here so that it can find the required shell script commands?
Note: cygwin is already included in system path variable.

Regards,
Rupali

Jorge Peña Cotarelo

unread,
Nov 26, 2014, 10:29:06 AM11/26/14
to jenkins...@googlegroups.com
Make sure that when the slave starts it has the path of all the cygwin binaries (path to nohup.exe)

Kohsuke Kawaguchi

unread,
Nov 26, 2014, 1:52:20 PM11/26/14
to jenkins...@googlegroups.com
I agree wth Jorge, it looks like your PATH is incomplete. Are you sure it's in the system "Path" variable? You can check the system info page on the slave in question to see if Jenkins slave process is correctly inheriting it. Maybe you changed the env variable after you launched the slave --- the environment variable changes won't affect processes that are already running.

I'm also curious why you are not running perl command directly. Your "cd" is pointless because it's already on $WORKSPACE. You could have just done

   sh "perl engine/deploy.pl"


--
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/e613e539-156f-40cf-9288-b97b74cb9b42%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Kohsuke Kawaguchi

Rupali

unread,
Nov 27, 2014, 2:08:06 AM11/27/14
to jenkins...@googlegroups.com
Thanks. Both of you are right.
I missed checking configuration on Slave.
Corrected it now and its working fine.

Regards,
Rupali

Rupali

unread,
Nov 27, 2014, 5:09:10 AM11/27/14
to jenkins...@googlegroups.com
Hi Jorge, Kohsuke,

Now I am getting a different error as below:
[D:\Jenkins\jobs\BUILD-DEPLOY-TEST-CERTIFY-WF\workspace] Running shell script
cygwin warning:
  MS-DOS style path detected: D:\Jenkins\jobs\BUILD-DEPLOY-TEST-CERTIFY-WF\workspace\.dddf1bf9\pid
  Preferred POSIX equivalent is: /cygdrive/d/Jenkins/jobs/BUILD-DEPLOY-TEST-CERTIFY-WF/workspace/.dddf1bf9/pid
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
sh: D:\Jenkins\jobs\BUILD-DEPLOY-TEST-CERTIFY-WF\workspace\.dddf1bf9\script.sh: command not found

I am not calling script.sh.Also I am not sure how this .dddf1bf9 folder is getting created.
Can you advise on this?

Regards,
Rupali


On Wednesday, November 26, 2014 5:53:49 PM UTC+5:30, Rupali wrote:
Reply all
Reply to author
Forward
0 new messages