Executing a script result in a mixture of Windows and mac path and an IOException is raised.
Running as SYSTEM [EnvInject] - Loading node environment variables.
Building remotely on macbs04 (mac) in workspace /Users/jenkins/jenkins/workspace/TEST-JOB-MAC-STRANGE-WS-PATH [TEST-JOB-MAC-STRANGE-WS-PATH] $ echo "Hello World"
FATAL: Command execution failed.
java.io.IOException: Process working directory '/Users/jenkins/jenkins/\Users\jenkins\jenkins\workspace\TEST-JOB-MAC-STRANGE-WS-PATH' doesn't exist!
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:223)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1398)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1340)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130)
DEBUGGING INFO
dec. 21, 2022 8:14:23 FM FINE hudson.plugins.xshell.XShellBuilder
Command line: echo "Hello World"
dec. 21, 2022 8:14:23 FM FINE hudson.plugins.xshell.XShellBuilder
Working directory: /Users/jenkins/jenkins/workspace/TEST-JOB-MAC-STRANGE-WS-PATH/
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Unmodified command line: echo "Hello World"
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Regex to kill:
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Time allocated before kill:
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
File separators sanitized: echo "Hello World"
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Expanded build environment vars: echo "Hello World"
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Environment variables sanitized: echo "Hello World"
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Execute from working directory: echo "Hello World"
dec. 21, 2022 8:15:07 FM FINEST hudson.plugins.xshell.XShellBuilder
Omitting env vars
...
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Command line: echo "Hello World"
dec. 21, 2022 8:15:07 FM FINE hudson.plugins.xshell.XShellBuilder
Working directory: /Users/Jenkins/jenkins/workspace/TEST-JOB-MAC-STRANGE-WS-PATH
It looks like the xshell plugin on a Windows controller does not support non-Windows agents. I don't have macOS. The closest approximation I have is FreeBSD. The FreeBSD failure mode looks very close to the macOS failure mode.
Works on Linux controller
The steps I took that worked as expected were:
Create a freestyle project on my Linux controller and limit it to only run on a FreeBSD agent
Add an XShell build step that performs the command echo "Hello World"
Run the freestyle project and confirm that "Hello World" is output as expected
Fails on Windows controller
The steps I took that failed were:
Create a freestyle project on a Windows controller with a FreeBSD agent and limit the job to only run on a FreeBSD agent
Add an XShell build step that performs the command echo "Hello World"
Run the freestyle project and confirm that the job fails. The job output is:
Started by user Mark Waite
Running as SYSTEM
Building remotely on freebsd-13-c (FreeBSD) in workspace /tmp/agent-a/workspace/JENKINS-70323-xshell-bad-path
[JENKINS-70323-xshell-bad-path] $ echo "Hello World"
FATAL: Command execution failed.
java.io.IOException: Process working directory '/usr/home/mwaite/tmp/\tmp\agent-a\workspace\JENKINS-70323-xshell-bad-path' doesn't exist!
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:223)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1398)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1340)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
at java.base/java.lang.Thread.run(Thread.java:829)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to freebsd-13-c
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1000)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1124)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.plugins.xshell.XShellBuilder.perform(XShellBuilder.java:162)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
at hudson.model.Run.execute(Run.java:1899)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Build step 'Invoke XShell command' marked build as failure
Finished: FAILURE
I don't plan to work on this issue. Other issues are higher priority for me. You can work around the issue by using a conditional build step to run a shell step when the agent is non-Windows and a bat step when the agent is Windows. You can work around the issue by using a non-Windows controller (Linux, macOS, FreeBSD, etc.).
Mark Waite
added a comment - It looks like the xshell plugin on a Windows controller does not support non-Windows agents. I don't have macOS. The closest approximation I have is FreeBSD. The FreeBSD failure mode looks very close to the macOS failure mode.
Works on Linux controller
The steps I took that worked as expected were:
Create a freestyle project on my Linux controller and limit it to only run on a FreeBSD agent
Add an XShell build step that performs the command echo "Hello World"
Run the freestyle project and confirm that "Hello World" is output as expected
Fails on Windows controller
The steps I took that failed were:
Create a freestyle project on a Windows controller with a FreeBSD agent and limit the job to only run on a FreeBSD agent
Add an XShell build step that performs the command echo "Hello World"
Run the freestyle project and confirm that the job fails. The job output is:
Started by user Mark Waite
Running as SYSTEM
Building remotely on freebsd-13-c (FreeBSD) in workspace /tmp/agent-a/workspace/JENKINS-70323-xshell-bad-path
[JENKINS-70323-xshell-bad-path] $ echo "Hello World"
FATAL: Command execution failed.
java.io.IOException: Process working directory '/usr/home/mwaite/tmp/\tmp\agent-a\workspace\JENKINS-70323-xshell-bad-path' doesn't exist!
at hudson.Proc$LocalProc.<init>(Proc.java:252)
at hudson.Proc$LocalProc.<init>(Proc.java:223)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:997)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1398)
at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1340)
at hudson.remoting.UserRequest.perform(UserRequest.java:211)
at hudson.remoting.UserRequest.perform(UserRequest.java:54)
at hudson.remoting.Request$2.run(Request.java:376)
at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:125)
at java.base/java.lang.Thread.run(Thread.java:829)
Suppressed: hudson.remoting.Channel$CallSiteStackTrace: Remote call to freebsd-13-c
at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1784)
at hudson.remoting.UserRequest$ExceptionResponse.retrieve(UserRequest.java:356)
at hudson.remoting.Channel.call(Channel.java:1000)
at hudson.Launcher$RemoteLauncher.launch(Launcher.java:1124)
at hudson.Launcher$ProcStarter.start(Launcher.java:509)
at hudson.plugins.xshell.XShellBuilder.perform(XShellBuilder.java:162)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:816)
at hudson.model.Build$BuildExecution.build(Build.java:199)
at hudson.model.Build$BuildExecution.doRun(Build.java:164)
at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:524)
at hudson.model.Run.execute(Run.java:1899)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:44)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Build step 'Invoke XShell command' marked build as failure
Finished: FAILURE
I don't plan to work on this issue. Other issues are higher priority for me. You can work around the issue by using a conditional build step to run a shell step when the agent is non-Windows and a bat step when the agent is Windows. You can work around the issue by using a non-Windows controller (Linux, macOS, FreeBSD, etc.).
[{"id":-1,"name":"My open issues","jql":"assignee = currentUser() AND resolution = Unresolved order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":true},{"id":-2,"name":"Reported by me","jql":"reporter = currentUser() order by created DESC","isSystem":true,"sharePermissions":[],"requiresLogin":true},{"id":-4,"name":"All issues","jql":"order by created DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-5,"name":"Open issues","jql":"resolution = Unresolved order by priority DESC,updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-9,"name":"Done issues","jql":"statusCategory = Done order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-3,"name":"Viewed recently","jql":"issuekey in issueHistory() order by lastViewed DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-6,"name":"Created recently","jql":"created >= -1w order by created DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-7,"name":"Resolved recently","jql":"resolutiondate >= -1w order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false},{"id":-8,"name":"Updated recently","jql":"updated >= -1w order by updated DESC","isSystem":true,"sharePermissions":[],"requiresLogin":false}]
It looks like the xshell plugin on a Windows controller does not support non-Windows agents. I don't have macOS. The closest approximation I have is FreeBSD. The FreeBSD failure mode looks very close to the macOS failure mode.
Works on Linux controller
The steps I took that worked as expected were:
Fails on Windows controller
The steps I took that failed were:
I don't plan to work on this issue. Other issues are higher priority for me. You can work around the issue by using a conditional build step to run a shell step when the agent is non-Windows and a bat step when the agent is Windows. You can work around the issue by using a non-Windows controller (Linux, macOS, FreeBSD, etc.).