Search code examples
azureazure-devopscontinuous-integrationbuild-agentazure-devops-self-hosted-agent

"Job is pending" message in Azure DevOps pipelines


We are using TFVC as VCS, our repo is located in Azure Repos, we use Azure DevOps for CI/CD. There is a pipeline building changes of Main branch and "Gated check-in" option is enabled.

We use hosted agents deployed on our build servers. Currently there are 3 build environments and 1 agent is deployed to each build env. As there are many developers working on the project - many concurrent check-ins became a bottleneck, that's why we have now 3 agents in a single agent pool, the pipeline has 1 job and it is using agent pool with 3 agents.

The problem is that when several developers check-in changes only 1 build is running, all other in a queue have to wait until it finishes, despite the fact that other 2 agents are online and Idle in the same pool. The build is queued with the message "Job is pending". Interesting thing is that if we run the pipeline from azure devOps they run concurrently, but when developers check-in changes from Visual Studio - they're queued.


Solution

  • This is due to the "gated checkin" option being enabled. Gated checkins do not run in parallel.

    This answer provides more details.

    In short, gated checkins take the latest changeset in the branch + the code being checked in and then build the code. If the build fails then the checkin will fail. If you want to have parallel builds then you need to disable gated checkins and use a CI build instead.