jenkins - How to call a build flow from a build flow passing different parameters? -
i have 3 jobs (let's name job1,job2,job3) accepts same parameters. have build flow calling these jobs eg build flow::
build(job1, param1 : "value1", param2 : "value2" ) build(job2, param1 : "value1", param2 : "value2" ) build(job3, param1 : "value1", param2 : "value2" )
as see in example jobs accept same parameters.
and want run same sequence in build flow (job1, job2, job3) different parameter values. having different build flows pass different values parameter:
eg:
build flow1--- build(job1, param1 : "value1", param2 : "value2" ) build(job2, param1 : "value1", param2 : "value2" ) build(job3, param1 : "value1", param2 : "value2" ) build flow2--- build(job1, param1 : "value3", param2 : "value4" ) build(job2, param1 : "value3", param2 : "value4" ) build(job3, param1 : "value3", param2 : "value4" )
i thinking have build flow shared , able pass parameters : example:::
build flow build(job1, param1 : $paramvalue1, param2 : $paramvalue2 ) build(job2, param1 : $paramvalue1, param2 : $paramvalue2 ) build(job3, param1 : $paramvalue1, param2 : $paramvalue2 )
and want call build flow different parameter values build flow.
can ??? if yes ,, 1. how define , pass parameter flow ?
you can use workflow plugin achieve want.
job1
,job2
,job3
must parameterized jobsparam1
,param2
parameters (they can freestyle jobs or whatever want).create parameterized workflow job
param1
,param2
parameters. workflow script this:build job: 'job1', parameters: [[$class: 'stringparametervalue', name: 'param1', value: param1], [$class: 'stringparametervalue', name: 'param2', value: param2]] build job: 'job2', parameters: [[$class: 'stringparametervalue', name: 'param1', value: param1], [$class: 'stringparametervalue', name: 'param2', value: param2]] build job: 'job3', parameters: [[$class: 'stringparametervalue', name: 'param1', value: param1], [$class: 'stringparametervalue', name: 'param2', value: param2]]
then run top level job, ask parameters values , downstream jobs triggered (and top level parameters passed).
Comments
Post a Comment