I want to schedule a job that will execute at most once at a specified time in the future (usually that time would just be later that night, after hours). I want to use Jenkins to do this. If Jenkins happened to be down during that time, the job wouldn't fire - that's fine.
At the moment, I'm planning to make a new job with "build periodically" enabled, and set the schedule to something like "0 19 29 01 *".
The intent being to schedule the job to run at 19:00 on the 29th of January.
The downside being that every time I do this, I must remember to delete/disable the job sometime before next year, or it will run again (that would be bad). I'd be checking the results of the job manually anyway, so not too hard to do. I'm just hoping someone might be able to point out a way to schedule a "one off" job run with Jenkins - that way I can't mess things up by forgetting to disable the job.
Install the "Schedule Build Plugin". "Adds capability to schedule a build for a later point in time. Asks the user for a date and time and adds the build to the build queue with the respective quiet period."
Restart jenkins seems to be needed after plugin install even though you see the icons for a scheduled build.
https://wiki.jenkins-ci.org/display/JENKINS/Schedule+Build+Plugin
BEWARE: After initial install (with jenkins 2.2) I got a warning "plugin offered a GET". There did appear to be some sort of a job scheduled and it said it "expires in 13hr" which was correct for the time I scheduled. It did not run the job. :-(
The warning seen:
You must use POST method to trigger builds. (From scripts you may instead pass a per-project authentication token, or authenticate with your API token.) If you see this page, it may be because a plugin offered a GET link; file a bug report for that plugin.
Url, presumably the GET:
http://jenkins:xxxx/job/jobname/build?delay=47212sec
This was with Jenkins 2.2 and Schedule Build Plugin 0.3.4
I have it working now for me jenkins 2.7.4 and Schedule Build Plugin built from source.
Solution: Use latest jenkins and wait for new release of plugin (>0.3.4) . . . (or build from source). There is already a bug open on the plugin for the GET problem and a fix in source code but not yet in latest release. 26/Sep/2016: https://issues.jenkins-ci.org/browse/JENKINS-28961 Building schedule_build.hpi from source this plugin works. For jenkins 2.2 it worked IF CSRF Protection is disabled in jenkins.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With