我正在尝试使用Azure Devops API创建一个发布管道,但我得到了以下错误:
{
"$id": "1",
"innerException": null,
"message": "VS402936: Release pipeline with ID 467 does not exist. Specify a valid ID and try again.",
"typeName": "Microsoft.VisualStudio.Services.ReleaseManagement.WebApi.Exceptions.ReleaseDefinitionNotFoundException, Microsoft.VisualStudio.Services.ReleaseManagement.WebApi",
"typeKey": "ReleaseDefinitionNotFoundException",
"errorCode": 0,
"eventId": 3000
}我的印象是,向https://vsrm.dev.azure.com/{organization}/{project}/发送POST请求实际上会创建发布管道-我误解了这一点吗?
我对此的理解来自于这个问题:https://developercommunity.visualstudio.com/t/api-documentation-out-of-date/1437337,它确实帮助我创建了一个构建管道
请查找下面的请求正文-请注意,由于我已删除个人和组织信息,因此某些值将有所不同:
{
"id": 467,
"name": "testProject",
"source": "restApi",
"revision": 1,
"description": "Built by project_setup.py",
"createdBy": null,
"createdOn": "2021-11-23T10:55:39.418Z",
"modifiedBy": null,
"modifiedOn": "2021-11-23T10:55:39.418Z",
"isDeleted": false,
"variables": {},
"variableGroups": [],
"environments": [
{
"id": 628,
"name": "dev",
"retentionPolicy": {
"daysToKeep": 30,
"releasesToKeep": 3,
"retainBuild": true
},
"preDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": false,
"isNotificationOn": false,
"approver": {
"displayName": null,
"id": "aeb95c63-4fac-4948-84ce-711b0a9dda97"
},
"id": 628
}
]
},
"postDeployApprovals": {
"approvals": [
{
"rank": 1,
"isAutomated": true,
"isNotificationOn": false,
"id": 628
}
]
},
"deployPhases": [
{
"deploymentInput": {
"parallelExecution": {
"parallelExecutionType": "none"
},
"skipArtifactsDownload": false,
"artifactsDownloadInput": {},
"queueId": 154,
"demands": [],
"enableAccessToken": false,
"timeoutInMinutes": 0,
"jobCancelTimeoutInMinutes": 1,
"condition": "succeeded()",
"overrideInputs": {}
},
"rank": 1,
"phaseType": "agentBasedDeployment",
"name": "Run on agent",
"workflowTasks": []
}
],
"environmentOptions": {
"emailNotificationType": "OnlyOnFailure",
"emailRecipients": "release.environment.owner;release.creator",
"skipArtifactsDownload": false,
"timeoutInMinutes": 0,
"enableAccessToken": false,
"publishDeploymentStatus": false,
"badgeEnabled": false,
"autoLinkWorkItems": false,
"pullRequestDeploymentEnabled": false
},
"demands": [],
"conditions": [],
"executionPolicy": {
"concurrencyCount": 0,
"queueDepthCount": 0
},
"schedules": [],
"properties": {},
"preDeploymentGates": {
"id": 628,
"gatesOptions": null,
"gates": []
},
"postDeploymentGates": {
"id": 628,
"gatesOptions": null,
"gates": []
},
"environmentTriggers": [],
"rank": 1,
"owner": {
"displayName": "<myemail>",
"url": "https://dev.azure.com/<mycompany>/_apis_Identities/<myid>",
"_links": {
"avatar": {
"href": "https://dev.azure.com/w2globaldata/_apis/GraphProfile/MemberAvatars/<mydescriptor>"
}
},
"id": "<myid>",
"uniqueName": "<myemail>",
"imageUrl": "https://dev.azure.com/<company>/_api/_common/identityImage?id=<myid>",
"descriptor": "<mydescriptor>"
}
}
],
"artifacts": [],
"triggers": [],
"releaseNameFormat": null,
"tags": [],
"properties": {},
"projectReference": null,
"_links": {}
}如果任何人能提供任何帮助,或有任何这方面的经验,将不胜感激!
发布于 2021-11-23 15:58:46
这取决于您想要创建的内容...在您的示例中,您似乎希望使用在正文中定义的id 467更新现有的发布定义:
{ "id": 467, }如果你想创建一个发布定义,你必须使用这个例子:Create release definition。因此,尝试删除ID属性。
如果要创建现有版本定义的新版本,请使用以下示例:Sample Request
https://stackoverflow.com/questions/70082209
复制相似问题