Automating Docker Image Patching for Azure DevOps Agent Pools
Sakshi Jain
0
Reputation points Microsoft Employee
Problem Statement: Automate the patching of Docker images for agent pools in Azure DevOps using a pipeline.
Proposed Solution:
Develop a Python script that utilizes REST API calls to manage Azure DevOps agent pools through the following steps:
- Check if the agents are running on the latest image tag.
- Identify idle agents.
- Create batches of idle agents (10% of total agents).
- Identify busy agents.
- Disable busy agents.
- Wait for them to become idle.
- Proceed once they are idle.
- Identify offline agents.
- No action required for offline agents.
- For the steps involving busy and offline agents, implement sequential thread processing in a loop until all batches have been processed:
- For each batch:
- Drain agents.
- Check after 1 minute to ensure they are drained/removed from the pool.
- Mark processed agents and log this in file1 (YAML/JSON).
- Trigger a pipeline to reinstate agents and check their status after 30 minutes.
- Verify if the agents are operational.
- Log the newly added agents in file2 (YAML/JSON).
- Proceed to the next batch.
- Implement retry logic, rollback changes, and log details of the agents.
- Ensure both file1 and file2 match the agent names.
- Log the newly added agents in file2 (YAML/JSON).
- Verify if the agents are operational.
- Trigger a pipeline to reinstate agents and check their status after 30 minutes.
- Mark processed agents and log this in file1 (YAML/JSON).
- Check after 1 minute to ensure they are drained/removed from the pool.
- Drain agents.
- Wait for them to become idle.
Seeking suggestions for possible solutions and tests that could be included to achieve this automation.
Community Center | Not monitored
Community Center | Not monitored
Tag not monitored by Microsoft.
Sign in to answer