天天看點

jenkins執行腳本不退出

ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after XXX ms

錯誤資訊:

Waiting for Jenkins to finish collecting data

[JENKINS] Archiving /shfb_30/.jenkins/workspace/apollo_test/pom.xml to com.shfb.mobile/mobile/1.0-SNAPSHOT/mobile-1.0-SNAPSHOT.pom

[JENKINS] Archiving /shfb_30/.jenkins/workspace/apollo_test/target/mobile-1.0-SNAPSHOT.jar to com.shfb.mobile/mobile/1.0-SNAPSHOT/mobile-1.0-SNAPSHOT.jar

channel stopped

SSH: Connecting from host [iZ25txgf5wsZ]

SSH: Connecting with configuration [45.26_jenkins_docker] ...

SSH: EXEC: STDOUT/STDERR from command [/shfb_50G/apollo/apollo.sh] ...

開始運運作腳本

SSH: Disconnecting configuration [45.26_jenkins_docker] ...

ERROR: Exception when publishing, exception message [Exec timed out or was interrupted after 68,342 ms]

Build step 'Send build artifacts over SSH' changed build result to UNSTABLE

Finished: UNSTABLE

我在使用Jenkins進行遠端部署時,建構後執行的腳本沒有正常退出導緻。

我的腳本沒有寫錯,幹的事情就是啟動項目。

而導緻它沒有正常退出的原因是:

Since you are executing a script from a non-TTY environment; The Jenkins is not able to get the exit properly, out of your script.

意思是:因為你是從一個非tty環境執行腳本;Jenkins不能正常從你的腳本中退出。

解決辦法:

外國網友解釋:

因為您正在執行一個非tty環境的腳本;jenkins不能正确地離開你的腳本。

What you want is to exit immediately, after script execution! Don't want to wait for the entire timeout to happen and then disconnect improperly!

您想要的是在腳本執行後立即退出!不要等待整個逾時發生,然後錯誤地斷開連接配接!

Solution: Make it Exec in PTY. (Please tick the check-box as shown in attached screenshot)

解決方案:在PTY中使用Exec