Azure DevOps YAML 自托管代理管道构建卡在定位自代理
Azure DevOps YAML self hosted agent pipeline build is stuck at locating self-agent
操作: 我尝试在自托管 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
信息与测试:
我的自托管代理名称是 Weltgeist,它是
默认代理 pools.it 是一台 windows 计算机,具有所有 g++、mingw 和
其他相关工具就可以了。
我在本地尝试构建任务没有问题。
我使用 azure 'ubuntu-latest' 代理尝试了我的构建任务,没有
问题。
我按照这些规范创建了自托管代理。
我是 azure 仓库的所有者。
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'
(更新)
解法:
谢谢,在按照下面的答案更新它并阅读更多 pool 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'
由于您使用的是 self-hosted 代理,您可以使用以下格式:
pool:
name: Default
demands:
- agent.name -equals Weltgeist
那么它应该会按预期工作。
您可以参考有关 POOL Definition in Yaml 的文档。
我对 Default
感到困惑,因为组织中已经有一个名为 Default
的管道。
扩展此处提供的答案。
pool:
name: NameOfYourPool
demands:
- agent.name -equals NameOfYourAgent
这是您可以在 DevOps 中找到该信息的屏幕。
我遇到过同样的问题,将池下的 vmImage 替换为“名称”对我有用。多溴联苯,
触发器:
- 硕士
池:
name: 'Weltgeist' #使用自托管代理进行测试
操作: 我尝试在自托管 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
信息与测试:
我的自托管代理名称是 Weltgeist,它是 默认代理 pools.it 是一台 windows 计算机,具有所有 g++、mingw 和 其他相关工具就可以了。
我在本地尝试构建任务没有问题。
我使用 azure 'ubuntu-latest' 代理尝试了我的构建任务,没有 问题。
我按照这些规范创建了自托管代理。 我是 azure 仓库的所有者。 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'
(更新) 解法:
谢谢,在按照下面的答案更新它并阅读更多 pool 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'
由于您使用的是 self-hosted 代理,您可以使用以下格式:
pool:
name: Default
demands:
- agent.name -equals Weltgeist
那么它应该会按预期工作。
您可以参考有关 POOL Definition in Yaml 的文档。
我对 Default
感到困惑,因为组织中已经有一个名为 Default
的管道。
扩展此处提供的答案。
pool:
name: NameOfYourPool
demands:
- agent.name -equals NameOfYourAgent
这是您可以在 DevOps 中找到该信息的屏幕。
我遇到过同样的问题,将池下的 vmImage 替换为“名称”对我有用。多溴联苯,
触发器:
- 硕士
池: name: 'Weltgeist' #使用自托管代理进行测试