Navigate back to the homepage

TIP keep your build agent on standby during business hours

Frédéric De Smet
November 19th, 2021 · 1 min read

prerequisites

  • Self hosted agent pool that is connected to a virtual machine scale set

At the moment of writing this blog post the options to keep an Azure DevOps build agent on standby are rather limited. For ex. it is not possible to have a standby agent ONLY during business hours.

AgentPoolSettings

There are 2 interesting options: “Number of agents to keep on standby” and “Delay in minutes before deleteing excess idle agents”. Both options do not entirely cover the use case. Increasing the quota of both options are not very cost effective solutions.

As a workaround I’ve configured an Azure DevOps pipeline which will trigger every bussiness hour. This way the agent never gets idle. You can find a YAML example below.

1#This pipeline is used to keep an DevOps agents available only during business hours
2trigger: none
3
4schedules:
5- cron: 0 7-17 * * 1-5 # At minute 0 past every hour from 7 through 17 on every day-of-week from Monday through Friday.
6 displayName: ping-during-business-hours # friendly name given to a specific schedule
7 always: true
8 branches:
9 include:
10 - master
11
12pool: pool-vmss-demo
13
14steps:
15- script: echo Hello, world!
16 displayName: 'Run a one-line script'

Make sure that the CRON trigger is lower then the “Delay” setting. In this case the pipeline gets triggered every hour so the delag configuration should > 60 minutes.

More articles from blog by Frédéric De Smet

Naming convention in Terraform

How can we create a reliable naming convention and centralize the logic behind it.

July 17th, 2021 · 1 min read

VSCode Remote SSH

How to work with a Remote SSH in Visual Studio Code

December 1st, 2020 · 1 min read
© 2020–2024 blog by Frédéric De Smet
Link to $https://twitter.com/dsfrederic_Link to $https://github.com/dsfredericLink to $https://instagram.com/dsfredericLink to $https://www.linkedin.com/in/dsfrederic/