I'd like to set default value of a parameter from a variable. Unfortunately, below pipeline throws this error The 'Environment' parameter value '$[variables.deployToEnv]' is not a valid value.
I tried it with other expressions too but it doesn't work. How can I solve this problem?
variables:
- name: deployToEnv
${{ if in(variables['Build.SourceBranchName'], 'Development') }}:
value: dev
${{ if in(variables['Build.SourceBranchName'], 'Staging', 'Testing') }}:
value: test
${{ if in(variables['Build.SourceBranchName'], 'Production') }}:
value: prod
parameters:
- name: Environment
type: string
displayName: Environment
default: $(deployToEnv)
# default: $[variables.deployToEnv]
# default: ${{ variables.deployToEnv }}
values:
- dev
- test
- prod