2014-10-29 190 views
1

使用Mask密码插件我在Manage Jenkins中添加了变量 - > Mask Passwords - 全局名称/密码对。 如何通过动态选择参数中作业的参数化部分中的Groovy脚本获取它? (在我的Groovy脚本我需要指定密码来获取信息,我想隐藏一些东西)如何在Groovy脚本中获取Jenkins Mask密码变量

+0

所以你需要在你的groovy脚本中指定密码来填充选项以显示用户供他们选择? – KeepCalmAndCarryOn 2014-10-29 19:49:17

+0

我尝试为用户提供git标签选择:'def gitURL =“http:/ username:[email protected]” def command =“git ls-remote -t​​ $ gitURL” def proc = command.execute ) proc.waitFor() 如果(proc.exitValue()!= 0){ 的println “错误,$ {} proc.err.text” System.exit(-1) } 高清标签= proc.in.text.readLines()。collect { it.replaceAll(/ [a-z0-9] * \ trefs \/tags \ //,'') } 标签' – fred05 2014-10-30 09:58:38

+0

这个插件是做什么的你要? https://wiki.jenkins-ci.org/display/JENKINS/Git+Parameter+Plugin – KeepCalmAndCarryOn 2014-10-30 11:14:12

回答

0

这里是如何使用它的哈希来解密密码:

hashed_pw='your-sercret-hash-S0SKVKUuFfUfrY3UhhUC3J' 
passwd = hudson.util.Secret.decrypt(hashed_pw) 
println(passwd) 

我敢肯定还有其他的如何找到密码的散列,但它的一种方式来查找credentials.xml

相关问题