What are the full list of demands supported?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@yosephlodamo -- Yoseph, the demands keyword is also documented here. The syntax allows for any custom demand, so a complete list is not possible. You may find additional information here:
@steved0x -- Steve, please look into further clarifying this topic and the one linked above.
@WilliamAntonRohm appreciate the pointer to the demands schema! However, that link only tells me that demands accepts an array of strings. In particular, it does not tell me the supported syntax for those strings.
Based on the examples on this page, I know that there is some kind of -equals operator available. Are there any other operators available? What kinds of expressions can I use as operands to this operator?
(It would be nice if demands supported the same expression language as the rest of Azure Pipelines)
@reynoldsbd I had the exact same question, but posted it on their github. They shirked me off and closed the question , saying it was an implementation detail.
@reynoldsbd @CodeSwimBikeRunner @yosephlodamo , based on the statement 'You can check for the existence of a capability or a specific string' in the yaml-schema demands specification , I did not attempt to use an expression that would evaluate to a boolean. Instead, I populated a parameter on my template and got the agent's capability key value to equal my parameter value. Syntax follows:
demands:
- ClarityBranchAffinity -equals ${{ parameters.BranchMoniker }}
In my use case, ClarityBranchAffinity is a user specified demand on our agents, and parameters.BranchMoniker is set by the yaml file that consumes the template, which in my scenario is a variable (whose value is determined using conditional insertion template syntax).
Linking @CodeSwimBikeRunner 's similar question #5279
My workaround has an unfortunate limitation. Because the template expressions are evaluated early on in the pipeline, you are limited in what variables you can use. Quoting the documentation:
you have access to the variables context that contains all the variables specified in the YAML file plus the system variables. Importantly, it doesn't have runtime variables such as those stored on the pipeline or given when you start a run.
Demands are documented here. Existence and equality are the only supported operators. If you want to make a feature request, Developer Community is the best place for that.