首页 > 解决方案 > 如何在 DevOps 发布定义中设置自定义代理池?

问题描述

我使用DevOps REST APIs创建发布定义。由于缺乏文档,我过去常常捕获 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": ""
}

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

任何帮助都非常感谢。

贾科莫 SS

标签: azurerestazure-pipelines-release-pipeline

解决方案


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

"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必须设置。


推荐阅读