Fiery
Fiery

Reputation: 49

Can a Self Hosted Agent be set as enabled at certain times?

In Azure DevOps, can an agent be set as enabled or disabled at certain times? This is with self-hosted agents. I know there is the toggle in the UI to turn agents on at off as in the screenshot below. But can the enable and disable be scheduled? I'd like to add a user's machine at the weekend for example to help speed up the tests that are run, but obviously we don't want it running tests while in use Monday to Friday.

Enable Agent toggle

Upvotes: 0

Views: 299

Answers (1)

Yan Sklyarenko
Yan Sklyarenko

Reputation: 32270

There's no option to enable/disable agents by schedule. However, you can try to achieve a similar effect with this approach:

Author a new pipeline with a single agentless job. It can invoke the Azure DevOps REST API to change the status of the agent (enabled/disabled). You can find this answer useful as a starting point.

Define the scheduled trigger the way you'd like your agent to be enabled/disabled.

Upvotes: 1

Related Questions