n3wt0n/AzurePipelinesDecoratorSamples

Help needed!! How to avoid injection in "-deployment"?

Closed this issue · 2 comments

image

when I am using the above yaml, Decorator injected twice, one for -deployment and another for -job.
I wants to exclude the injection for -deployment, What is the condition I have to use to achieve this?

Unfortunately there is no "direct way" to achieve that.

The way I've been doing it is checking on the Environment.Id variable. This works because a deployment job should have a connected environment.

In you decorator YAML you can use something like this:

steps:
- ${{ if (eq(variables['Environment.Id'], '') ) }}:
  - task:
    [WHATEVER ELSE YOU HAVE]

Which basically injects the decorator only when the Environment is not set

This helps. Thanks Davide.