Reputation: 415
I am trying to find a good example of the json body for Create Build Definition in Azure Devops. Most of the documentation I find has api definitions, but I haven't been able to see an example json body to work from.
Microsoft Documentation:
https://learn.microsoft.com/en-us/rest/api/azure/devops/build/definitions/create?view=azure-devops-rest-5.1
I have found this article that describes doing something similar to what I hope to accomplish. However, they are trying to duplicate the same build definition across different projects.
Similar Example:
https://www.nebbiatech.com/2018/11/29/automating-build-pipeline-creation-using-azure-devops-services-rest-api/
Ultimately, I would like to be able to generate (either create new or clone/modify) as many standard build definitions within a single project as are necessary by my automation. Each one of these build definitions will pull from a different repository within the project and have a different cosmetic name for the pipeline, but will be otherwise identical.
Any suggestions are greatly appreciated. Thanks!
Upvotes: 1
Views: 1911
Reputation: 51153
For the usage of YAML build as comment suggested, it will meet your requirements. It letting you define your build in a YAML file that lived with your code. This meant you could use the same branching and code review practices for your build definitions as you did for your code.
The best way to get started with YAML pipelines is through the quickstart guide and Customize your pipeline . After that, to learn how to configure your YAML pipeline the way you need it to work, see conceptual topics such as Build variables and Jobs.
As for a sample of application/json body when you use Rest API to create build definition. You could also refer below links:
Upvotes: 1