1. 程式人生 > >jenkins使用Publish Over SSH中遇到的問題

jenkins使用Publish Over SSH中遇到的問題

source stack start cti execute ren ons work ref

在jenkins中想使用publish over ssh來在構建後發送XML或PNG文件至服務器,以便做其它的操作,安裝完publish over ssh後,填加構建,發現在構建失敗時,不傳送文件,老提示:

SSH: Current build result is [FAILURE], not going to run.



一直不知道原因,按照stackoverflow也無法解決.https://stackoverflow.com/questions/31386012/jenkins-publish-over-ssh-after-failed-build

沒辦法,只有查看官網看看有沒有線索

官網網站:https://wiki.jenkins.io/display/JENKINS/Publish+Over+SSH+Plugin

有這樣一段說明:


Build wrappers


There will be two new options in the Build Environment section of the job configuration


    1. Send files or execute commands over SSH before the build starts
      This allows SSH to be used before a build begins, but after the workspace has been configured and source checked out
      Most useful for maven project types
    2. Send files or execute commands over SSH after the build runs
      As long as the build was attempted, this will run after the build finishes, and will run whether the build is successful or not
      This allows cleanup or shutdown of services started before or during the build
      Use the publisher (Send build artifacts over SSH in Post-build Actions) to publish build artifacts from succesful builds
 

原來問題在這裏,什麽意思呢?翻譯一下吧

在構建環境選項中,也可以使用public by ssh,這裏使用是無論構建成功與否都會執行public by ssh;然後如果使用publisher,在構建後操作就只能在構建成功時才會執行ssh

來圖說明下吧

下圖選擇後,無論構建成功與否都會進行SSH發文件

技術分享

如果在選擇增加構建後操作步驟,就只能構建成功後才會SSH

技術分享

看來多看官網才是正解

jenkins使用Publish Over SSH中遇到的問題