2

As far as I know, Azure DevOps agents are capable of automatically detecting its own capabilities. Based on the documentation, so as long as I restart the host once a new piece of software has been installed, the capability should be registered automatically.

What I am having trouble doing right now is getting the agent to detect the presence of Yarn on a self-hosted agent on a windows host. Looking at the PATH environment variable shows the existence of the Yarn executable, but it is not listed as a capability despite having the host restarted. My current workaround is to manually add Yarn to the capability list and setting its value to true.

As a side note, yarn was installed via Ansible using win_chocolatey plugin. The install was successful with no errors.

I am wondering a few things

1) Am I missing something which is causing this issue?

2) Is this an inherent issue with Yarn? If this is an inherent issue with Yarn, is there a way to automate the process of manually adding yarn as a capability?

4c74356b41
  • 69,186
  • 6
  • 100
  • 141
Alex Wang
  • 358
  • 3
  • 21

1 Answers1

1

Capabilities for a windows agent come from the environmental variables.

if you want to set a value you add a line that adds that adds an entry to the machine.

[System.Environment]::SetEnvironmentVariable("CAPABILITYNAME", "value", "Machine")

when you start the service it then picks this up.

I am currently trying to do something similar for a set of linux agents...

The interesting thing about capabilities is that they are not paths. for example it might show you have msbuild for 2019 and 2017, but I have not been able to use those as pipeline variables.

Luke Duddridge
  • 4,285
  • 35
  • 50