在jenkins中运行命令shell [英] Run a command shell in jenkins
本文介绍了在jenkins中运行命令shell的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在Jenkins中执行命令shell,我在Windows 7上工作。在控制台输出中,我有:
在工作区中构建C:\Program Files(x86)\Jenkins\workspace\test
[test] $ sh -xe C:\Windows\TEMP\hudson6299483223982766034.sh
系统找不到指定的文件
FATAL:L'exécutionde la commande aéchoué。
java.io.IOException:无法运行程序sh(在目录C:\Program Files(x86)\Jenkins\workspace\test中):CreateProcess error = 2,Le fichierspécifiéest introuvable
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.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
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:1744)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
原因:java.io.IOException:CreateProcess error = 2,Le fichierspécifiéest introuvable
at java.lang.ProcessImpl .create(Native Method)
at java.lang.ProcessImpl。< init>(未知来源)
at java.lang.ProcessImpl.start(未知来源)
... 16更多
构建步骤'Exécuterun script shell'将生成标记为失败
[BFA]已知原因的扫描构建...
[BFA]未找到失败原因
[BFA]完成。 0s
完成:FAILURE
有什么想法吗?
执行Windows批处理命令。
对于类似Unix的slave像linux或Mac,
对于类似Unix的slave像linux或Mac,
执行shell
是选项。
I'm trying to execute a command shell in Jenkins, I'm working on Windows 7. In the console output I have this:
Building in workspace C:\Program Files (x86)\Jenkins\workspace\test
[test] $ sh -xe C:\Windows\TEMP\hudson6299483223982766034.sh
The system cannot find the file specified
FATAL: L'exécution de la commande a échoué.
java.io.IOException: Cannot run program "sh" (in directory "C:\Program Files (x86)\Jenkins\workspace\test"): CreateProcess error=2, Le fichier spécifié est introuvable
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.tasks.CommandInterpreter.perform(CommandInterpreter.java:97)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:66)
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:1744)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:374)
Caused by: java.io.IOException: CreateProcess error=2, Le fichier spécifié est introuvable
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 16 more
Build step 'Exécuter un script shell' marked build as failure
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Finished: FAILURE
Any idea?
解决方案
For Windows slave, please use Execute Windows batch command
.
For Unix-like slave like linux or Mac, Execute shell
is the option.
这篇关于在jenkins中运行命令shell的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文