Richard Barraclough
Richard Barraclough

Reputation: 2984

Azure pipeline self hosted agent demands Agent.OS -equals Windows_NT

I have a job that needs Windows if there are any NuGet packages because the PushSymbols task doesn't work on Linux

jobs:
- job: 'The job'
  pool:
    #${{ if eq(variables.useSelfHostedAgent, 'True') }}: # is ignored
    ${{ if ne(variables['Build.SourceBranchName'], 'master') }}:
      name: 'Default' # run on rwb's machine (plus whatever else is in the default pool).
      ${{ if ne(variables['Build.SourceBranchName'], 'merge') }}:
        demands: 
        - Agent.OS -equals 'Windows_NT' # PushSymbols task in pack.yml only works on Windows.
    ${{ else }}:
      vmImage: 'windows-latest' # run on the MS hosted pool (limited to 1800 hours per month).

I think that I have such an agent... enter image description here

.. but Azure doesn't.

##[error]No agent found in pool Default which satisfies the following demand: Agent.OS. All demands: Agent.OS -equals 'Windows_NT', Agent.Version -gtVersion 2.182.1
Pool: Default
Started: Just now
Duration: 1m 12s

What's wrong with it?!

Upvotes: 0

Views: 1426

Answers (1)

Antonia Wu-MSFT
Antonia Wu-MSFT

Reputation: 569

Sometimes I will meet the issue if I add '' in 'Windows_NT'. enter image description here

However, if I remove the '' in 'Windows_NT' and let it like belows, the issue gone.

demands: 
- Agent.OS -equals Windows_NT

Please kindly try whether it works on your side. Also FYI, the job name in - job: 'The job' is invalid as it is supposed to not have the symbols like space.

Upvotes: 1

Related Questions