How to run parametrized job after another (without params)

前端 未结 1 685
Happy的楠姐
Happy的楠姐 2021-02-13 06:00

I have a job in Jenkins which has 2 params. I want to run another plan, which has no params and from that plan, launch the existing plan as many times as required.

The n

1条回答
  •  深忆病人
    2021-02-13 06:44

    There is a Parameterized Trigger Plugin which, once installed, allows you to trigger a parameterized build after one build has finished.

    The easiest way to accomplish what you want would be to install this plugin, and build the project once with the key/value list that you want to build against. If for some reason you need to execute the build multiple times after the first job completes, then you could use the remote API to start builds from your first project. So you have two options:

    Option A

    • Project1 executes, creates a file with key/value pairs
    • Project1 completes, is configured to execute Project2 with parameters (using the Parameterized Trigger Plugin)
    • Project2 loops through the key/value pairs, doing whatever you need to do for each one

    Option B

    • Project1 executes. For every key/value pair, it hits the following url http://server/job//buildWithParameters?PARAM1=Value1&PARAM2=Value2 (you will need to substitute in your actual project name and parameter names/values)
    • Project2 takes these parameters and builds as normal, using the parameter values wherever it needs to

    0 讨论(0)
提交回复
热议问题