【问题标题】:Azure DevOps YAML self hosted agent pipeline build is stuck at locating self-agentAzure DevOps YAML 自托管代理管道构建卡在定位自代理
【发布时间】:2020-12-21 04:13:19
【问题描述】:

操作:我尝试在自托管的 windows 计算机上配置和运行一个简单的 c++ azure 管道。我对这一切都很陌生。我运行了下面的脚本。

预期:会看到构建任务、显示任务和清理任务。看你好字。

结果:错误,脚本找不到我的构建代理。

##[warning]An image label with the label Weltgeist does not exist.
,##[error]The remote provider was unable to process the request.
Pool: Azure Pipelines
Image: Weltgeist
Started: Today at 10:16 p.m.
Duration: 14m 23s

信息与测试:

  1. 我的自托管代理名称是 Weltgeist,它是 默认代理池。它是一台 Windows 计算机,具有所有 g++、mingw 和 其他相关工具就可以了。

  2. 我在本地尝试构建任务没有问题。

  3. 我使用 azure 'ubuntu-latest' 代理尝试了我的构建任务,但没有 问题。

  4. 我按照这些规范创建了自托管代理。 我是 azure repo 的所有者。 https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops

如何正确配置自托管代理的 pool ymal 参数? 我有额外的步骤来做服务器端吗?还是在 azure repo 配置上? 对出了什么问题还有其他想法吗?


# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml

trigger:
- master

pool:
  vmImage: 'Weltgeist' #Testing with self-hosted agent

steps:
- script: |
    mkdir ./build
    g++ -g ./src/hello-world.cpp -o ./build/hello-world.exe
  displayName: 'Run a build script'

- script: |
    ./build/hello-world.exe
  displayName: 'Run Display task'

- script: |
    rm -r build
  displayName: 'Clean task'

(更新) 解决方案:

Thx,在按照下面的答案中所述更新它并阅读更多池 ymal 定义后它可以工作。请注意,我修改了其他几行以使其适用于我的环境。


trigger:
- master

pool:
  name: Default
  demands:
   - agent.name -equals Weltgeist

steps:
- script: |
    mkdir build
    g++ -o ./build/hello-world.exe ./src/hello-world.cpp
  displayName: 'Run a build script'

- script: |
    cd build
    hello-world.exe
    cd ..
  displayName: 'Run Display task'

- script: |
    rm -r build
  displayName: 'Clean task'

【问题讨论】:

标签: c++ azure-devops continuous-integration yaml g++


【解决方案1】:

我遇到了同样的问题,用“名称”替换池下的 vmImage 对我有用。 PFB,

触发器:

  • 主人

池: name: 'Weltgeist' #使用自托管代理进行测试

【讨论】:

    【解决方案2】:

    我对@9​​87654323@ 感到困惑,因为组织中已经有一个名为Default 的管道。

    扩展此处提供的答案。

    pool:
      name: NameOfYourPool
      demands:
       - agent.name -equals NameOfYourAgent
    
    

    这是您可以在 DevOps 中找到该信息的屏幕。

    【讨论】:

      【解决方案3】:

      由于您使用的是自托管代理,您可以使用以下格式:

      pool:
        name: Default
        demands:
         - agent.name -equals Weltgeist  
      

      然后它应该按预期工作。

      您可以参考有关POOL Definition in Yaml的文档。

      【讨论】:

        猜你喜欢
        • 2020-06-08
        • 2021-11-14
        • 2020-01-01
        • 1970-01-01
        • 2021-02-20
        • 2020-03-27
        • 1970-01-01
        • 2021-12-28
        • 1970-01-01
        相关资源
        最近更新 更多