How does BuildKite determine success or failure of a pipeline?

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)?

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

hey @js-cb good question :+1:

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

1 Like