Я работаю в среде разработки, в которой для выполнения заданий по сборке и тестированию используется 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$2.run(Request.java:325)
at hudson.remoting.InterceptingExecutorService$1.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$1$1.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$1.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$2.run(Request.java:325)
at hudson.remoting.InterceptingExecutorService$1.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$1$1.run(Engine.java:69)
at java.lang.Thread.run(Unknown Source)
Похоже, что Дженкинс не знает, что этот последний рабмашина Windows, в результате чего она запускается sh -e
вместо cmd /c
.
У вас есть идеи, почему Jenkins не может распознать это как машину Windows?И можете ли вы придумать какой-либо способ исправить эту проблему, кроме установки чего-то вроде Cygwin ?