【发布时间】:2019-10-09 02:19:10
【问题描述】:
我是 jenkins 的新手,我正在尝试使用凭证插件在 dsl 中使用凭证
模板.xml
<com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
<scope>GLOBAL</scope>
<id>PROD</id>
<description>prod credentials</description>
<username>prod</username>
<password>{{ encrypted_password_prod }}</password
</com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl>
我已将 jenkins 中的凭据定义为 username with password 。上面的加密值保存在ansible中。
我的问题是我应该如何在我的 dsl 中调用它们
Map credentials = [:]
credentialsBinding {
credentials.each { key, value ->
string("${key}", "${value}")
}
.credentials(["TF_VAR_username": "PROD" ,"TF_VAR_password" : "password_prod"])
错误:
22:11:16 致命:凭据“PROD”属于“用户名和密码”类型 'org.jenkinsci.plugins.plaincredentials.StringCredentials' 在哪里 预计
【问题讨论】:
标签: jenkins jenkins-plugins jenkins-groovy jenkins-job-dsl