Search code examples
shelljenkinsround-robin

write script to trigger the jenkins job one by one


I have one Job - Job1 which generates seven files.

- file1,file2... file 7

Job1 should sequentially trigger the Job 2 by passing the created file's as Job2's parameters

e.g:

run 1: job 2 with file 1 as its parameter
run 2: job 2 with file 2 as its parameter....

Now I want to write a scheduler job which can trigger the test job.

e.g suppose if job 2 with parameter file 1 trigger's the test job then next trigger must be with other file as a parameter and file 1 should be trigger the test job in the next iteration.


Solution

  • I Believe Parametrized trigger pluging does exactly what you are looking for

    Jekins Parametrized Trigger plugin

    enter image description here

    Note: File pattern looks for absolute path and you might have to generated your property files inside workspace and later delete them after triggering the downstream jobs.