I am trying to conditionally execute a step in Azure DevOps Server 2019. I followed the instructions here.
I am passing a runTests parameter to my template. At first I tried a condition on the Job, but that doesn't work, because it will always use the default in the template, so I switched to a conditional expression. My job YAML now looks like
- job: TestJob
pool: 'mypool'
#condition: eq('${{ parameters.runTests }}', 'true')
workspace:
clean: all
steps:
- script: echo ${{ parameters.runTests }}
- script: echo ${{ eq(parameters.runTests, 'true') }}
- ${{ if eq(parameters.runTests, 'true') }}:
- task: UiPathTest@2
inputs:
testTarget: 'TestProject'
orchestratorConnection: 'Orch'
testProjectPath: '$(Build.SourcesDirectory)\$(projectPath)'
folderName: $(folderName)
I added the lines to echo the parameter, and the result of the expression. The parameter value is 'true', which is correct, but the result of eq(parameters.runTests, 'true')
is always false. My YAML is almost identical to the example though. Any ideas what might be wrong? I do not have any errors. The step just does not exist.