Skip to content

Commit 6ac553a

Browse files
committed
examples of the cron plus config parameters
1 parent c7fb640 commit 6ac553a

1 file changed

Lines changed: 32 additions & 2 deletions

File tree

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,41 @@
1-
parameterized-scheduler
1+
Parameterized Scheduler
22
=======================
33

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.
57

68
After you save your project with some parameters (yes, save, then go back into the config page) you will see
79
>Build periodically with parameters
810
911
in the *Build Triggers* section as shown here:
1012

1113
![Parameterized Schedular Config](https://raw2.github.com/jwmach1/parameterized-scheduler/master/site/images/configurationexample.png)
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

Comments
 (0)