How to determine success or failure in Azure Pipeline stage, based on logs?
I have following output and I’d like to set status as failed based on message from logs.
How to edit .yaml file to achieve this?
My .yaml step looks like:
- task: AzureCLI@2
displayName: Deploy function ${{ parameters.package_name }}
retryCountOnTaskFailure: 10
inputs:
workingDirectory: $(Pipeline.Workspace)/${{ parameters.package_name }}
azureSubscription: ${{ variables.azure_subscription }}
scriptType: bash
scriptLocation: inlineScript
inlineScript: >
func azure functionapp publish func-tfm-${{ parameters.package_name }}-${{ variables.env_reg_long }} --python
2
Answers
Ah it’s a script step, that makes things easier.
You can capture the output from az into a variable, then check the output.
If you still want to stream the content it’s a little more work.
In many cases, instead of checking the contents, you can probably check the last exit code:
You may also be able to set the property on the script step to fail on output to Standard Error:
An example of capturing the error code from a bash command: