Scaling and continuous integration with Azure DevOps
2024-10-03
One of the main roles of a Site Reliability Engineer (SRE) and Cloud Director is to ensure mastery over infrastructure and control costs. I have recently identified an area of optimization that could significantly reduce the costs of our integration chains (IC).
We use Azure DevOps (ADO) as our software development platform, which serves as an alternative to GitHub and GitLab. Our cloud services are deployed within Azure, and integration is straightforward if an appropriate strategy is implemented.
The three main problems are:
- Growing costs associated with the use of agents hosted by Microsoft.
- The need for VPN authentication to access endpoints via Entra ID.
- Contractual constraints that limit the flexibility of resources.
The solution: Auto-Hosted Agents
Agents are programs that enable the execution of continuous integration chains, while GitHub and GitLab offer runners as their alternatives.
After a complete analysis of potential solutions, I opted for auto-hosted agents by selecting specific Azure Virtual Machine Scale Sets (VMSS). This choice was influenced by several factors:
- The ability to scale according to usage.
- The potential to operate in “zero-consume mode” during periods of inactivity.
- Familiarity of internal teams with Virtual Machines (VM) management.
Strategically reducing costs
By considering the constraints without impacting the developer experience, I have developed a strategy for cost reduction:
- Using spot instances for 95% of pipelines.
- Creating two classes of pools: “pool-Linux spot” and “pool-linux stable”.
- Optimizing costs by 383% (or 167% when including ADO licenses).
Technical implementation
This article details how to set up Virtual Machine Scale Sets (VMSS), create a pool of agents within Azure DevOps, and configure the necessary extensions. It also describes how to manage resource cleanup effectively.
Conclusion
The proposed technique requires a team with specific skills; however, due to the reduced costs and increased flexibility, we can surpass this requirement. Furthermore, VMSS is a robust technology that does not require monthly maintenance. You can discover how to reduce costs by four times while simultaneously minimizing the impact on development velocity.
This post was written by Flavien, SRE and Cloud DevOps specialist.
For more information, check the article written in English by Flavien on Medium!