0
votes

I have an issue with running a YAML based build pipeline on self-hosted agents. After the build is triggered, it gets stuck on Preparing an agent for the job - Waiting for the request to be queued.

The azure-pipelines.yml looks like this:

trigger:
- master

pool:
  name: Default

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

If I change to a Microsoft hosted agent, the build does work:

trigger:
- master

pool:
  vmImage: ubuntu-16.04

steps:
- script: echo Hello, world!
  displayName: 'Run a one-line script'

The strange thing is that I have other existing YAML build pipelines that is working fine on the self-hosted agents, but all new pipelines I try to create just ends up getting stuck with Waiting for the request to be queued.

I have tried on what is currently the latest versions of the agent daemon, both 2.164.8 and 2.165.0, to no avail. I have also checked that I am not being limited by the maximum number of parallel jobs in DevOps.

3
I suspect that the agent is missing capabilities to run the job, try and investigate that - 4c74356b41
The agent can run much more complex builds, so I find it strange for it to lack capabilities for such a simple build. - sveinungf
well, you need to identify whats holding up the build. usually is capabilities. its not a matter of complex vs straightforward. your build might have arbitrary capability attached to it - 4c74356b41
Have you checked how many agents in current default agent pool? If you have both old and new agents in the pool, we can't make sure it will pick the new-version agent for us to run the job. (I once met similar issue when I use one quite old agent 16.3 version). I think you can create a new agent pool and register a new agent in that pool, then in your yaml specify to use the new agent pool. What's the result? - LoLance

3 Answers

1
votes

The strange thing is that I have other existing YAML build pipelines that is working fine on the self-hosted agents, but all new pipelines I try to create just ends up getting stuck with Waiting for the request to be queued.

You only specify to use Default agent pool. So it will pick up one available agent in that pool to run the job.

Go Organization Settings => Agent Pools to check the available agents in Default agent pool.

We should make sure we have one available agent with version 2.164.8 and higher, it should be online status and enabled. And then we can temporarily disable other agents in that pool, run your pipeline again to check if it helps. (In this situation, it should pick the good agent to run your pipeline)

I guess maybe you have different definitions about pool: in your other old yaml pipelines. Or you can create a new Agent Pool named MyPool, and create one new agent in MyPool, then in your yaml specify to use name: MyPool to check if there's something wrong with the agents in Default pool.

1
votes

It turned out to be a permission issue to the agent pool. In Organization Settings => Agent Pools => POOL_NAME => Security, there is a setting called Grant access permission to all pipelines. After enabling this, my builds are now working as expected.

0
votes

Be sure and check that the agent is running in Windows services on the server. I had what appeared to be the same issue, but had a different root cause. The Azure Pipeline Agent... service was stopped after an unplanned outage which resulted in the the service not restarting. Someone or some process had set the service start property to "Auto Start(delay)" instead of "Auto Start".