I am trying to make my environment variables dependent on the Agent operating system.
I wrote the following test.yml, but it does not work:
jobs:
- job: Test
pool:
vmImage: 'ubuntu-latest'
steps:
- pwsh: |
echo $env:TestVar
echo $env:OS
env:
OS: $[variables['Agent.OS']]
${{ if eq(variables['Agent.OS'], 'Windows_NT') }}:
TestVar: "I am Windows"
${{ if eq(variables['Agent.OS'], 'Linux') }}:
TestVar: "I am Linux"
Is there a problem with my YAML indentation?