I can able to create the build definition using Azure DevOps REST API. When I ran the build definition from the portal, it is not using azure-pipeline.yml
file which is part of the codebase in Azure Repos. The pipeline file(azure-pipeline.yml
) includes the docker task which will build an image for the application. But this operation is not working. To figure out this problem, I have created two definitions.
- Created the build definition manually from Azure DevOps Portal.
- Created the build definition using Azure DevOps REST API.
The first approach works as expected. It is creating a docker image for the application and the docker tasks works. The second approach didn't work and it just check out the source code from the repository.
I came across the process parameters which include the path of the pipeline file. I don't know how to configure the same using REST API.
I'm following this documentation https://learn.microsoft.com/en-us/rest/api/azure/devops/build/definitions/create?view=azure-devops-rest-5.1
EDIT 1
{
"name": "myapp2",
"badgeEnabled": "true",
"queue": {
"name": "Hosted Ubuntu 1604",
"pool": {
"name": "Hosted Ubuntu 1604",
"isHosted": true
}
},
"jobAuthorizationScope": "projectCollection",
"jobTimeoutInMinutes": 60,
"jobCancelTimeoutInMinutes": 5,
"quality": "definition",
"type" : "build",
"process": {
"type": 2
},
"processParameters" : {
"inputs" : [{
"name" : "azure-pipeline.yml",
"required" : true
}]
}
Rest of the configuration is related to repositories
.
Creating Build Definition in Portal
Creating Build Definition using Azure DevOps REST API