Ignoring a failing step?

Is there a way to define a step that is allowed to fail? It would come in handy to run certain sanity checks, like linting or static code analysis.
It’s important to create visibility on these steps, but they are not necessarily blocking.

I know there is the continue_on_failure on wait steps, but it will not work for this use case for example:

- command: "lint.sh"
- wait: ~
  continue_on_failure: true
- command: "echo Building code"
- wait
- command: "echo Deploying code"

If the linting failed the deployment will never happen, even if the failure wasn’t exactly blocking.

Hey there @JoniV — thanks very much for posting and welcome to the forum :slight_smile:

Good news on that front, we totally agree and I’ve actually nearly finished adding support for this. There will be a changelog up about it pretty soon, but essentially you will be able to allow steps to “soft-fail”. Soft failed steps are still failures, they just don’t cause the whole pipeline to fail too, and are opted into via listing allowed exit statuses.

Cheers,
Justin

1 Like

Fantastic. I’ll keep an eye on that.

I know this isn’t exactly what you want, but another way to get around this for now would be to add || true

- command: "lint.sh || true" # ignore failures
- wait
- command: "echo Building code"
- wait
- command: "echo Deploying code"

Of course that will then make it appear as if the step isn’t failing, but maybe it would be acceptable. If you wanted to surface lint errors more, you could also use buildkite-agent annotate to make note of the hidden failure.

1 Like

Thank you, that’s another work-around.

I had the script return exit 0, because I still wanted to make sure some of the steps returned failures but it’s getting a bit noisy.

Just a quick update here so you don’t think I’ve forgotten :upside_down_face: — this is still coming, just got delayed a little last week. If the stars align I’ll hopefully get this out the door this week.

3 Likes

Fantastic to hear you’re working on a soft fail like feature. We’re very keen for this functionality - the workarounds listed aren’t ideal. Our scenario is something like this:

- command: "bash frontend-ui-tests.sh" # will sometimes fail
- wait
- block: "deploy to staging" # allow us to unblock manually even if last failed step
1 Like

Hey everyone :wave:t3: apologies for the radio silence on this one, it unfortunately slipped through somehow and I forgot to get back here to let everyone know that we actually shipped this feature a little while ago! :tada::balloon:

1 Like