shaneoh shaneoh - 1 year ago 137
Groovy Question

Jenkins Job DSL fails to accept any SVN credentials use in the seed job script

I'm using the Jenkins DSL for the first time to create some seed jobs.

I want to use some SVN credentials in one of these but no matter what I try the seed job fails to create a new job when I run it as soon as I put the credentials in. The DSL script works fine without the SVN credentials.

This is the relevant snippet from my seed job script:

scm {
svn {

Note that I'm not sure what I am meant to enter for "credentials so I have tried the credential ID as you see here, the name ("jenkins.mycompany/******"), the description ("Jenkins SVN Credentials"). I've also tried wrapping each of these options in single and double speech marks, brackets, parenthesis. I keep getting this error.

Building on master in workspace D:\data\jenkins\workspace\JobDSL
Disk space threshold is set to :5Gb
Checking disk space Now
Total Disk Space Available is: 28Gb
Node Name: master
Running Prebuild steps
Processing DSL script jobBuilder.groovy
ERROR: (jobBuilder.groovy, line 15) No signature of method: javaposse.jobdsl.dsl.helpers.scm.SvnContext.credentials() is applicable for argument types: (java.lang.String) values: [23498723-hedy-4v73-76565-982734987234]
[BFA] Scanning build for known causes...
[BFA] No failure causes found
[BFA] Done. 0s
Started calculate disk usage of build
Finished Calculation of disk usage of build in 0 seconds
Started calculate disk usage of workspace
Finished Calculation of disk usage of workspace in 0 seconds
Finished: FAILURE

I don't know if this is related to another issue I had a few days ago but I can't see any obvious connection:

Groovy script fails to call Slack notification parameter from Jenkins DSL job

Would appreciate any help.

Answer Source

The tutorial I was using appears to have had some syntax errors. I was able to resolve this by changing my script as below.

  scm {
    svn {
      location(SVN_REPO_URL) {

And now it works.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download