Search code examples
jenkinsjenkins-agent

Jenkins schedule agent node availability


We have a number of machines that we would like to use as agent nodes for Jenkins, but only in certain time intervals (i.e. not during working hours). Is it possible to configure an agent node to be used as a agent for builds in particular time range? For example: a M-F from 10pm - 5am, Sat and Sun all day?


Solution

  • In the slave configuration panel, select Take this slave on-line according to a schedule.

    You can then specify the startup time and the desired uptime for the slave.

    You must be careful with long-running jobs though -- if a three hour job is scheduled to the slave one minute before the uptime expires, then the job will continue running for the entire period, since Jenkins will not terminate running builds after the scheduled end time.