在我的两个 Windows 奴隶之一上安装 ant-1.10 x 失败

Installing ant-1.10 x fails on one of my two Windows slaves

我在使用 Jenkins 1.620 进行 运行 构建和测试作业的开发环境中工作。

我们使用 Ant 插件 1.5 和 Mercurial 插件 1.54 分别与 Ant 和 Mercurial 集成:

在我们的一项构建工作中,我正在尝试 运行 ant-1.10 x :

这在我们的 Linux 奴隶上按预期工作:

[28ed6df2] $ /usr/bin/hg log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('349ba3fc4e01c8a12fcfbe8d69c3e23913c5122f') and not ancestors(cadec7ae4013241d45a0ca048c801ad55d751604)" --encoding UTF-8 --encodingmode replace
[ant-1.10.x] $ sh -e /home/release/jenkins-slave/tools/hudson.tasks.Ant_AntInstallation/ant-1.10.x/hudson1700384793561784219.sh
pulling from https://elmo.luciad.com/hg/tools/devscripts/
searching for changes
no changes found
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[28ed6df2] $ /home/release/jenkins-slave/tools/hudson.tasks.Ant_AntInstallation/ant-1.10.x/devscripts/ant/apache-ant-1.10.x/bin/ant -Djdk=8u121 -Dlabel_exp=linux&&chrome&&firefox&&nodejs -Dria.testconfig=common/test/responsibilities/milsym clean test
Buildfile: /home/release/jenkins-slave/workspace/LuciadRIA - 2017.1 - TEST - MilSym/28ed6df2/build.xml

它在我们的 Windows 个奴隶上按预期工作:

[ab4857c1] $ "C:\Program Files\TortoiseHg/hg" log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('cadec7ae4013241d45a0ca048c801ad55d751604') and not ancestors(20171294f31b5a54c90d7a7ca843d54af5235fdb)" --encoding UTF-8 --encodingmode replace
[ant-1.10.x] $ cmd /c call C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x\hudson3353656856975714646.bat

C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x>IF EXIST devscripts (hg -R devscripts pull )  ELSE (hg clone -U "https://elmo.luciad.com/hg/tools/devscripts/" ) 
pulling from https://elmo.luciad.com/hg/tools/devscripts/
searching for changes
no changes found

C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x>hg -R devscripts up -C default 
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
[ab4857c1] $ cmd.exe /C '"C:\Users\release\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x\devscripts\ant\apache-ant-1.10.x\bin\ant.bat -Djdk=8u121 "-Dlabel_exp=windows10&&chrome&&firefox&&edge&&ie11&&nodejs" -Dria.testconfig=common/test/responsibilities/milsym clean test && exit %%ERRORLEVEL%%"'
Buildfile: C:\Users\release\jenkins-slave\workspace\LuciadRIA - 2017.1 - TEST - MilSym\ab4857c1\build.xml

然而,在我们的另一个 Windows 奴隶上,它失败了:

[ab4857c1] $ "C:\Program Files\TortoiseHg/hg" log --template "<changeset node='{node}' author='{author|xmlescape}' rev='{rev}' date='{date}'><msg>{desc|xmlescape}</msg><added>{file_adds|stringify|xmlescape}</added><deleted>{file_dels|stringify|xmlescape}</deleted><files>{files|stringify|xmlescape}</files><parents>{parents}</parents></changeset>\n" --rev "ancestors('cadec7ae4013241d45a0ca048c801ad55d751604') and not ancestors(20171294f31b5a54c90d7a7ca843d54af5235fdb)" --encoding UTF-8 --encodingmode replace
[ant-1.10.x] $ sh -e C:\Users\jslegers\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x\hudson6544351975704303707.sh
The system cannot find the file specified
FATAL: Cannot run program "sh" (in directory "C:\Users\jslegers\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x"): CreateProcess error=2, The system cannot find the file specified
java.io.IOException: Cannot run program "sh" (in directory "C:\Users\jslegers\jenkins-slave\tools\hudson.tasks.Ant_AntInstallation\ant-1.10.x"): CreateProcess error=2, The system cannot find the file specified
    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:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request.run(Request.java:325)
    at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
    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.run(Engine.java:69)
    at java.lang.Thread.run(Unknown Source)
    at ......remote call to dover(Native Method)
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1361)
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:221)
    at hudson.remoting.Channel.call(Channel.java:753)
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$ProcStarter.join(Launcher.java:389)
    at hudson.tools.AbstractCommandInstaller.performInstallation(AbstractCommandInstaller.java:77)
    at hudson.tools.InstallerTranslator.getToolHome(InstallerTranslator.java:68)
    at hudson.tools.ToolLocationNodeProperty.getToolHome(ToolLocationNodeProperty.java:108)
    at hudson.tools.ToolInstallation.translateFor(ToolInstallation.java:206)
    at hudson.tasks.Ant$AntInstallation.forNode(Ant.java:430)
    at hudson.tasks.Ant.perform(Ant.java:169)
    at hudson.tasks.BuildStepMonitor.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1741)
    at hudson.matrix.MatrixRun.run(MatrixRun.java:146)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:381)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    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:816)
    at hudson.Launcher$ProcStarter.start(Launcher.java:382)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1149)
    at hudson.Launcher$RemoteLaunchCallable.call(Launcher.java:1114)
    at hudson.remoting.UserRequest.perform(UserRequest.java:121)
    at hudson.remoting.UserRequest.perform(UserRequest.java:49)
    at hudson.remoting.Request.run(Request.java:325)
    at hudson.remoting.InterceptingExecutorService.call(InterceptingExecutorService.java:68)
    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.run(Engine.java:69)
    at java.lang.Thread.run(Unknown Source)

Jenkins 似乎不知道后一个 slave 是 Windows 机器,导致它 运行 sh -e 而不是 cmd /c.

您知道为什么 Jenkins 无法将其识别为 Windows 机器吗?除了安装 Cygwin?

之类的东西之外,你能想出任何方法来解决这个问题吗?

我的第二个奴隶有标签 win64windows10,但没有 windows

缺少此标签导致从站无法被识别为 Windows 机器。

添加标签解决了问题。