The Azure Devops pipeline is already defined with multiple repos and working as expected from Azure DevOps Tool, this Tool allows to change the branch names while triggering the build.
I am working on automating the build using a equivalent APIs and I would like to change the branch names for both the repos while triggering a build.
I am able to achieve apart of this by passing the sourceBranch for 1st repo using json request as mentioned below. I am not sure how to update the branch name for second repo in multiple repo build pipeline setup.
https://dev.azure.com/{Organization}/{Project}/_apis/build/builds?api-version=6.0
{
"sourceBranch": "<branch-name>",
"definition": {
"id": 6
}
}
Any help on this really appreciated.
CodePudding user response:
It's impossible int he build api, but it's available in the Runs - Run Pipeline API:
POST https://dev.azure.com/{organization}/{project}/_apis/pipelines/{pipelineId}/runs?api-version=7.1-preview.1
In the body you can specify resources
:
"resources":{"repositories":{"devops":{"refName":"refs/heads/test-branch","version":""},"self":{"refName":"refs/heads/master"}}},"variables":{}}