【发布时间】:2020-02-06 02:50:28
【问题描述】:
我是 Jenkins Job DSL 的新手,并试图弄清楚如何在我的 DSL 的 scm 部分中使用配置块。我的 Jenkins config.xml 中有一个默认生成的部分
<scm class='hudson.plugins.git.GitSCM'>
<browser class='hudson.plugins.git.browser.GithubWeb'>
<url>https://github.com/repository/</url>
</browser>
</scm>
我知道 Jenkins Job DSL Plugin API 中有一个浏览器方法,您可以将其设置为 gitblit、gitiles、gitLab、gitWeb、gogs 和 stash。
我想设置它(自动)。我尝试过使用配置块方法,但它返回错误:
javaposse.jobdsl.dsl.DslScriptException: (script, line 12) Ambiguous method overloading for method groovy.util.Node#div.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
第 12 行是 it 语句。
代码:
scm {
git {
remote {
github
credentials
}
branch("refs/heads/master")
configure {
it / 'scm' / 'browser' {}
}
}
}
所以我不确定如何用代码解决这个问题。
任何帮助将不胜感激。
谢谢。
【问题讨论】:
标签: jenkins jenkins-plugins jenkins-groovy jenkins-job-dsl