I am trying to utilize one YAML file for multiple environments with different configuration settings.
Below is the yaml example:
parameters:
- name: environment
displayName: Build Environment
type: string
default: Staging
values:
- Staging
- Release
- Production
variables:
- name: certificatename
${{ if eq(parameters.environment, 'Staging') }}:
value: 'cert1.p12'
${{ if eq(parameters.environment, 'Release') }}:
value: 'cert2.p12'
Is there a way to club release and prod in one go?
like ${{ if eq(parameters.environment, 'Release'), eq(parameters.environment, 'Production') }}:
however, I keep getting errors. If anyone knows of any way to the club this statement, would appreciate the input.
You can use the in operator instead of eq to check for multiple values
${{ if in(parameters.environment, 'Release', 'Production') }}:
documentation : https://learn.microsoft.com/en-us/azure/devops/pipelines/process/expressions?view=azure-devops#in

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With