【发布时间】:2017-01-30 08:46:22
【问题描述】:
我是 Jenkins 的新手,最近想安排一个作业来执行本地 python 脚本。我还没有源代码管理,所以在 Jenkins UI 中创建作业时,我在源代码管理中选择了“无”。
我对如何在 Jenkins UI 中执行 python 脚本进行了一些研究,并尝试使用 Python Plugin 来执行 python 脚本作为构建步骤。但它失败了。 (但实际上我不想使用这个插件,因为我的脚本需要输入参数,所以我认为我需要在 BUILD 字段中选择“执行 shell”之类的东西——我试过但也失败了)谁能帮我找出如何正确运行/调用本地 python 脚本?
PS:我也不清楚 Jenkins 工作区以及它是如何工作的?如果有人可以为我澄清它,将是合适的。
这是我在构建失败后得到的控制台输出:
Started by user Yiming Chen
[EnvInject] - Loading node environment variables.
Building in workspace D:\Application\Jenkins\workspace\downloader
[downloader] $ sh -xe C:\windows\TEMP\hudson3430410121213277597.sh
The system cannot find the file specified
FATAL: command execution failed
java.io.IOException: Cannot run program "sh" (in directory "D:\Application\Jenkins\workspace\downloader"): CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(Unknown Source)
at hudson.Proc$LocalProc.<init>(Proc.java:245)
at hudson.Proc$LocalProc.<init>(Proc.java:214)
at hudson.Launcher$LocalLauncher.launch(Launcher.java:846)
at hudson.Launcher$ProcStarter.start(Launcher.java:384)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:108)
at hudson.tasks.CommandInterpreter.perform(CommandInterpreter.java:65)
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:534)
at hudson.model.Run.execute(Run.java:1728)
at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
at hudson.model.ResourceController.execute(ResourceController.java:98)
at hudson.model.Executor.run(Executor.java:404)
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)
... 16 more
Build step 'Execute shell' marked build as failure
Finished: FAILURE
【问题讨论】:
标签: python jenkins jenkins-plugins