简体   繁体   中英

automate adding capabilities to Azure DevOps self-hosted agents

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM