Reputation: 468
I was trying to create a yml pipeline with Pipeline - Create Azure DevOps REST API and it was throwing an exception 'No pool was specified' even though I have mentioned pool in the yml file. More details of this issue is available here. Please find below, the request body used for creating pipeline.
{
"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"
}
}
Then I identified a second REST API, Definitions - Create and using this I was able to successfully create a pipeline. Please find below the request body used for creating build definition.
{
"process":{
"yamlFilename": "azure-pipelines.yml"
},
"queue":{
"pool":{
"name": "Azure Pipelines"
}
},
"repository": {
"id": "00000000-0000-0000-0000-000000000000",
"type": "TfsGit",
"name": "repo-by-api",
"defaultBranch": "refs/heads/master"
},
"name": "pipeline-by-api",
"path": "\\API-Test",
"type": "build",
"queueStatus": "enabled"
}
I would like to understand what's the difference between the two. I have tried Definitions - Create as Pipelines - Create was not working for me. But is this a correct way of creating pipeline?
Upvotes: 0
Views: 249
Reputation: 40693
Definitions - Create
is an older endpoint. It was availabe before YAML pipeline becomes first class citizens. Pipelines - Create
is a new endpoint suited for YAML pipelines. Both can be used to create pipeline and if you change API version to 4.1 you will see that Pipelines
is not available.
If I have to guess, they find a reason to create a new endpoint for handling yaml pipelines, probably to avoid some breaking changes, but this is only a guess.
Upvotes: 1