【发布时间】: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
信息与测试:
-
我的自托管代理名称是 Weltgeist,它是 默认代理池。它是一台 Windows 计算机,具有所有 g++、mingw 和 其他相关工具就可以了。
-
我在本地尝试构建任务没有问题。
-
我使用 azure 'ubuntu-latest' 代理尝试了我的构建任务,但没有 问题。
-
我按照这些规范创建了自托管代理。 我是 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'
【问题讨论】:
-
您阅读文档了吗?你在滥用
vmImage;它不用于指定自托管代理。 docs.microsoft.com/en-us/azure/devops/pipelines/… -
@Weltgeist。很高兴知道答案可以给你一些帮助。你可以考虑accepting it as answer。所以它可以帮助遇到同样问题的其他社区成员,谢谢
标签: c++ azure-devops continuous-integration yaml g++