A colleague trying to add SonarQube integration to his build pipeline in Azure DevOps, contacted me because he got an error in his build pipeline.
This is the error he got:
##[error]No agent found in pool default which satisfies the following demand: Agent.Version. All demands: msbuild, visualstudio, Agent.Version -gtVersion 3.218.0
The problem was caused by the SonarQubePrepare task he just added to his build pipeline:
It still worked with an older SonarQubePrepare version however the task is marked as deprecated:
##[warning]This task is deprecated. Please upgrade to the latest version. For more information, refer to https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarqube-extension-for-azure-devops/
Updating a build agent
I thought the fix would be easy; just update the outdated build agent(s).
- Therefore go to Project Settings –> Agent Pools.
- Click on the Agent pool which contains the agent you want to update:
- On the detail screen, click on Update All Agents:
- Or go to the Agents tab, click on the 3 dots next to the agent and choose Update Agent:
Remark: The screenshots above are taken after successfully upgrading the agent. So they already refer to the v3.x. version.
Unfortunately in this case it didn’t help and the agent remained on v2.x. A look at the documentation brought me a step closer to a solution. The v3.x version of the agent were part of a newer Azure DevOps Server version.
Time for an upgrade!
After upgrading the Azure DevOps server instance, I returned to the Agent Pool details and clicked on Update All Agents again. And this time the build agent upgrade was finally triggered:
Hurray!
More information
SonarQube extension for Azure DevOps (sonarsource.com)
Agent software version 3 - Azure Pipelines | Microsoft Learn