2017-04-09 514 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