
@daspilker和@JesseGlick,非常感谢您的回复。它帮助我用Jenkins编写了我的第一个configure块。提及我的行为,以便对其他面临相同问题的人有所帮助。
由于我们正在使用Job DSL 1.27,因此我无法直接使用凭据绑定。因此创建了一个configure块,并通过我的.groovy脚本注入了所需的变量。
注意:如果收到“找不到credentialsId”错误,则需要从“ * / job / config.xml”获取“
credentialsId”的转换值。
static def credentialsBinding = { String userNameVar, String passwordVar, String credId, wrapperContext -> def nodeBuilder = new NodeBuilder() wrapperContext.wrapperNodes << nodeBuilder.'org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper'(plugin: "credentials-binding@1.4") { bindings { 'org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding' { usernameVariable userNameVar passwordVariable passwordVar credentialsId credId } } }}欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)