1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JenkinsのBuild FlowでMask Passwordを利用してみる

Posted at

JenkinsでBuild Flow PluginMask Passwords Plugin便利に使っている。
しかし、Build Flow PluginからMask Passwords Pluginで設定したパスワードが利用できない。

そこでgroovyで直接Mask Password Pluginで設定した値をとってくるようにしてみた。
プラグインのバージョンアップで利用できなくなったり、正式に対応されたりというのはありそう。
試してみた各プラグインのバージョンはこちら

  • Build Flow Plugin:0.17
  • Mask Passwords Plugin:2.7.2
def getMaskPassword(key) {
  def descriptor = jenkins.model.Jenkins.instance.getBuildWrapper("MaskPasswordsBuildWrapper")
  def pairs = descriptor.getConfig().getGlobalVarPasswordPairs()
  for (pair in pairs) {
    if (pair.getVar() == key) {
      return pair.getPassword() 
    }
  }
}

println getMaskPassword("password")
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?