I mm versucht, PowerShell mit Jenkins zu integrieren. Ich finde es schwierig, diesen Fehler zu beheben, da mein PowerShell-Skriptjob fehlschlägt, wie unten gezeigt.Jenkins Fehler: Powershell Integration mit 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
Ich habe andere ähnliche Beiträge in Bezug auf das gleiche Problem gesehen, konnte das Problem jedoch nicht lösen. Vielen Dank im Voraus – Nash
Ich habe fast keine Erfahrung mit Jenkins, und keine Erfahrung mit Jenkins unter Windows, aber meine erste Vermutung wäre, dass es ein PATH-Problem ist. 'powershell.exe' befindet sich in' C: \ Windows \ System32 \ WindowsPowerShell \ v1.0'. Hast du versucht, es mit seinem vollständigen Pfad anzurufen? –
Sie sollten zeigen, wie Sie das Skript in Jenkins ausführen möchten. Ein Screenshot des Jenkins Build Steps sollte helfen. – rrirower