In jenkins, how to run the shell command in 2nd job, when the first job condition is met

In Job 1, Iam giving the values of testsuite parameter as fr_art1,fr_ltr_cloud,fr_fc in extended choice parameter. In the image 1 if you see, iam giving the boolean condition as [$testsuite == fr_art1] || [$testsuite == fr_ltr_cloud] || [$testsuite == fr_fc] and when either one or all is selected, it will call Job2 (slave1). iam passing Job1 parameter values to Job 2.

So once the Job2 is called, i want to run the command based on the selection made in Job1. If I select 3 options, then 3 commands has to be run. If I select 1, Then only one command has to be run. For each value of testsuite, One one command is there as below.

fr_ltr_cloud.rb : ruby /auto/tools/qa/shared/qa-branch/tepa_v2/bin/run_slave.rb -m br-lc-66.datadomain.com -w /auto/qalogs/branch_team/mrt -d dd4500-103.datadomain.com -t rgrs -f /auto/tools/qa/shared/qa-branch/hashlist/$release/mrt/fr_ltr_cloud.rb

fr_art1 : ruby /auto/tools/qa/shared/qa-branch/tepa_v2/bin/run_slave.rb -m br-lc-66.datadomain.com -w /auto/qalogs/branch_team/mrt -d dd2500-142.datadomain.com -t rgrs -f /auto/tools/qa/shared/qa-branch/hashlist/$release/mrt/fr_art1.rb

fr_fc : ruby /auto/tools/qa/shared/qa-branch/tepa_v2/bin/run_slave.rb -m br-lc-66.datadomain.com -w /auto/qalogs/branch_team/mrt -d dd2500-143.datadomain.com -t rgrs -f /auto/tools/qa/shared/qa-branch/hashlist/$release/mrt/fr_fc.rb. Image 2 and 3 shows the commands.




I have given all 3 commands in job2, Do i need to change any boolean command in Job1 ? Also If I select all 3 values, then 3 commands has to be run in Job2. If I select 1 only one command has to be run, based on the value selected in Job1. For each value different commands are there in Job2.

Based on the value the command should run /auto/tools/qa/shared/qa-branch/hashlist/$release/mrt/fr_ltr_cloud.rb. In this fr_ltr_cloud is the value.

Please help me to resolve this.


Please sign in to leave a comment.