voltas
voltas

Reputation: 563

How to access the string parameters in job dsl

I'm passing the template job as well as the SVN Branch URL as string parameters to the job-dsl script. (Using the Parameterized build option).

def template = "${template_job}"
def url = "${svn_url}"
job('example') {
  using('template')
 configure { node ->
    node / scm / branches / 'hudson.scm.SubversionSCM_-ModuleLocation' / name('url')
  }
}

but I'm facing the error like:

Processing provided DSL script
ERROR: (script, line 1) No signature of method: script.$() is applicable for argument types: (script$_run_closure1) values: [script$_run_closure1@79b72972]
Possible solutions: is(java.lang.Object), run(), run(), any(), job(java.lang.String), any(groovy.lang.Closure)

Any suggestions how to access the string parameters in the job-dsl ? Thanks.

Upvotes: 2

Views: 4712

Answers (1)

daspilker
daspilker

Reputation: 8194

You do not need to wrap the parameters in strings. They are already strings. If your parameters are template_job and svn_url, this should work:

job('example') {
  using(template_job)
  configure { node ->
    node / scm / branches / 'hudson.scm.SubversionSCM_-ModuleLocation' / name(svn_url)
  }
}

Upvotes: 3

Related Questions