PSM
PSM

Reputation: 1

Jenkins scripted pipeline - solution

I have a working pipeline as below however it's not working over the stages. Is there any solution to implement it into graphical mode I mean something like stage/steps in the pipeline?

def nodes = ['node1','node2', 'node3']

for (int i = 0; i < nodes.size(); i++) {
    step1(nodes[i])
    step2(nodes[i])
    step3(nodes[i])
}

def step1(node) { 
    echo 'in function, calling job on node ' + node
    }
def step2(node) { 
    echo 'in function, calling job on node ' + node
   }
def step3(node) { 
    echo 'in function, calling job on node ' + node
   }

Upvotes: 0

Views: 80

Answers (1)

Patrice M.
Patrice M.

Reputation: 4319

This is a very basic functionality question.

Rather than repeating the information in existing resources like one woudl expect on SO, I'll just provide some links

Jenkins tutorial about how to achieve this: https://www.jenkins.io/doc/book/pipeline/#stage

Pipeline Step reference for "Stage" dsl command: https://www.jenkins.io/doc/pipeline/steps/pipeline-stage-step/

Please clarify your question after reading thru this material, if need be. Thanks.

Upvotes: 1

Related Questions