Introducing Warm Agents, a TeamCity Plugin
// schedule trigger to scale warm agents up to 2 each morning schedule { branchFilter = "+:*" triggerBuild = always() withPendingChangesOnly = false schedulingPolicy = daily { hour = 8 } buildParams { param("warmAgents.target", "2") } }
Add a second trigger with target=0 for the evening. See this repository for a complete sample.
The day-night split is the common case, but your workflow may call for a different shape. To see how demand actually fluctuates, the plugin exposes a small set of metrics:
teamcity api '/app/projectMetrics?projectId=<projectExternalID>' | grep 'warmAgents'
With a multi-node setup, add an X-TeamCity-Node-Id-Cookie=<main-node-id> cookie to pin the request to the main node, which collects the metrics.
The plugin computes utilization and saturation metrics per configured cloud image, showing how busy your agents are and how well they keep up with the queue. Metrics come out in Prometheus format, so you can scrape them over time and see when demand peaks. A minimal Prometheus config is available here as an example.
Tell us what you think
We would love to hear how the feature works for you and what your use cases look like. Share your feedback in the comments section below or in the original feature request, and take a look at our plans for future improvements if you’re curious.
Fuente: Artículo original