【问题标题】:Jenkins Job DSL configure blockJenkins Job DSL 配置块
【发布时间】: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


    【解决方案1】:

    在文档中说流程xml可能有点棘手,我认为应该是这样的(格式,内容不知道是不是这样):

    it / scm / browser(class: 'hudson.plugins.git.browser.GithubWeb') / url('https://github.com/repository/')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-07-31
      • 1970-01-01
      • 2017-03-15
      • 1970-01-01
      相关资源
      最近更新 更多