【发布时间】:2014-10-29 17:10:03
【问题描述】:
使用 Mask Password 插件,我在 Manage Jenkins -> Mask Passwords - 全局名称/密码对中添加了变量。 如何在动态选择参数的作业参数化部分通过 Groovy 脚本获取它? (在我的 groovy 脚本中,我需要指定密码才能获取信息,我想隐藏它)
【问题讨论】:
-
所以您需要在您的 groovy 脚本中指定密码以填充选项以向用户显示供他们选择?
-
我尝试为用户选择 git 标签:'def gitURL = "http:/username:how2maskThisPass@giturl.git" def command = "git ls-remote -t $gitURL" def proc = command.execute() proc.waitFor() if ( proc.exitValue() != 0 ) { println "Error, ${proc.err.text}" System.exit(-1) } def tags = proc.in. text.readLines().collect { it.replaceAll(/[a-z0-9]*\trefs\/tags\//, '') } tags'
-
这个插件能做你想做的事吗? wiki.jenkins-ci.org/display/JENKINS/Git+Parameter+Plugin
-
在这种情况下很有用