Azure DevOps 更改代理池

Pri*_*ign 5 azure-devops

我正在尝试设置构建管道以在特定代理池上运行。目前它坚持致力于“Azure Pipelines”池:

Azure DevOps 代理池屏幕

但是我无法更改构建管道的代理池(至少我不确定如何更改)。

我的 YAML 如下所示:

trigger:

- master

pool:
  vmImage: 'ubuntu-latest'

variables:
  buildConfiguration: 'Release'

steps:
- task: NuGetCommand@2
  inputs:
    command: 'restore'
    restoreSolution: '**/*.sln'
    feedsToUse: 'select'

- script: dotnet build --configuration $(buildConfiguration)
  displayName: 'dotnet build $(buildConfiguration)'

- task: DotNetCoreCLI@2
  displayName: 'Pack the package'
  inputs:
    command: 'pack'
    configuration: 'Release'
    packagesToPack: 'NugetComponents/**/*.csproj'
    nobuild: true

- task: PublishBuildArtifacts@1
  inputs:
    PathtoPublish: '$(Build.ArtifactStagingDirectory)'
    ArtifactName: 'drop'
    publishLocation: 'Container'
Run Code Online (Sandbox Code Playgroud)

我不确定这里是否需要更改任何内容。我在界面中找不到任何用于配置管道应使用哪个代理布尔值的内容?

Kev*_*SFT 12

根据有关代理池的文档,\xe2\x80\x9cAzure Pipelines\xe2\x80\x9d 池包含各种 Windows、Linux 和 macOS 映像。

\n\n
\n

Azure Pipelines 托管池将替换以前的托管池,\n 其名称已映射到相应的映像。之前托管池中的任何作业都会自动重定向到新 Azure Pipelines 托管池中的正确映像。

\n
\n\n

因此,当您指定 Microsoft 托管代理(例如 Ubuntu-latest)时,管道将在 \xe2\x80\x9cAzure Pipelines\xe2\x80\x9d 池上运行。

\n\n

更新

\n\n

您可以在 \xe2\x80\x9cpool\xe2\x80\x9d 字段中指定目标代理池。

\n\n

这是 Yaml 的格式:

\n\n
pool:\n  name: string  \n  demands: string \n  vmImage: string \n
Run Code Online (Sandbox Code Playgroud)\n\n

对于 Microsoft 托管的代理:您可以直接指定 \xe2\x80\x9cvmImage\xe2\x80\x9d。

\n\n

例如:

\n\n
pool:\n  vmImage: \'ubuntu-16.04\'\n
Run Code Online (Sandbox Code Playgroud)\n\n

对于自托管代理:您可以指定代理池名称。

\n\n

例如:

\n\n
pool:\n  name: Agent Pool name\n
Run Code Online (Sandbox Code Playgroud)\n\n

这是有关在 Yaml 中指定代理池的文档。

\n