specifying node/agent labels in multibranchPipelineJob jobDSL

Skip to first unread message

Tim Black

Nov 17, 2020, 4:35:55 PM11/17/20
to job-dsl-plugin

multibranchPipelineJob doesn't support specifying an agent/node label like freestyle job does. (As shown in the job-dsl api-viewer on my instance and in the official docs.) This would be very useful to enforce this critical detail at the "job root" instead of requiring individual branch Jenkinsfiles to all specify it correctly.

Does anyone know of a workaround for this? Perhaps something lower in the property tree for multibranchPipelineJob allows specifying a label that will be used by all branch jobs? Where would I find such property and how would I set it?

I think I can use the configure {} syntax to do this, but I don't know where to find the documentation for what object/property I need to set for labels. Something like this (please forgive my magical coding here, I'm no groovy/java developer and am just learning about closures):

    configure { 
        job -> job / 'properties' / 'label' { ['foo', 'bar'] } 

I filed this as a JobDSL Improvement a montha or two ago, but thought I'd get more feedback here. Thanks for your guidance.

Tim Black

Jan 26, 2021, 1:33:09 PM1/26/21
to job-dsl-plugin
To whom it may concern,  this morning I came across some good examples and discussion of how to use the configure block in JobDSL on this guy's blog. When I return to this issue, I'll start there and post here if I'm able to figure out how to set agent labels in jobdsl this way.
Reply all
Reply to author
0 new messages