【问题标题】:Azure DevOps change Agent PoolAzure DevOps 更改代理池
【发布时间】:2021-12-07 21:59:48
【问题描述】:

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

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

我的 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'

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

【问题讨论】:

  • 你看过 YAML 文档吗?它详细解释了如何指定代理池。
  • 嗨,Prime By Design,这个问题有更新吗?如果我的回答有助于解释您的问题,请随时告诉我。只是提醒this。
  • @DanielMann 是的,我查看了文档,但不清楚我需要指定名称属性。
  • 如果人们能给我一些关于任何否决票的推理以便我可以改进我的问题,那将非常有帮助。

标签: azure-devops


【解决方案1】:

根据this doc about agent pools,“Azure Pipelines”池包含各种 Windows、Linux 和 macOS 映像。

Azure Pipelines 托管池取代了以前的托管池 具有映射到相应图像的名称。你的任何工作 在以前的托管池中具有自动重定向到 新 Azure Pipelines 托管池中的正确映像。

因此,当您指定 Microsoft 托管的代理(例如 Ubuntu-latest)时,管道将在“Azure Pipelines”池上运行。

更新

您可以在“池”字段中指定目标代理池。

这是 Yaml 的格式:

pool:
  name: string  
  demands: string 
  vmImage: string 

对于 Microsoft 托管的代理:您可以直接指定“vmImage”。

例如:

pool:
  vmImage: 'ubuntu-16.04'

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

例如:

pool:
  name: Agent Pool name

这是一个关于 specifying agent pool in Yaml 的文档。

【讨论】:

  • 嘿Kevin,原来我需要使用name属性在yaml文件中指定池。
  • @PrimeByDesign 是的。你说的对。我已经更新了我的答案。希望这些对你有帮助。
猜你喜欢
  • 2019-12-12
  • 1970-01-01
  • 2021-05-13
  • 2019-06-03
  • 2021-04-19
  • 2019-06-06
  • 2021-07-07
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多