I'm looking for an elegant or inelegant solution for failing a step in ADO pipelines when git commands return unexpected and unwanted results. In general, I call git with a bash task, like so:
steps:
- bash: |
git merge ${{ parameters.sourceBranch }}
If the merge fails, I would like this step to fail in my ADO pipeline. How would I go about doing that?
git mergeexits nonzero on conflicts or other failures; how you get azure to respect the exit status from commands, as reported by bash, I don't know. Note that bash has its own exit status and the default is to exit with the status from the last-executed command, so given what you've shown here, ifgit mergeexits with status 1,bashwould also exit with status 1. In general 0 = success and any nonzero value = failure, but we're back to "what the heck does Azure do" (which I have no idea).