Running a Job/Step even if the build fails

Hi Everybody,
We need to do some cleanup even for failed builds. This is critical to release expensive cloud resources. Cannot find this in documentation. Is there a new/hacky way for this?

Forcing a failed step to succeed is not an option. Defeats the purpose of such a service. Should we move to another CI provider?

No, it really is :slight_smile:

You can do it in steps:

  • Run your thing that might fail in step 1, and force a Unix success, but record how it went in a file
  • In the next step, do your clean-up
  • In your last step, force a failure if the file says the first step failed
1 Like

I have 15 steps in the pipeline. I’m not going to pollute all those 15 steps. Also, such procedure would also hide the real failed step in the UI, right?

I guess there is no other option than moving to another CI vendor.


You can be cynical and defeatist, but remember, that’s a choice. If you keep on doing that, you will run out of vendors to loudly boycott - there are not very many good ones. (I’m just a fellow customer, and this forum’s annoying pro bono philosopher :grin:).

I think it would be a small tweak to two or three steps - it is hardly pollution.

It would, yes. I have seen a lot of CI pipelines, and I don’t think I have ever seen one where it mattered which step failed.

If you can give more detail - maybe with a friendly smile :joy_cat: - perhaps myself or other readers can give you more ideas.

Well, running out of vendors is a real problem :slight_smile:

If not clearly seeing which step fails is not important, then you should also question the need of seeing step logs in the first place.

I’m running pretty complex pipeline, with unit tests, build, packaging, image upload, pretty complicated orchestration. Also involves acquiring custom AWS resources. But in reality this shouldn’t matter, cause in the end of the day I’m running just bunch of bash scripts (already reached to 20).

I’m using the pipeline both for production but also for active development. It is critical to clearly see which step fails and see the log output as quickly as possible. All i needed i just to run a step which executes in the end regardless of the pipeline status. Any more details I can provide that would help?

Is this smile good? :slight_smile:

Urgh, no - that’s horrible. Real smiles please :slight_smile:

Unfortunately, neither of the smiles help with CI/CD

Do you need to do this “cleanup” for all of your steps? I agree, in that case, that it will bloat each step. Nevertheless, my attitude to CI is: get it working, get it fast, get it elegant. You’re on step 0 at the moment, so bloat it up if you have to.

(Would you remove that image from your post? Let’s practice kindness here if we can.)

Its a single cleanup for all steps. We are past 0. There are already two pipelines running (1 for dev, 1 for production).

What’s wrong with the picture? Its funny. Do you think it offends anyone?

1 Like