Azure-devops-docs: Expressions without variables?

Created on 9 Aug 2019  Â·  9Comments  Â·  Source: MicrosoftDocs/azure-devops-docs

Can expressions like $[ dependencies.A.outputs['job1.setvarStep.myOutputVar'] ] be used directly or do they always need to be assigned to a variable first? When I tried using it directly, I would just get the expression back, not the value. Is this expected?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri1 devops-cictech devopprod doc-bug

Most helpful comment

I disagree. I asked a question that should be covered in the documentation and is a common issue that YAML pipeline developers will run into.

All 9 comments

Thanks for your question. It looks like you're working through an issue with your scenario or implementation, rather than an issue with the documentation. Here are a couple of options where you might consider asking your question:

I disagree. I asked a question that should be covered in the documentation and is a common issue that YAML pipeline developers will run into.

@MisinformedDNA -- Dan, thank you for your feedback. I have re-opened this issue 5197 and we will look into it.

I also hit this page seeking an answer to the exact same question, so this clearly is something the docs could usefully answer.

The example we are looking for is setting a variable at queue time that is used in the conditional expression. But there isn't an example on what the exact syntax is. I have spent an hour already tonight playing with ${{, $(, and $[ to try and discover what the syntax is.

Same problem here as @MisinformedDNA and @TroySchmidt

I did figure out that you can't pass Boolean values they have to be strings
with single quotes around them. I have the variable defined in the YAML
and added as a variable settable at queue time the classic way.

On Thu, Aug 29, 2019, 3:48 AM Christian notifications@github.com wrote:

Same problem here as @MisinformedDNA https://github.com/MisinformedDNA
and @TroySchmidt https://github.com/TroySchmidt

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/MicrosoftDocs/vsts-docs/issues/5197?email_source=notifications&email_token=AALXG3NMSGG6GZX3GTWUKP3QG55L7A5CNFSM4IKU4G7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5NSZEY#issuecomment-526068883,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AALXG3OZAKIBX4F5V5MRFJTQG55L7ANCNFSM4IKU4G7A
.

Same problem here. Trying to to use $[dependencies.Build_publish.outputs['scriptPackageSuffixes.octopusPackageVersion']] as a variable in the inputs section of a task only prints the raw text, not the computed value.

This is a tricky one because using expressions directly may work depending on the field. However, since not every field evaluates runtime expressions, it is safest to assign the expression to a variable. Updating the docs now.

Was this page helpful?
0 / 5 - 0 ratings