0

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 {
    location(SVN_REPO_URL)
    credentials('23498723-hedy-4v73-76565-982734987234')
    }
}

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.

Community
  • 1
  • 1
shaneoh
  • 442
  • 2
  • 8
  • 26

1 Answers1

1

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) {
        credentials('23498723-hedy-4v73-76565-982734987234')
      }
    }
}

And now it works.

shaneoh
  • 442
  • 2
  • 8
  • 26