# How does BuildKite determine success or failure of a pipeline?

**URL:** https://forum.buildkite.community/t/how-does-buildkite-determine-success-or-failure-of-a-pipeline/2226
**Category:** Pipelines
**Created:** [September 9, 2022, 2:06am UTC](https://forum.buildkite.community/t/how-does-buildkite-determine-success-or-failure-of-a-pipeline/2226 "2022-09-09T02:06:22Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![js-cb](https://avatars.discourse-cdn.com/v4/letter/j/8797f3/32.png) [@js-cb](https://forum.buildkite.community/u/js-cb)
#### Post date: [September 9, 2022, 2:06am UTC](https://forum.buildkite.community/t/how-does-buildkite-determine-success-or-failure-of-a-pipeline/2226/1 "2022-09-09T02:06:22Z")

</div>

I’m trying this pipeline to understand how a pipeline run is declared as `successful` vs `failed`. and to me it looks like for a pipeline to succeed `all` steps must not fail. That’s a very rigid rule and I hope that I’m wrong.

In the following pipeline, there are two branches:  
`3 -> 2 -> 1`  
and  
`7 -> 6 -> 5`

Steps 1 and 5 fail however their subsequent steps (2 and 6) don’t care about that. Assume that steps 2 and 6 `retry` 1 and 5 and this time they succeed. How can I mark this pipeline as succeeded? while buildkite immediately declares it as failing (and runs everything though)?

```auto
steps:
  - command: exit 1
    key: step1
    label: step1

  - command: exit 0
    key: step2
    label: step2
    depends_on: step1
    allow_dependency_failure: true

  - command: exit 0
    key: step3
    label: step3
    depends_on: step2

  - command: exit 1
    key: step5
    label: step5

  - command: exit 0
    key: step6
    label: step6
    depends_on: step5
    allow_dependency_failure: true

  - command: exit 0
    key: step7
    label: step7
    depends_on: step6

```

---

<div class="post-metadata">

### Author: ![paula](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.buildkite.community/paula/32/954_2.png) [@paula](https://forum.buildkite.community/u/paula)
#### Post date: [September 9, 2022, 5:52am UTC](https://forum.buildkite.community/t/how-does-buildkite-determine-success-or-failure-of-a-pipeline/2226/2 "2022-09-09T05:52:59Z")

</div>

hey @js-cb good question 👍

We determine failure just like you say - if anything fails, the build is marked as failed. So even if individual steps depend on others that failed but allow it to continue, the fact that anything failed means the build will as well.

But that doesn’t apply to step retries - if steps that have failed are retried and succeed, the status of the build will be updated to success as well. If you updated the `exit 1` commands to something with randomness that would _hopefully_ succeed on retry, you should see that behaviour
