2013-02-28 131 views
1

我正在使用並行任務來測試和關閉我的服務器。捕獲構建失敗Ant

下面是代碼:

 <target name="runandtest" description="run the server and test it"> 
      <parallel timeout="1380000"> 
      <sshexec host="XXX.XX.XX.XX" username="XXXXX" password="xxxxxxxxx" trust="true" command='cd test;nohup bin/server > log.txt'/> 
      <sequential> 
       <sleep seconds="1200"/> 
       <!-- run test--> 
       <scp file="XXXXXX:[email protected]:/home/XXXXX/test/log.txt" todir="/ant/" trust="true" />   
       <mail enableStartTLS="true" mailhost="smtp.gmail.com" mailport="587" user="XXXXXXX" password="XXXXXXX" subject="Run test" from="XXXXXXXX" tolist="XXXXXXX" files="log.txt" message="blabla"/> 
      <!-- FAIL BELOW -->  
       <sshexec host="XXX.XX.XX.XX" username="XXXX" password="XXXXX" trust="true" command="kill $(ps aux | grep '[s]erver' | awk '{print $2}')"/> 
      </sequential> 
      </parallel> 
     </target> 

,我已經寫評論的構建失敗。

這確實是非常合乎邏輯的,因爲一旦我的測試完成,我只需在同一臺服務器上ssh就可以殺死第一個並行任務的進程。

但是在我的run-test-shutdown過程中,這是一個完全正常的行爲,所以我想知道是否有可能發生這種BUILD FAIL錯誤,以便我的螞蟻項目可以繼續。

謝謝。

回答

1

螞蟻sshexec任務具有屬性failonerror,該屬性默認爲true - 也許您可以將其設置爲false以關閉目標。