Jenkins job DSL plugin - hidden parameter

你离开我真会死。 提交于 2019-12-06 04:54:08

Job DSL has no built-in support for the Hidden Parameter plugin, so it's not mentioned in the API viewer. But it's supported by the Automatically Generated DSL:

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

BEfore using the declarative pipeline syntax (described in jenkinsci/pipeline-model-definition-plugin), you would have used:

But with the pure DSL pipeline syntax, this is not yet supported (April 2017).

The last issue though points out to JENKINS-29922 (Promote delegates of metasteps to top-level functions, deprecate $class) and adds the comment:

JENKINS-29922 is implemented, so assuming a @Symbol is defined for each credentials kind, and a credentials step is marked metaStep, you could write more simply:

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

or even allow the id to be generated, and return it from the step:

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

While that is encrypted, that is not exactly "hidden" though.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!