Skip to content

[Question]: How does the Agent evaluate the Capabilities #5247

Open
@o-hainz

Description

@o-hainz

Describe your question

We use a self hosted agent on a Windows Server.
We try to use a ShellScript@2 task. This does not work and the pipeline on the Agent fails with this error:

##[error]No agent found in pool ... which satisfies the specified demands: sh, Agent.Version -gtVersion 2.163.1

The pipeline definition looks like this:

        steps:
          - task: CmdLine@2
            displayName: 'Test cmd'
            inputs:
              script: |
                echo "Echo %Agent.Version%"
                sh --version
                bash --version
          - task: ShellScript@2
            displayName: 'Test sh'
            inputs:
              scriptPath: echo "Echo from sh"      

If we remove the ShellScript@2 task the pipeline works like expected and does not report an error.

Working pipeline definition:

        steps:
          - task: CmdLine@2
            displayName: 'Test cmd'
            inputs:
              script: |
                echo "Echo %Agent.Version%"
                sh --version
                bash --version

The output of this task looks like this:

Starting: Test cmd
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.250.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
"C:\Windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "C:\azp\agent\_work\_temp\48f5003c-efc7-4b7f-90e9-d28dad4a3929.cmd""
"Echo 4.255.0"
GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <[http://gnu.org/licenses/gpl.html>](http://gnu.org/licenses/gpl.html%3E)

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
GNU bash, version 5.2.37(1)-release (x86_64-pc-msys)
Copyright (C) 2022 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <[http://gnu.org/licenses/gpl.html>](http://gnu.org/licenses/gpl.html%3E)

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Finishing: Test cmd

In the output we see that the cmd finds the sh and the bash. Also the environment variable Agent.Version has the value 4.255.0.

Question:

How does the Agent evaluate the Capabilities? What is needed to use a ShellScript@2? The final goal is to use a AWSShellScript@1 in a local hosted agent. What else do we need?

Versions

Agent.Version is 4.255.0
Windows Server 2022

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

dev.azure.com (formerly visualstudio.com)

Operation system

Windows Server 2022

Version controll system

Git in Azure DevOps

Azure DevOps Server Version (if applicable)

https://dev.azure.com/

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions