Posted on Leave a comment

Success pipeline state on GitHub with pipeline failure

When your pipeline fails on Azure DevOps and the source code is gathered from GitHub (using a service connection) you will notice a failure icon on the repository because the status of the run from Azure DevOps is reported to GitHub. This is the normal behavior and we want it to work like that.

Lets take as example the below run.

The failure will be visible on the github along with the particular commit.

However sometimes we need to allow tasks fail without reporting a failure state on GitHub. You can do that by using continueOnError keyword. With this functionality you instruct the DevOps platform to allow failure for a particular task or job without stopping the pipeline.

trigger:
- none

pool:
  vmImage: ubuntu-latest

jobs:
- job: job1

  steps:
  - script: this script will fail
    continueOnError: true
    displayName:  task 1

  - task: PowerShell@2
    displayName: task 2
    inputs:
      targetType: 'inline'
      script: |
        Write-Host "Hello World"

This will result on a warning state for your pipeline on Azure DevOps.

This means that the pipeline has been executed successfully but some steps have failed.

Nevertheless the state on GitHub will be success as the pipeline is not in a failed state on Azure DevOps.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.