Improve handling of preview deployment failures on main #9837
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR improves how we handle preview deployment failures on main.
Rather than relying on catching errors everywhere and using
exit 0
in the implementation of preview environment deployments, this moves thetry/catch
all the way to the top. This ensure that preview deployment errors neverbreaks the main build.
Additionally the this improves a few other things as well
exit 0
means that all of our shutdown logic like flushing traces doesn't get executed which might result in missing spans. So getting rid of those is nice.werft.fail
will no longer end all spans. We have afinally
handler that does that anyway, and ending all the spans in thefail
code means we close the root span before the job is actually done (e.g. our top catch/finally logic hasn't been executed)Related Issue(s)
Fixes #9659
Fixes https://github.com/gitpod-io/ops/issues/947
How to test
I have not tried to inject errors, so we won't know for sure this does the right thing until this is merged and we see a preview environment deployment failure on main.
Release Notes
Documentation
N/A