jenkins pipeline dsl - executing a list/map of nodes

23 views
Skip to first unread message

dpreilan

unread,
Apr 26, 2017, 6:30:10 PM4/26/17
to Jenkins Users

Hey, I am building a map of nodes to run in parallel.
This works fine:

parallel unit.build_nodes


However, I am trying to flexible for some jobs that are memory/cpu intensive and NOT in parallel. I want my library/dsl code to be same and do something like:


if (do_parallel) {

    parallel unit.build_nodes

} else {

    def keys = unit.build_nodes.keySet() as List

   for (s in keys) {

       def _node = unit.build_nodes.get(s)

       _node(s)

   }

}


This works, but I am not getting my nice 'label' that prints out when I run in parallel.

You can see me passing the key (label) with _node(s), but doesn't help.


My build_nodes map is created like examples, something like:

Map<String,Object> build_nodes =  [:];


unit.build_nodes['FOO'] = ...

unit.build_nodes['FOO1'] = ...



When run in parallel I see 'FOO' and 'FOO1' and want the same when I serialize.

Thanks!


dpreilan

unread,
Apr 27, 2017, 7:07:14 AM4/27/17
to Jenkins Users
Anybody familiar with internals of 'parallel' or can point me to in source it is implemented?

Thanks,
Doug
Reply all
Reply to author
Forward
0 new messages