How to schedule Jenkins job to build Monday-Friday

1.2k Views Asked by At

I have a jenkins job used to automate VMs start/stop in Azure. Currently, I have this schedule to run daily (stops VMs at 8 and starts them back up at 5AM). I want to be able to run this job Monday-Friday(Start/Stop) then Saturday-Sunday(Stop only) until the work week starts again.

I am using one job & set my schedule using the Build Periodically with parameters plugin. set as follows:

H 5 * * 1-5 % OPTIONS=start
H 20 * * 1-5 % OPTIONS=stop

What would you recommend.?

1

There are 1 best solutions below

0
On

I'd keep your original "payload" job without making it periodic.

I'd create two other "trigger" jobs, whose entire purpose would be to trigger your "payload" job, passing right parameters to it. Both jobs would use the 'Trigger other jobs' action from the Parametrized Trigger plugin.

Each job would run periodically with its own schedule, passing either "start" or "stop" parameter to your "payload" job.