Reputation: 13
Hello,
We're using one job (B) which calls another job (C) 3-times with different parameters within one job (B). Every job-C run is used for different slaves/nodes, with different parameters.
Job B is using some artifacts from job A and all the sub-jobs (C) should even uses these artifacts. Unfortunately only the first triggered sub-job (Job C #1) becomes the artifacts provided within his local workspace folder. For the other Job-C runs (#2 and #3) the artifacts will not be copied.
Schema:
Job A (creates the artifacts)
-->Job B (uses artifacts from A and triggers Job C, three times)
--> Job C #1 --> use artifacts for node1
--> Job C #2 --> should also use the artifacts on node2 (didnt work)
--> Job C #2 --> should also use the artifacts on node3 (didnt work)
One solution could be configure a group for all job-c nodes and to use "execute on all nodes in label" in the trigger. But we need to call Job-C with different parameters.
Thanks Steffen
Upvotes: 0
Views: 1162
Reputation: 10382
Here is a solution with the Build Flow plugin, the NodeLabel parameter plugin and the Copy Artifact plugin.
With this solution, no need of the job B.
The job A creates the artifacts, no need to update this job.
On the job C, please this kind of parameter (using the second plugin):
Please active this option for your job C:
Add a build step to copy the artefact from the job A:
Next, create a new build flow job with this flow:
build("Bruno job A")
parallel (
{ build("Bruno job C", NODE_NAME: "jenkins-centos-slave-01") },
{ build("Bruno job C", NODE_NAME: "jenkins-centos-slave-02") },
{ build("Bruno job C", NODE_NAME: "jenkins-centos-slave-03") }
)
The parallel block will launch 3 times the job C on 3 different slaves.
We can check that the 3 jobs C have been executed on the relevant nodes:
And they all get the artefact from the job A :)
Upvotes: 2