2016-03-28 9 views
1

I мм пытается интегрировать PowerShell с Дженкинсом. Мне трудно решить эту ошибку, поскольку мое сценарий PowerShell не работает, как показано ниже.Jenkins Ошибка: интеграция Powershell с Jenkins

[own-machine-powershell-job] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Windows\TEMP\hudson3566059468296731803.ps1'" 
The system cannot find the file specified 
FATAL: command execution failed 
java.io.IOException: Cannot run program "powershell.exe" (in directory "C:\jenkins\workspace\own-machine-powershell-job"): CreateProcess error=2, The system cannot find the file specified 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.(Proc.java:244) 
    at hudson.Proc$LocalProc.(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:120) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:48) 
    at hudson.remoting.Request$2.run(Request.java:326) 
    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:62) 
    at java.lang.Thread.run(Unknown Source) 
    at ......remote call to Powershell-Job(Native Method) 
    at hudson.remoting.Channel.attachCallSiteStackTrace(Channel.java:1416) 
    at hudson.remoting.UserResponse.retrieve(UserRequest.java:220) 
    at hudson.remoting.Channel.call(Channel.java:781) 
    at hudson.Launcher$RemoteLauncher.launch(Launcher.java:929) 
    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:785) 
    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.model.FreeStyleBuild.run(FreeStyleBuild.java:43) 
    at hudson.model.ResourceController.execute(ResourceController.java:98) 
    at hudson.model.Executor.run(Executor.java:408) 
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.(Unknown Source) 
    at java.lang.ProcessImpl.start(Unknown Source) 
    at java.lang.ProcessBuilder.start(Unknown Source) 
    at hudson.Proc$LocalProc.(Proc.java:244) 
    at hudson.Proc$LocalProc.(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:120) 
    at hudson.remoting.UserRequest.perform(UserRequest.java:48) 
    at hudson.remoting.Request$2.run(Request.java:326) 
    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:62) 
    at java.lang.Thread.run(Unknown Source) 
Build step 'Windows PowerShell' marked build as failure 
Finished: FAILURE
+0

Я видел другие похожие сообщения по одной и той же проблеме, но не смог решить проблему. Заранее спасибо – Nash

+1

У меня нет опыта работы с Дженкинсом, и у меня нет опыта с Дженкинсом в Windows, но я предполагаю, что это проблема PATH. 'powershell.exe' находится в' C: \ Windows \ System32 \ WindowsPowerShell \ v1.0'. Вы пытались называть его своим полным путем? –

+0

Вы должны показать, как вы пытаетесь выполнить скрипт в Jenkins. Экранный захват этапа сборки Jenkins должен помочь. – rrirower

ответ

2

Моя рекомендация - проверить это локально, прежде чем пытаться использовать jenkins.

Если вы пытались использовать плагин или выполнить внешнюю попытку файла повторно проверить путь к файлу:

Система не может найти указанный файл FATAL: выполнение команды не удалось java.io.IOException: Может не работать программа "powershell.exe"

Неверный путь EXE-переключателей powershell.

+0

Да, вы правы, в переменных моей системной среды путь powershell.exe неверен. Спасибо – Nash

+0

@Nash, если это решит вашу проблему, можете ли вы пометить ее как принятый ответ? –

0

Я окончательно его разрешил. В основном, в переменных моей системной среды путь powershell.exe был неправильным, и я исправил его. Затем запустил мою работу Дженкинса, но все равно та же ошибка. Итак, я перезапустил свою систему, а затем успешно выполнил работу Jenkins Powershell Job.

Благодаря

0

Не уверен, если это поможет кому-либо еще, но собираюсь записать это только для потомков. Убедитесь, что ваш ведомый работает и подключен. Я видел эту ошибку, когда мой раб Windows Jenkins был отключен, но я не установил «ограничение, в котором эта сборка может работать», поэтому он работал на моем хозяине (машине Linux). Очевидно, он не смог найти файл powershell.exe. : D