Queue jobs stuck in Azure Devops pipelines

138 Views Asked by At

I am facing a problem with the agent pools jobs in my Azure DevOps project.

I have the Azure Pipelines agent pool (not self-hosted) which it says it is running 2 jobs and there are also 70 more in queue.

enter image description here

When I click on the Azure Pipelines agent pool, it appear all the jobs. All the jobs appear with the white circle icon, it means there are not really any jobs running.

enter image description here

I tried to cancel and delete all of this jobs and, now, when I click any of them, it shows the following message:

enter image description here

I've tried by upgrading my user permissions in pipelines manage security options, disabling the agents of the azure pipelines agent pool, deleting the azure agent pool and re-adding it... and neither worked for me. It does not changes anything.

I've also seen that some people says that it could be a pipelines delay bug from Azure DevOps, and some of this people get solved this bug by itself after some hours/days, but I need to solve it quickly.

1

There are 1 best solutions below

0
wade zhou - MSFT On

I've also seen that some people says that it could be a pipelines delay bug from Azure DevOps, and some of this people get solved this bug by itself after some hours/days, but I need to solve it urgent.

Yes, it could be recovered after some hours/days. But if it persists now, please try below options:

  1. purchase another parallel job, after it works(pipeline can grant the agent), delete the job purchased(link here).

  2. If it doesn't work, use rest api Agents - List to grant the pool status:

https://dev.azure.com/{organization}/_apis/distributedtask/pools/{poolId}/agents?api-version=6.0

check if the provisioningState in response is Deallocated. If it's not, update the value via below PowerShell script(change the pool id and agent id to yours):

Param(
   [string]$organization = "yourorgname",
   [string]$token = "PAT"  
)

$base64AuthInfo = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f $user,$token)))

$url="https://dev.azure.com/$organization/_apis/distributedtask/pools/9/agents/8?api-version=5.1"

$body = @"
{
    "Id": 8,
    "ProvisioningState": "Deallocated"
}
"@

Invoke-RestMethod -Uri $url -Headers @{Authorization=("Basic {0}" -f $base64AuthInfo)} -Body $body -ContentType "application/json" -Method PATCH

If the issue persists, it could be also caused by the Agent Pool Service (9) identity was removed from your [organization]/Security Service Group. Note the identity number(9) here could be different on your organization. Please check the link for the details.

If you need to resolve it urgent, first option is to raise a support request via the Azure portal. You need to have an Azure support plan associated with your subscription? Click here to create a support request. please share the build pipeline url and issue details in the support request description.