Unable to use input parameters as arguments for freestyle job sub-elements

5 views
Skip to first unread message

Eric Boehm

unread,
Jun 17, 2025, 5:43:13 PMJun 17
to job-dsl-plugin
I have not been able to use an input parameter for the job that is processing the DSL within the DSL itself

For example, given input parameters
"NEW_NAME=my-job"
"FOO=bar"

and

freeStyleJob('my-job') {
  customWorkspace(${FOO})
  parameters {
    string {
        name('NEW_FOO')
        defaultValue(${FOO})
    }
  }
}

I get errors no mater if I use
FOO
${FOO}
"${FOO}"

The only solution I have found is to assign it to a new variable

new_foo = "${FOO}"
freeStyleJob('my-job') {
  customWorkspace(new_foo)
  parameters {
    string {
        name('NEW_FOO')
        defaultValue(new_foo)
    }
  }
}

Is this expected?
Is there a better way?

Oddly enough, freeStyleJob("${NEW_NAME}") is accepted but freeStyleJob(${NEW_NAME}) is not.

--
Eric Boehm


Reply all
Reply to author
Forward
0 new messages