-
New Feature
-
Resolution: Fixed
-
Minor
I was missing the possibility to pass a parameter to a crontab line, so that I can do different things on different days.
e.g.
We have a linux that is built every day except Saturdays (~1h) and on Sundays we run a clean build (~10h), where Saturday is reserved for other projects that run a clean build.
The only way for me was to create a conditional build step. It blows up the job configuration and gets decoupled from the crontab:
So when someone changes the crontab from Sunday to Saturday for clean builds, he will also have to change the day in the conditional build step.
My proposal is to extend the crontab syntax by something like:
MIN HOUR DOM MONTH DOW % PARAM1=VALUE1,PARAM2=VALUE2
This would than schedule a build with the given parameters.
Would others be interested too?
[JENKINS-16352] Add ability to specify parameters in the crontab
Summary | Original: Cron TimerTrigger with parameters | New: Add ability to specify parameters in the crontab |
Labels | Original: Parameter TimerTrigger, | New: Parameter cron |
Issue Type | Original: Improvement [ 4 ] | New: New Feature [ 2 ] |
Here's a first pass at solving this. I have the approach that most additions should be plugins. When I looked at the Trigger extension point I was sceptical that this should be a plugin. The CronTab and CronTabList classes did not want to cooperate.
Then there is the is the configuration. In order to make the parameterized schedule enabled only for projects with parameters I seem to have forced the user to re-enter the config screen after setting parameters. This does not flow well.
Now that I've implemented it as a plugin, I suspect it should be in core. Else the Trigger extension point needs some refactoring to support different kinds of triggers. It's my opinion that the Trigger was nearly already in need of refactoring. This is evidenced by Trigger.getSpec(), checkTriggers is static but other Trigger implementations may not be the least bit interested in CronTabList. For my part, I needed to extend CronTab to support parameters stored with each.
I'm interested to hear the opinion of others closer to, with more experience in, the jenkins-core.
https://github.com/jwmach1/parameterized-scheduler