def project = 'quidryan/aws-sdk-test'
def branchApi = new URL("https://api.github.com/repos/${project}/branches")
def branches = new groovy.json.JsonSlurper().parse(branchApi.newReader())
branches.each {
def branchName = it.name
job {
name "${project}-${branchName}".replaceAll('/','-')
scm {
git("git://github.com/${project}.git", branchName)
}
steps {
maven("test -Dproject.name=${project}/${branchName}")
}
}
}
thanks a lot,
Adrian
Assuming you defined a credentials domain with a 'github.com' hostname specification and want any kind of credentials (username/password, username/private SSH key, etc.) :
Class type = com.cloudbees.plugins.credentials.Credentials.class; // change as needed
def id = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
type,
jenkins.model.Jenkins.activeInstance,
hudson.security.ACL.SYSTEM,
new com.cloudbees.plugins.credentials.domains.HostnameRequirement('github.com')
).find {
true // extra condition here
}?.id;
And use the resulting id in your git remote credentials.
--
You received this message because you are subscribed to the Google Groups "job-dsl-plugin" group.
To unsubscribe from this group and stop receiving emails from it, send an email to job-dsl-plugi...@googlegroups.com.
To post to this group, send email to job-dsl...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/1cd27e6c-3f25-404e-a3f0-bc4fbfb9096c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Fiouz
To view this discussion on the web visit https://groups.google.com/d/msgid/job-dsl-plugin/CAFz6uNCwdYYHpwnkqcYY31E7yn5hh27isKuemZg9RvaGG%2Bktow%40mail.gmail.com.