2017-02-06 8 views
0

Jenkins Jobを実行しています。私の.csprojファイルをビルドし、PSスクリプトをほとんど実行しません。 PSスクリプトが失敗した場合でも、成功したメールを受け取ることができます。PSスクリプトが失敗した場合でもJenkins Jobにメールを送信する方法を教えてください。Jenkins PSスクリプトの実行に失敗した後でも正常にビルドされます

エラーLogs-

Copy-Item : The process cannot access the file 
'\\10.0.1.190\d$\Build\RPC\Fortius.RPC.AirSearch\Common.Logging.Core.dll' because it is being used by another process. 
At C:\Users\Administrator\AppData\Local\Temp\hudson9059014122834846757.ps1:3 char:1 
+ Copy-Item "C:\AirSearchBnd\src\Fortius.Air.Search.RPC.Host\bin\Release\*" "\\$en ... 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [Copy-Item], IOException 
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.CopyItemCommand 



[AirSearchBnd] $ powershell.exe -NonInteractive -ExecutionPolicy ByPass "& 'C:\Users\ADMINI~1\AppData\Local\Temp\hudson9149103993066004448.ps1'" 
[SC] CreateService SUCCESS 

SERVICE_NAME: AirSearchWindowsService 
     TYPE    : 10 WIN32_OWN_PROCESS 
     STATE    : 2 START_PENDING 
           (STOPPABLE, NOT_PAUSABLE, ACCEPTS_SHUTDOWN) 
     WIN32_EXIT_CODE : 0 (0x0) 
     SERVICE_EXIT_CODE : 0 (0x0) 
     CHECKPOINT   : 0x0 
     WAIT_HINT   : 0x0 
     PID    : 13784 
     FLAGS    : 
> C:\Program Files (x86)\Git\bin\git.exe tag -l RPCBUILD_6 # timeout=10 
> C:\Program Files (x86)\Git\bin\git.exe tag -a -f -m Jenkins Git plugin tagging with RPCBUILD_6 RPCBUILD_6 # timeout=10 
Pushing tag RPCBUILD_6 to repo Dev 
> C:\Program Files (x86)\Git\bin\git.exe --version # timeout=10 
using GIT_ASKPASS to set credentials 
> C:\Program Files (x86)\Git\bin\git.exe push https://github.com/WorldVenturesHoldings/Fortius.Services.Air.Search.git RPCBUILD_6 
Email was triggered for: Always 
Sending email for trigger: Always 
Request made to compress build log 
Sending email to: [email protected] [email protected] [email protected] [email protected] 
Finished: SUCCESS 

答えて

2

最も簡単な方法は、上で電子メールを送信するためにジェンキンスを設定することで失敗した構築し、PowerShellの段階で最後に次の行を追加します。

if ($error) { exit 1 } 

ジェンキンスPowerShellのプラグインの問題は、それがないということですPowershellで発生したエラーを尊重してください。シェル自体の終了コードだけが残っていれば、ビルドが失敗して電子メールがトリガされます。

0

"ログの構築取り付け" のオプションがあります。 psスクリプトが失敗したかどうかを確認するために、ビルドログを読むことができます。

+0

私は既にこれを設定しているので、これ以外の代替ソリューションがありますか? – Kally

+0

これは質問に対する答えではありません。 @私の答えを確認してください、それは助ける必要があります – 4c74356b41

関連する問題