2017-04-09 515 views

回答

0

之前使用declarative pipeline syntax(在jenkinsci/pipeline-model-definition-plugin描述),你會使用:

但隨着pure DSL pipeline syntax,這尚未得到支持(2017年4月)。

的最後一個問題,雖然指出了JENKINS-29922 (Promote delegates of metasteps to top-level functions, deprecate $class),並增加了the comment

JENKINS-29922實現,所以假設@Symbol爲一種每個證書的定義,並且憑據步驟被標記metaStep,你可以寫更簡單地說:

usernamePassword id: 'hipchat-login', username: 'bob', password: 'abc/def+GHI0123=' 
hipchat server: …, message: …, credentialsId: 'hipchat-login' 

甚至允許ID是GE nerated,並從步驟返回它:

hipchat server: …, message: …, credentialsId: usernamePassword(username: 'bob', password: 'abc/def+GHI0123=') 

雖然這是加密的,這是不完全「隱藏」雖然。

3

作業DSL沒有內置的對隱藏參數插件的支持,所以它在API查看器中沒有提及。但它支持的Automatically Generated DSL

job('example') { 
    parameters { 
    wHideParameterDefinition { 
     name('FOO') 
     defaultValue('bar') 
     description('lorem ipsum') 
    } 
    } 
} 
+0

這似乎比我的答案更爲確切。 +1 – VonC