2016-03-28 14 views
1

JenkinsとPowerShellを統合しようとすると1 mmです。 PowerShellのスクリプトジョブが以下のように失敗しているので、このエラーを解決するのは難しいと思っています。Jenkinsエラー:JenkinsとのPowershellの統合

[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内でスクリプトをどのように実行しようとしているかを示す必要があります。ジェンキンスのビルドステップのスクリーングラブが役立ちます。 – rrirower

答えて

2

私はジーンズを試す前にこれをローカルにチェックすることをお勧めします。

あなたはプラグインを使用するか、再確認したファイルパスしようとした外部ファイルを実行しようとした場合:

をシステムがファイルを見つけることができませんFATAL指定:コマンドの実行にはにjava.io.IOExceptionが失敗しました:実行できませんプログラム "powershell.exe"

powershellのexeパスが間違っています。

+0

はい、あなたは正しいです、私のシステム環境変数では、powershell.exeのパスが正しくありませんでした。ありがとう – Nash

+0

@Nashこれがあなたの問題を解決した場合、それを受け入れられた回答としてマークしてください。 –

0

最後に解決しました。 基本的に私のシステム環境変数では、powershell.exeのパスが正しくありませんでした。それから私のJenkinsの仕事を走らせましたが、それと同じエラーです。 そこで、システムを再起動して、Jenkins Powershell Jobを正常に実行しました。

おかげ

0

これは他の誰を助けるが、つもり後世のためにそれを書き留めますかどうかわかりません。スレーブが実行中で接続されていることを確認してください。 Windows Jenkinsスレーブが切断されたときにこのエラーが発生しましたが、マスター(Linuxマシン)上で実行されるように「このビルドを実行できる場所を制限する」設定をしていませんでした。明らかに、そこにはpowershell.exeが見つかりませんでした。 :D

関連する問題