Closed watchwithmike closed 9 years ago
In answer to my second question, I believe I was able to swap out the job-dsl-core with 1.35 (latest version available in the repository) and I'm getting the same results. The buildscript block I used to swap out the core was:
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
maven {
url('http://repo.jenkins-ci.org/releases/')
}
}
dependencies {
classpath("com.terrafolio:gradle-jenkins-plugin:1.3.1") {
exclude group: 'org.jenkins-ci.plugins', module:'job-dsl-core'
}
classpath 'org.jenkins-ci.plugins:job-dsl-core:1.35'
}
}
apply plugin: 'com.terrafolio.jenkins'
Just in case I'm missing the bigger picture somewhere else, here is a complete build.gradle
that causes the failure.
plugins {
id 'com.terrafolio.jenkins' version '1.3.1'
}
apply plugin: 'com.terrafolio.jenkins'
jenkins {
servers {
local {
url 'http://localhost:8080'
username ''
password ''
}
}
defaultServer servers.local
def branches = ['master', 'develop']
dsl {
branches.each { branch ->
job("my-core ${branch.toUpperCase()}") {
scm {
git {
remote {
github('myco/my-core', 'https')
credentials('mycreds')
}
branch("origin/${branch}")
}
}
}
}
}
}
task wrapper(type: Wrapper) {
gradleVersion = '2.3'
}
I think it's a conflict on the closure parameter { branch ->
and the branch() method on the git dsl object. If you change the parameter to something else (e.g. { theBranch ->
), it should work.
That was exactly it! Thanks for the quick response, much obliged.
I'm getting a "No signature of method" exception when I'm attempting to use the DSL to set branch on a github repository. The way the DSL is configured I need to use a 'remote' closure to specify credentials which gets me the following job definition:
If I run that on the Job DSL Playground I get the XML I'm looking for. When I use this DSL in my Gradle Jenkins job I get the following exception:
Thanks, Mike