def jobname = 'my-project-name'
def giturl = 'g...@myhost.mydomain.com:mygroup/projectname.git'
def scmuser = 'username@myhost.mydomain.com
'
def credsId = jm.getCredentialsId(scmuser)
if (credsId == null) {
println("Fatal - credentialsId not found for ${scmuser}")
System.exit(1)
return
}
println('Creating job: '+jobname+' for: '+giturl)
job {
name(jobname)
displayName(jobname+'.compile')
label('compile-host')
disabled(true)
quietPeriod(120)
logRotator(14, 20, 7)
concurrentBuild(false)
jdk('JDK_16')
scm {
git {
remote {
url(giturl)
credentials(credsId)
}
}
}
triggers {
scm('H/5 * * * *')
}
steps {
maven('--errors --batch-mode clean test')
}
}
The arguments for the credentials method is the description field or the UUID generated from Jenkins | Manage Jenkins | Manage Credentials. The easiest way to find this value, is to navigate Jenkins | Credentials | Global credentials | (Key Name). Then look at the description in parenthesis or using the UUID in the URL.
Daniel// add a Git SCM for a GitHub repository and use the given credentials for authentication git { remote { github('account/repo', 'ssh') credentials('GitHub CI Key') } }
--
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/0ad4296e-a104-49a7-a4d8-0ee2cc903eed%40googlegroups.com.
ERROR: (exampleJobPRThrottleRally.groovy, line 43) No signature of method: javaposse.jobdsl.plugin.InterruptibleJobManagement.getCredentialsId() is applicable for argument types: (java.lang.String) values: [SPB Jenkins Generic User] [BFA] Scanning build for known causes... [BFA] No failure causes found [BFA] Done. 0s Finished: FAILURE