How to get a node list according to the parameter from the previous pipeline job in Jenkins?

19 views
Skip to first unread message

Jack Andy

unread,
Aug 2, 2016, 12:12:54 PM8/2/16
to Jenkins Users



I got 2 pipeline jobs.

Jenkinsfile in the first one:

slave_list = ['test01', 'test02']
build job: 'pipeline-test2', parameters: [[$class: 'NodeParameterValue', name: 'node_list', labels: slave_list, nodeEligibility: [$class: 'AllNodeEligibility']]]

Jenkinsfile in the second one,and job name is "pipeline-test2":

echo node_list
for (slave in node_list) {
    echo slave
}

the first job triggers the second one, and the output of the second job is:

[Pipeline] echo
test01
[Pipeline] echo
t
[Pipeline] echo
e
[Pipeline] echo
s
[Pipeline] echo
t
[Pipeline] echo
0
[Pipeline] echo
1

why the second job receives only one parameter:test01? I want the second job to receive a list(slave_list) from the first one? and how to complete it? thanks!

Reply all
Reply to author
Forward
0 new messages