1
votes

Action: I tried to configure and run a simple c++ azure pipeline on a self-hosted windows computer. I'm pretty new to all this. I ran the script below.

Expected: to see build task, display task and clean task. to see hello word.

Result: Error, script can't find my build agent.

##[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

Info & Test:

  1. My self-hosted agent name is Weltgeist and it's part of the default agent pools.it's a windows computer, with all g++, mingw and other related tools on it.

  2. I tried my build task locally with no problem.

  3. I tried my build task using azure 'ubuntu-latest' agent with no problem.

  4. I created the self-hosted agent following these specification. I'm the owner of the azure repo. https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/v2-windows?view=azure-devops

How do I configure correctly the pool ymal parameter for self-hosted agent ? Do i have addition steps to do server side? or on azure repo configs? Any other idea of what went wrong?


# 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'

(UPDATE) Solution:

Thx, after updating it as stated in a answer below and reading a bit more pool ymal definition it works. Note, I modified a couple of other lines to make it work on my environment.


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'

2
Did you read the documentation? You're misusing vmImage; it's not used to specify a self-hosted agent. docs.microsoft.com/en-us/azure/devops/pipelines/…Daniel Mann
@Weltgeist. Glad to know that the answer could give you some help. You may consider accepting it as answer. so it could help other community members who get the same issues , thanksKevin Lu-MSFT

2 Answers

1
votes

Since you are using the self-hosted agent, you could use the following format:

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

Then it should work as expected.

You could refer to the doc about POOL Definition in Yaml.

1
votes

I was confused by the Default because there was already a pipeline named Default in the organization.

Expanding on the answers provided here.

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

Here is screen you'll find that information in DevOps.

enter image description here