I would like to create several jobs that differ by some properties. Plain string properties work just fine, like in the example here https://github.com/sheehan/job-dsl-gradle-example/blob/master/src/jobs/example4Jobs.groovy
Additionally I would like to parametrize the permissions inside the authorization block.
I created a closure (auth) and wanted to invoke it inside the job definition but that doesn't work.
[
[
environment : 'qa',
auth: {
permissions('dev', [
'hudson.model.Item.Read'
])
}
],
[
environment : 'prod',
auth: {
permissions('admin', [
'hudson.model.Item.Read',
'hudson.model.Item.Build',
'hudson.model.Item.Cancel'
])
}
]
].each { Map config ->
pipelineJob("job-${config.environment}") {
displayName("job ${config.environment}")
authorization {
config.auth()
}
}
}
I'm getting the following error:
ERROR: (script, line 5) No signature of method: script.permissions() is applicable for argument types: (java.lang.String, java.util.ArrayList) values: [admin, [hudson.model.Item.Read]]