Windows Master and Linux Slave give an error: Cannot run program "C:\Windows\system32\cmd.exe"

410 views
Skip to first unread message

Gregory Givler

unread,
May 15, 2019, 7:20:38 AM5/15/19
to Jenkins Users
I have a Windows Jenkins Master with some linux (centos 7) slaves. When I try and execute a Job on the Windows Master on the linux slave using a execute shell build step I get the following:

[Linux_TT_Execution_ManualRun_Job] $ C:\Windows\system32\cmd.exe -xe /tmp/jenkins3941323684764611011.sh
06:47:27 FATAL: command execution failed
06:47:27 java.io.IOException: error=2, No such file or directory
...
06:47:27 Caused: java.io.IOException: Cannot run program "C:\Windows\system32\cmd.exe" (in directory "/var/lib/jenkins/workspace/Linux_TT_Execution_ManualRun_Job"): error=2, No such file or directory

How can I configure my job to use sh to execute my shell command?


Message has been deleted

Mark Waite

unread,
May 20, 2019, 11:39:54 AM5/20/19
to Jenkins Users
If you'd like labels assigned automatically to your agents, install the "Platform Labeler Plugin".

If the labels assigned by the platform labeler plugin are not generic enough, install the "Implied Labels Plugin" and you can define that all agents with the label "CentOS" should also be assigned the label "linux" (as an example).  It simplifies the management of labels.

If you'd like an example implied labels definition for various Linux operating systems, I have one in my docker repository.

On Mon, May 20, 2019 at 6:18 AM Bob TheBuilder <thebuil...@gmail.com> wrote:
Hi Gregory,

what kind of Jenkinsfile do you use? Scripted or declarative?
In scripted, you would enclose your sh in a 
node('linux_label') {
sh "your shell script"
}

, on declarative, use 
stage ("Run on Linux only") {
   agent
{ label "linux_label" }
   steps
{
   script
{
     sh
"you shell script"
   
}
}

 with agent('linux_label'). Linux label would be a label you attached to the Linux slave/node

--
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/e81a95b4-d8a4-4fa0-931a-f314e9616796%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Thanks!
Mark Waite

Gregory Givler

unread,
Jun 25, 2019, 9:30:52 AM6/25/19
to Jenkins Users
I am somewhat embarrassed to post this but I found my problem, someone before me, I inherited this Jenkins setup set the shell executable path to "C:\Windows\system32\cmd.exe" I never thought to check, however without your help it would not have a given me the hint to check where Jenkins sets it shell executable.

No I know in the future, that is should be blank if you want to use both Linux and Windows Slaves from a Master...

Thanks for the nudge in the right direction.

Greg


On Monday, May 20, 2019 at 11:39:54 AM UTC-4, Mark Waite wrote:
If you'd like labels assigned automatically to your agents, install the "Platform Labeler Plugin".

If the labels assigned by the platform labeler plugin are not generic enough, install the "Implied Labels Plugin" and you can define that all agents with the label "CentOS" should also be assigned the label "linux" (as an example).  It simplifies the management of labels.

If you'd like an example implied labels definition for various Linux operating systems, I have one in my docker repository.

On Mon, May 20, 2019 at 6:18 AM Bob TheBuilder <thebuil...@gmail.com> wrote:
Hi Gregory,

what kind of Jenkinsfile do you use? Scripted or declarative?
In scripted, you would enclose your sh in a 
node('linux_label') {
sh "your shell script"
}

, on declarative, use 
stage ("Run on Linux only") {
   agent
{ label "linux_label" }
   steps
{
   script
{
     sh
"you shell script"
   
}
}

 with agent('linux_label'). Linux label would be a label you attached to the Linux slave/node

--
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 jenkins...@googlegroups.com.


--
Thanks!
Mark Waite
Reply all
Reply to author
Forward
0 new messages