Our Jenkins server's version of the Job DSL Plugin is a bit old, and I don't seem to be able to use the Github SCM commands directly. I need to set the name, URL, refspec, branch, and local branch. I've almost got the DSL correct, but it does not like me trying to specify the URL via a configure block. Here is what I have for my scm {} block:
def Repository = "https://my-git-server.com/my-user/repository.git"
def Branch = "master"
...
scm {
configure { scm ->
scm / UserRemoteConfigs / 'hudson.plugins.git.UserRemoteConfig' {
name "origin"
url "${Repository}"
refspec "+refs/heads/${Branch}:refs/remotes/origin/${Branch}"
}
scm / branches / 'hudson.plugins.git.BranchSpec' {
name "origin/${Branch}"
}
scm {
localBranch "${Branch}"
}
}
}I have a feeling the localBranch setting is wrong but I can't figure out how to do it. If I leave it in, I get this error:
groovy.lang.MissingMethodException: No signature of method: groovy.util.Node.call() is applicable for argument types: (script14292399124951505156629$_run_closure1_closure2_closure5_closure8) values: [script14292399124951505156629$_run_closure1_closure2_closure5_closure8@579ab801]
Possible solutions: wait(), name(), value(), any(), wait(long), each(groovy.lang.Closure)
at script14292399124951505156629$_run_closure1_closure2_closure5.doCall(script14292399124951505156629.groovy:27)
at javaposse.jobdsl.dsl.WithXmlAction$_execute_closure1.doCall(WithXmlAction.groovy:18)
at javaposse.jobdsl.dsl.WithXmlAction$_execute_closure1.doCall(WithXmlAction.groovy)
at javaposse.jobdsl.dsl.WithXmlAction.execute(WithXmlAction.groovy:17)
at javaposse.jobdsl.dsl.WithXmlAction$execute$0.call(Unknown Source)If I take it out, I get this error:
groovy.lang.GroovyRuntimeException: Ambiguous method overloading for method groovy.util.Node#leftShift.
Cannot resolve which method to invoke for [null] due to overlapping prototypes between:
[class groovy.util.Node]
[class java.lang.String]I suspect the problem is a conflict in the 'name' parameter, or else I am just confused about how to do this.
Here is the XML on a job that is configured correctly:
<scm class="hudson.plugins.git.GitSCM" plugin="g...@1.1.22-SNAPSHOT">
<configVersion>2</configVersion>
<userRemoteConfigs>
<hudson.plugins.git.UserRemoteConfig>
<name>origin</name>
<refspec>+refs/heads/master:refs/remotes/origin/master</refspec>
<url>https://my-git-server.com/my-user/repository.git"</url>
</hudson.plugins.git.UserRemoteConfig>
</userRemoteConfigs>
<branches>
<hudson.plugins.git.BranchSpec>
<name>origin/master</name>
</hudson.plugins.git.BranchSpec>
</branches>
<localBranch>master</localBranch>
... omitted default and empty values ...
<browser class="hudson.plugins.git.browser.GithubWeb">
<url>https://my-git-server.com/my-user/repository.git</url>
</browser>
... omitted default and empty values ...
</scm>Thanks in advance for any help you can provide!
Misty