Jenkins无法在Windows Slave上启动进程

时间:2015-04-11 04:53:22

标签: java jenkins classpath

Jenkins构建在Windows上运行时,会在构建开始时抛出错误:

   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)

我尝试了什么: 1.指定TF.exe的完整路径 2.在PATH变量中指定TF.exe的路径 3.设置PATH =。在构建过程初始化阶段 4.设置CLASSPATH =。在构建过程初始化阶段 5.设置CLASSPATH =。作为奴隶的环境变量。

TF.exe在任何目录下的Jenkins Slave服务用户下解析,因此它不是TF.exe路径的问题

感谢有关使用Windows Slave和TFS配置Jenkins的任何帮助或想法。

完整的错误日志在下面(是的,它是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)

2 个答案:

答案 0 :(得分:0)

“TF.exe在任何目录下的Jenkins Slave服务用户下解析,因此它不是TF.exe路径的问题”

你还没有完全理解詹金斯是如何运作的。实际上,唯一明确的env变量是全局变量,而用户不考虑用于干净构建。

Jenkins没有任何魔力您应该尝试将PATH设置为构建阶段, RESTART slave,然后运行任务。

答案 1 :(得分:0)

对于遇到此问题的任何人的另一个暗示:
jenkins插件存在一些已知问题导致此问题。
请参阅JENKINS-22183JENKINS-45128JENKINS-33159示例...

或尝试Jenkins issue search