Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Distributed parallel with many slaves -- how does this concept work in jenkins?

I have come across an option in pipeline that if we don't mention node name and just mention node jenkins will intelligently find which node is free and assign the job to one of the free nodes. sample code below.

parallel (
    "stream 1" : { 
        node {
            build 'Job1'
        }
    },
    "stream 2" : {
        node {
            build 'Job2'
        }
    }
)

Can I get more info about how does it work and can we provide a list of nodes from which pick one of the free nodes ? Does all the executers in one slave will be used?

Reference doc: https://www.cloudbees.com/blog/parallelism-and-distributed-builds-jenkins

like image 831
Sreevalsa E Avatar asked Dec 07 '25 04:12

Sreevalsa E


1 Answers

You can let Jenkins select one of your nodes from a subset by assigning the same label to multiple nodes.

This option can be found under "Manage Jenkins -> Manage Nodes -> {Select one of the nodes} -> Configure".

Instead of selecting a node by name, you would use the label like in the following example.

parallel (
"stream 1" : { 
    node('linux') {  // runs on one of the nodes labelled as linux nodes
        build 'Job1'
    }
},
"stream 2" : {
    node('named_node_foo'){  // only runs on node named_foo_node
        build 'Job2'
    }
}

)

like image 137
Max Avatar answered Dec 08 '25 22:12

Max