Moving to the Azure Pipelines agent pool

2020-01-14

While doing some cleanup of the agent pools at a customer of mine, I noticed that there was a pool called Hosted Ubuntu 1604. Since the new Azure Pipelines pool is the recommended pool, I deleted the Hosted Ubuntu 1604 pool. To my surprise, it took only a couple of seconds before the pool reappeared.

After some investigation and contact with the Azure DevOps team, I figured out the solution and this blog post will hopefully help someone else who runs into this issue.

A little history on agent pools

Azure DevOps uses agents to run the pipelines for build and release. These agents run on virtual machines or containers and are grouped in pools. The pools are registered in Azure DevOps and a pipeline targets a certain pool.

Microsoft offers several agent flavors that are completely managed by Microsoft. You get 1,800 minutes per month for free (and unlimited if you run an open source project!). If you need more minutes or if you want to run pipelines in parallel, you have to pay $40 per hosted agent per month.

There are multiple flavors of agents for Mac, Windows and Linux with a variety of tools. Previously, each of these flavors got its own pool. For example: Hosted Ubuntu 1604 and Visual Studio 2017 on Windows Server 2016.

To simplify the situation, Microsoft merged all those pools into one: Azure Pipelines. When configuring your pipeline, just point it at the Azure Pipelines pool and Azure DevOps will spin up the correct agent for your situation.

If you don’t use the older pools, they will automatically disappear from your organization after 30 days.

You can also use private agents. See the post Build Your Own Hosted VSTS Agent for more information.

But I’m still seeing the old pools

I expected the Azure Pipelines pool to replace all the older pools but to my surprise I saw both Azure Pipelines and Hosted Ubuntu at my customer. I tried to delete the Hosted Ubuntu pool but it would reappear somewhere during the day.

Azure DevOps shows both the Azure Pipelines and Hosted Ubuntu 1604 pool

When looking at the details of the Ubuntu pool, I could see that some pipelines where running in that pool and others where running on the Azure Pipelines pool. I investigated one of the Ubuntu pool pipelines and saw this in the YAML:

vmImage: 'ubuntu-latest'

This was where my investigation got stuck. Fortunately, the Azure DevOps team is incredibly helpful and they responded to my email and started investigating with me.

They noticed that I selected the pool but also set a custom demand for npm in my YAML:

vmImage: 'ubuntu-latest'
demands: npm

And that’s what’s causing issues. When you have demands like this, Azure DevOps doesn’t automatically migrate you to the new Azure Pipelines pool. Instead, it will always fall back to the older pools to avoid breaking customers.

There are two solutions:

  • Remove the demand (which I did)
  • Specify the pool name explicitly in your YAML:
name: Azure Pipelines
vmImage: 'ubuntu-latest'
demands: npm

Conclusion

If you are still seeing the older pools in your Azure DevOps organization, I hope this little fix will help you.

Questions? Comments? Please reach out!