@codechurn and bryanbcook are correct, but use iif
condition would be easier and shorter to use:
True
, and the third parameter otherwiseReference https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops
For given question the solution could quite simple:
azure-pipelines.yml
variables:
namespaceName: $[
iif(notIn(variables['var-a'], '', variables['noSuch']),
$(var-a),
$(var-b)
)
]
Note: Using variables['noSuch']
as a value Null, because Null is a special literal expression that's returned from a dictionary miss, for example. Null can be the output of an expression but can't be called directly within an expression.