如何在 DevOps 发布定义中设置自定义代理池?

How do one should set a custom agent pool in DevOps release definition?

我使用 DevOps REST API 创建发布定义。由于缺少文档,我曾经捕获 HTTP 请求并检查 JSON 有效负载。

我可以使用 Azure 代理池 设置发布。它仅跟随相关节点:

"deploymentInput": {
    "parallelExecution": {
        "parallelExecutionType": 0
    },
    "agentSpecification": {
        "identifier": "windows-2019"
    },
    "skipArtifactsDownload": false,
    "artifactsDownloadInput": {},
    "queueId": 749,
    "demands": [],
    "enableAccessToken": false,
    "timeoutInMinutes": 0,
    "jobCancelTimeoutInMinutes": 1,
    "condition": "succeeded()",
    "overrideInputs": {},
    "dependencies": []
}

我想设置一个自定义代理池,但如果我尝试捕获请求,我仍然无法理解如何设置它。这是带有自定义代理集的空版本的完整 JSON:

{
    "id": 0,
    "name": "New release pipeline",
    "source": 2,
    "comment": "",
    "createdOn": "2020-10-31T10:02:19.034Z",
    "createdBy": null,
    "modifiedBy": null,
    "modifiedOn": "2020-10-31T10:02:19.034Z",
    "environments": [
        {
            "id": -1,
            "name": "Stage 1",
            "rank": 1,
            "variables": {},
            "variableGroups": [],
            "preDeployApprovals": {
                "approvals": [
                    {
                        "rank": 1,
                        "isAutomated": true,
                        "isNotificationOn": false,
                        "id": 0
                    }
                ],
                "approvalOptions": {
                    "executionOrder": 1
                }
            },
            "deployStep": {
                "tasks": [],
                "id": 0
            },
            "postDeployApprovals": {
                "approvals": [
                    {
                        "rank": 1,
                        "isAutomated": true,
                        "isNotificationOn": false,
                        "id": 0
                    }
                ],
                "approvalOptions": {
                    "executionOrder": 2
                }
            },
            "deployPhases": [
                {
                    "deploymentInput": {
                        "parallelExecution": {
                            "parallelExecutionType": 0
                        },
                        "agentSpecification": null,
                        "skipArtifactsDownload": false,
                        "artifactsDownloadInput": {},
                        "queueId": 1039,
                        "demands": [],
                        "enableAccessToken": false,
                        "timeoutInMinutes": 0,
                        "jobCancelTimeoutInMinutes": 1,
                        "condition": "succeeded()",
                        "overrideInputs": {},
                        "dependencies": []
                    },
                    "rank": 1,
                    "phaseType": 1,
                    "name": "Agent job",
                    "refName": null,
                    "workflowTasks": [],
                    "phaseInputs": {
                        "phaseinput_artifactdownloadinput": {
                            "artifactsDownloadInput": {},
                            "skipArtifactsDownload": false
                        }
                    }
                }
            ],
            "runOptions": {},
            "environmentOptions": {
                "emailNotificationType": "OnlyOnFailure",
                "emailRecipients": "release.environment.owner;release.creator",
                "skipArtifactsDownload": false,
                "timeoutInMinutes": 0,
                "enableAccessToken": false,
                "publishDeploymentStatus": true,
                "badgeEnabled": false,
                "autoLinkWorkItems": false,
                "pullRequestDeploymentEnabled": false
            },
            "demands": [],
            "conditions": [
                {
                    "conditionType": 1,
                    "name": "ReleaseStarted",
                    "value": ""
                }
            ],
            "executionPolicy": {
                "concurrencyCount": 1,
                "queueDepthCount": 0
            },
            "schedules": [],
            "properties": {
                "LinkBoardsWorkItems": false,
                "BoardsEnvironmentType": "unmapped"
            },
            "preDeploymentGates": {
                "id": 0,
                "gatesOptions": null,
                "gates": []
            },
            "postDeploymentGates": {
                "id": 0,
                "gatesOptions": null,
                "gates": []
            },
            "environmentTriggers": [],
            "owner": {
                "displayName": "Giacomo Stelluti Scala",
                "id": "3617734a-1751-66f2-8343-c71c1398b5e6",
                "isAadIdentity": true,
                "isContainer": false,
                "uniqueName": "giacomo.stelluti@dev4side.com",
                "url": "https://dev.azure.com/dev4side/"
            },
            "retentionPolicy": {
                "daysToKeep": 30,
                "releasesToKeep": 3,
                "retainBuild": true
            },
            "processParameters": {}
        }
    ],
    "artifacts": [],
    "variables": {},
    "variableGroups": [],
    "triggers": [],
    "lastRelease": null,
    "tags": [],
    "path": "\test-poc",
    "properties": {
        "DefinitionCreationSource": "ReleaseNew",
        "IntegrateJiraWorkItems": "false",
        "IntegrateBoardsWorkItems": false
    },
    "releaseNameFormat": "Release-$(rev:r)",
    "description": ""
}

这是在哪里设置代理?任何人都知道如何正确地做到这一点?

非常感谢任何帮助。

贾科莫 S.S.

我在这个 中找到了解决方案。

"deploymentInput": {
    "parallelExecution": {
        "parallelExecutionType": 0
    },
    "agentSpecification": null,
    "skipArtifactsDownload": false,
    "artifactsDownloadInput": {},
    "queueId": 1039,
    "demands": [],
    "enableAccessToken": false,
    "timeoutInMinutes": 0,
    "jobCancelTimeoutInMinutes": 1,
    "condition": "succeeded()",
    "overrideInputs": {},
    "dependencies": []
}

agentSpecification 必须是 null 并且必须设置 queueId