简体   繁体   中英

Jenkins cannot start process on Windows Slave

Jenkins build running on Windows slave throws following error when build starts:

   Java.io.IOException: Cannot run program "tf" (in directory "c:\Jenkins\workspace\ProjectName-WindowsPhone"): CreateProcess error=87, The parameter is incorrect
    at java.lang.ProcessBuilder.start(Unknown Source)

What I tried: 1. specifying full path to the TF.exe 2. specifying path to the TF.exe in the PATH variable 3. setting PATH=. at the build process init stage 4. settings CLASSPATH=. at the build process init stage 5. setting CLASSPATH=. as environment variable on the slave.

TF.exe is resolved under Jenkins Slave service user in any directory, so it's not a problem of path to the TF.exe

Appreciate any help or thoughts on configuring Jenkins with Windows Slave and TFS.

Full error log is below ( yes, it's Java stack trace ;) )

     $ tf workspaces -format:brief -server:https://cloudtfsname.visualstudio.com/DefaultCollection/ ********
    java.io.IOException: Cannot run program "tf" (in directory "c:\Jenkins\workspace\ProjectName-WindowsPhone"): CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessBuilder.start(Unknown Source)
        at hudson.Proc$LocalProc.<init>(Proc.java:244)
        at hudson.Proc$LocalProc.<init>(Proc.java:216)
        at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
        at hudson.Launcher$ProcStarter.start(Launcher.java:381)
        at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1136)
        at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1101)
        at hudson.remoting.UserRequest.perform(UserRequest.java:118)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:328)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at hudson.remoting.Engine$1$1.run(Engine.java:63)
        at java.lang.Thread.run(Unknown Source)
        at ......remote call to WindowsSlave(Native Method)
        at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1356)
        at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
        at hudson.remoting.Channel.call(Channel.java:752)
        at hudson.Launcher$RemoteLauncher.launch(Launcher.java:916)
        at hudson.Launcher$ProcStarter.start(Launcher.java:381)
        at hudson.plugins.tfs.TfTool.execute(TfTool.java:99)
        at hudson.plugins.tfs.model.Server.execute(Server.java:120)
        at hudson.plugins.tfs.model.Workspaces.getListFromServer(Workspaces.java:38)
        at hudson.plugins.tfs.model.Workspaces.populateMapFromServer(Workspaces.java:50)
        at hudson.plugins.tfs.model.Workspaces.exists(Workspaces.java:76)
        at hudson.plugins.tfs.actions.CheckoutAction.checkout(CheckoutAction.java:36)
        at hudson.plugins.tfs.TeamFoundationServerScm.checkout(TeamFoundationServerScm.java:176)
        at hudson.model.AbstractProject.checkout(AbstractProject.java:1270)
        at hudson.model.AbstractBuild$AbstractBuildExecution.defaultCheckout(AbstractBuild.java:609)
        at jenkins.scm.SCMCheckoutStrategy.checkout(SCMCheckoutStrategy.java:86)
        at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:531)
        at hudson.model.Run.execute(Run.java:1750)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
        at hudson.model.ResourceController.execute(ResourceController.java:89)
        at hudson.model.Executor.run(Executor.java:240)
    Caused by: java.io.IOException: CreateProcess error=87, The parameter is incorrect
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        at java.lang.ProcessBuilder.start(Unknown Source)
        at hudson.Proc$LocalProc.<init>(Proc.java:244)
        at hudson.Proc$LocalProc.<init>(Proc.java:216)
        at hudson.Launcher$LocalLauncher.launch(Launcher.java:803)
        at hudson.Launcher$ProcStarter.start(Launcher.java:381)
        at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1136)
        at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1101)
        at hudson.remoting.UserRequest.perform(UserRequest.java:118)
        at hudson.remoting.UserRequest.perform(UserRequest.java:48)
        at hudson.remoting.Request$2.run(Request.java:328)
        at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at hudson.remoting.Engine$1$1.run(Engine.java:63)
        at java.lang.Thread.run(Unknown Source)

"TF.exe is resolved under Jenkins Slave service user in any directory, so it's not a problem of path to the TF.exe"

You are not fully understanding how jenkins works. In fact the only env variables that are understanded are the global ones and the user one are not considered for clean builds.

There is no any magic in Jenkins You should have tried to set the PATH as a build stage, RESTART slave and then run the task.

another hint for anyone who comes across this:
there are some known issues with jenkins plugins causing this.
see JENKINS-22183 , JENKINS-45128 or JENKINS-33159 for example...

or try Jenkins issue search

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM