2017-06-15 196 views
0

我有兩個作業叫做ParentJobChildJobParentJob觸發下游作業ChildJob即使傳遞true,Jenkins DSL booleanCondition()也不會返回true

ParentJob我傳遞的變量作爲

parameters { 
      predefinedProp('RELEASE','true') 
      } 

ChildJob我正在採摘參數作爲

conditionalSteps { 
     condition { 
     booleanCondition("RELEASE") 
     steps { 
      shell("echo 'Wow !!! condition is parsed as true'") 
     } 
     } 

ChildJob的參數頁面上,我可以看到它正確地來作爲true

enter image description here

仍然行shell("echo 'Wow !!! condition is parsed as true'")未執行。在日誌中,我可以看到:

09:35:41 Run condition [Boolean condition] enabling prebuild for step [BuilderChain] 
09:35:41 [Boolean condition] checking [RELEASE] against [^(1|y|yes|t|true|on|run)$] (origin token: RELEASE) 
09:35:41 Run condition [Boolean condition] preventing perform for step [BuilderChain] 
09:35:41 Finished: SUCCESS 

我甚至嘗試通過爲falseParentJob的工作,仍然是同樣的結果。我究竟做錯了什麼?

回答

0

我錯誤地訪問了令牌,其中正確的方法是booleanCondition('${RELEASE}')

這應該是正確的方法:

conditionalSteps { 
     condition { 
     booleanCondition('${RELEASE}') 
     steps { 
      shell("echo 'Wow !!! condition is parsed as true'") 
     } 
     } 
    } 
相關問題