microsoft/azure-pipelines-yaml

Is it possible to use compile-time expressions/conditional insertion for demands?

hymccord opened this issue · 2 comments

Just like the title asks. Is it possible to do something like this? I'm getting a couple different queue time errors (right when I press the 'Run' button). Compiles just fine. Azure DevOps 2020 for references.

This template demand:

pool:
  name: default
  ${{ if eq(parameters.runUITests, 'True') }}:
    demands:
      - InteractiveSession -equals True

produces /.pipelines/ci.yml (Line: 35, Col: 3): A template expression is not allowed in this context at queue time.

While

pool:
  name: default
  demands:
    - ${{ if eq(parameters.runUITests, 'True') }}:
      - InteractiveSession -equals True

produces: /.pipelines/ci.yml (Line: 36, Col: 7): A mapping was not expected

I can post more of the pipeline if more context is needed.
Thanks!

Hi @inkahootz this repo is mostly for yaml templates presented in repo - I would suggest to open a ticket on developer community regarding this question. Looks like it is not allowed in this context per error message, but it could make more sense to double-check.

@anatolybolshakov Okay! Thanks for the quick feedback. I will close this out here then.