Reputation: 4946
I am working for some time with jenkins freestyle projects.
Now I was looking for a solution to create a "pipeline" which execute multiple of these (parameterized) freestyle projects. Something like this:
// execute freestyle project A with parameter p1=a
// execute freestyle project B with parameter p2=b
if((A finished successfully) && (B finished successfully)){
// execute project C with parameter p3=c
if((C finished successfully) && p4 == "yes"){
// execute project D with parameter p5=d
}
}
I found Jenkins Pipeline, but I'm not sure if this is the actual use case for a Jenkins Pipeline. Jenkins Pipeline looks more like an advaned freestyle project to me, not an "orchestrating" tool for existing projects.
So which plugin should I use for this need?
Upvotes: 2
Views: 3160
Reputation: 10395
You definitely can do it using Jenkins pipeline
stage('triggering jobs') {
build job: 'A', parameters: [string(name: 'p1', value: 'a')]
build job: 'B', parameters: [string(name: 'p2', value: 'b')]
build job: 'C', parameters: [string(name: 'p3', value: 'c')]
if (p4 == 'yes') {
build job: 'D', parameters: [string(name: 'p5', value: 'd')]
}
}
You don't need to check explicitly result statuses of downstream jobs because the orchestration job will fail if one of them fails.
See build step for more information.
Upvotes: 2