|
1 | | -parameterized-scheduler |
| 1 | +Parameterized Scheduler |
2 | 2 | ======================= |
3 | 3 |
|
4 | | -A Jenkins Plugin to support setting parameters in the build schedule |
| 4 | +A Jenkins Plugin to support setting parameters in the build schedule. Using multiple cron lines each ending with a % and some name=value pairs you can schedule your parameterized build to run with different parameters at different times. It may turn out that |
| 5 | +[this improvement request JENKINS-16352](https://issues.jenkins-ci.org/browse/JENKINS-16352) |
| 6 | +will be implemented in Jenkins core. Then this plugin will no longer be needed. My first thought is to try it out as a plugin. |
5 | 7 |
|
6 | 8 | After you save your project with some parameters (yes, save, then go back into the config page) you will see |
7 | 9 | >Build periodically with parameters |
8 | 10 |
|
9 | 11 | in the *Build Triggers* section as shown here: |
10 | 12 |
|
11 | 13 |  |
| 14 | + |
| 15 | +## Configuration Example ## |
| 16 | +The cron line before the _%_ symbol is processed the same as the jenkins core _Build periodically Schedule_. Leave a space. Put in a _%_. Then add the name=value pairs you need for your project build parameters. |
| 17 | + |
| 18 | +The idea was born from the need to use a different environment. To use a different TestNG configuration xml. In this example the _env_ parameter will be set to int during the build triggered at 15 after each hour. Then _env_ will be qa when the build runs at half past. |
| 19 | + |
| 20 | +``` |
| 21 | + #lets run against the integration environment at 15 past the hour |
| 22 | + 15 * * * * % env=int |
| 23 | + #run QA too |
| 24 | + 30 * * * % env=qa |
| 25 | +``` |
| 26 | + |
| 27 | + |
| 28 | +Yes, of course you can set multiple parameters. Lets say you have three parameters: |
| 29 | +- furniture |
| 30 | +- color |
| 31 | +- name (with a default of fred) |
| 32 | + |
| 33 | +Then you might want a schedule like the following: |
| 34 | + |
| 35 | +``` |
| 36 | + # leave spaces where you want them around the parameters. They'll be trimmed. |
| 37 | + # we let the build run with the default name |
| 38 | + 5 * * * *%furniture=chair;color=black |
| 39 | + # now, let's override that default name and use Mr. Rubble. |
| 40 | + 10 * * * * % furniture=desk; color=yellow; name=barney |
| 41 | +``` |
0 commit comments