I created a variable called Test in Pipeline UI and left the value as blank. So it appeared as shown below.
I'm trying to access this variable in YAML pipeline but unable to check it's empty value.
I'm trying like this :
- variables
- name: 'Release'
${{ if or(eq(variables['Test'],''), eq(variables['Test'], 'undefined')) }}:
value: 'Stage'
${{ if and(ne(variables['Test'],''), ne(variables['Test'], 'undefined')) }}:
value: 'Test'
The variable Release value is always Stage whether Test variable is empty or any value in it.
I think there must be an easy way to check whether a variable value is empty or not?

The correct check would be to use
not(...)to check if the value is defined. However, it seems you can't use these variables for compile time expressions, maybe because the template is already compiled at this point. Only built-in variables seem to work for expressions.At least, this always returns empty for me:
You could use Parameters instead. Though It would probably be best to use a non-empty string here as a default and restrict the possible values.