說明繼續:與超時輸入步驟,使用默認設置詹金斯管道所需詹金斯管道
- 等待1分鐘輸入(「這是一個發佈版本是/否?」)
- 如果輸入爲是,則做一個釋放型版本(帶版本號和部署)
- 如果超時或用戶說沒有然後做一個測試建立
- 如果用戶按下中止做正常中止
我當前的代碼是:
try {
timeout(1) {
input message: 'Do you want to release this build?',
parameters: [[$class: 'BooleanParameterDefinition',
defaultValue: false,
description: 'Ticking this box will do a release',
name: 'Release']]
}
} catch (err) {
def hi = err.getCauses()
echo "Exception thrown:\n ${hi}"
echo err.getLocalizedMessage()
echo err.getCause()
echo err.toString()
echo err.getClass().getName()
}
但是這給了相同的(只要我可以告訴)的行爲,並抓住按下「取消」,並輸入超時爲用戶錯誤。
這裏是超時輸出:
[Pipeline] timeout
[Pipeline] {
[Pipeline] input
Input requested
[Pipeline] }
[Pipeline] // timeout
[Pipeline] echo
Exception thrown:
[[email protected]94906]
[Pipeline] echo
null
[Pipeline] echo
null
[Pipeline] echo
org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
[Pipeline] echo
org.jenkinsci.plugins.workflow.steps.FlowInterruptedException
[Pipeline] End of Pipeline
Finished: SUCCESS
當我按下「中止」這是除了拒絕後六角@
同樣這將是巨大的,如果輸入步驟可以可選在超時後繼續使用默認選項。
編輯:添加更多的打印到錯誤,試圖確定它的類型
在手動中止和超時時引發的異常類是否正確? – izzekil
我已經添加了一些打印到上面的代碼,嘗試打印所有我能想到的值,但它們看起來完全相同。也許當他們超時超時它取消輸入節點產生相同的輸出作爲按abort? –