3

Pipelines are not getting created when Azure DevOps REST API is used for creation. I have used - Create - Rest API. Please find the request URI and request body used below:

Request : POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.0-preview.1

Request Body:

{
"folder": "",
"name": "pipeline-by-api",
"configuration": {
    "type": "yaml",
    "path": "/azure-pipelines.yml",
    "repository": {
        "id": "00000000-0000-0000-0000-000000000000",
        "name": "repo-by-api",
        "type": "azureReposGit"
    }
}

}

Below is the response received:

{
"$id": "1",
"innerException": null,
"message": "No pool was specified.",
"typeName": "Microsoft.TeamFoundation.Build.WebApi.QueueNotFoundException, Microsoft.TeamFoundation.Build2.WebApi",
"typeKey": "QueueNotFoundException",
"errorCode": 0,
"eventId": 3000

}

Pool is specified in the YAML file as below:

pool:
 name: #######
 demands:
 - maven

If I try to create pipeline manually, it is working successfully. Issue exist only when it is created from Azure DevOps REST API.

Sneha Dominic
  • 368
  • 2
  • 14
  • Does your azure-pipelines.yml specify an agent pool? – TrevorBrooks Aug 12 '21 at 13:22
  • 1
    @TrevorBrooks - Yes It does. I am using a Global Pipeline Template. Hence, agent is defined in the template file. Also, as an update, if I try to create pipeline manually using the same yaml file, it works. With REST API, it is failing. – Sneha Dominic Aug 12 '21 at 13:25
  • What do you mean by saying `Global Pipeline Template`? – Krzysztof Madej Aug 12 '21 at 13:45
  • https://developercommunity.visualstudio.com/t/creating-pipeline-by-api-60-preview1-no-pool-was-s/1327848 – Shayki Abramczyk Aug 12 '21 at 14:17
  • @ShaykiAbramczyk - Thanks for the reference. In the quoted query, they were storing agent pool name in variable group/library group which might've caused the issue. here, I am directly mentioning the pool name. Still, I am facing issues. – Sneha Dominic Aug 12 '21 at 16:04
  • @KrzysztofMadej - Apologies I didn't make it clear. I just meant to say that I am using a pipeline template. Parameters are passed from the pipeline yaml and the steps/jobs are defined in the template file. Still, pool name is mentioned directly in the pipeline yaml. So, I guess, that doesn't make much difference. – Sneha Dominic Aug 12 '21 at 16:05
  • Hey @sneha did you find the resolution for this? am facing similar issue – priya Sep 29 '21 at 06:05
  • @priya - There is another API for definitions, that can be used to create pipeline. I have used that. https://stackoverflow.com/questions/68767454/what-is-the-difference-between-pipelines-create-and-definitions-create-in-az – Sneha Dominic Sep 30 '21 at 05:14

3 Answers3

1

I faced the same problem with you: when I used REST API for pipeline creation, it always remind me "No pool was specified." But when I try to create pipeline manually, it works successfully. Maybe you can try to change the REST API version, not using version= 6.0-preview.1, you can set your pipeline Request : POST https://dev.azure.com/{organization}/{project}/_apis/pipelines?api-version=6.1-preview.1

Another question: Did you set your YAML file and specify your pool before creating pipeline by REST API?

yuxi yang
  • 11
  • 2
  • Consider putting a code example on how to change the REST API, and also how to set the YAML file and specify the pool. – ouflak Sep 16 '21 at 06:23
  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 16 '21 at 10:57
0

Pipeline creation with Azure DevOps REST API fails with error “No pool was specified”

If you are using the variable for the agent pool name, please try to use hardcoded agentpool name.

AFAIK, the variable are secured and downloaded directly to the agent and cannot be used for pool names since this is needed to be resolved on the server seems a false statement.

You could check this thread for some more details.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • I am not using variables for the pool name. The name is hardcoded and is directly given in the pipeline yml file. Still, I am facing the issue. – Sneha Dominic Aug 16 '21 at 04:47
0

I have been experiencing the same issue and I was able to resolve it by ensuring that a branch in the repository was set as the default branch.

Bri
  • 13
  • 5