Reputation: 1708
I'm using Azure DevOps REST API to create the release pipeline and deploy through programatically. After triggering the deploy API it starts the release but it unable to download the artifacts. In the artifact section, I've configured Azure Repos to download the code within the agent. I'm getting the following error.
[Error 1] TF401019: The Git repository with name or identifier 21 does not exist or you do not have permissions for the operation you are attempting.
The number 21 is the times I have tried to accomplish this task. I don't know what went wrong.
For creating the release, I'm using the following details in the request body.
"definitionId": String(release_definition_id),
"artifacts": [{
"alias": releaseAlias,
"instanceReference": {
"definitionId": release_definition_id,
"id": buildId,
"sourceRepositoryId": azureRepoId,
"sourceRepositoryType": "TfsGit",
"sourceBranch": "master",
"sourceVersion": azureRepoCommitId
}
}]
While creating the release it is not pointing to the correct repository id. But I have provided all the correct details in the release definition.
Upvotes: 0
Views: 919
Reputation: 19016
Try with below format:
{
"definitionId": 11,
"artifacts": [
{
"alias": "_BSC",
"instanceReference": {
"sourceBranch": "master",
"sourceRepositoryId": "ee63d8d0-xxx-0bc08b6712be",
"sourceRepositoryType": "TfsGit",
"id": "34a0883b8c-xxxxx-b46c03958b0"
}
}
]
}
Key Points on above definition:
alias
: As you described, you set the Azure Repos
in artifact section. Here this alias value should be the one of your repos alias
. For example, my repo name is BSC
, so my repos alias is _BSC
.
id
: Change the sourceVersion
of your definition to id
. Then put commit id
here.
Upvotes: 1