What is the best practice for flagging and reacting to build failures during execution? #869
Unanswered
andre-wells
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say that if a build fails, I want to send a slack message and rename the output folder to something like
output_failed.So far I've identified two ways of handling a build failure in a generic manner
Make use of
OnBuildFinishedWithin this routine, I can test the
build.IsSuccessfulproperty to see if I need to take action. Credit to Erik Heemskerk, I can define a custom attribute which will let me assess this value (which makes things a bit neater and reusable).Pros:
Cons:
awaitcalls properly. I could useasync voidbut tasks can terminate early as the build finishes. I'd need to call these methods synchronously.Make use of a Target that always runs
I'm familiar with conditions like
ProceedAfterFailureandAssuredAfterFailureso I can author Targets to run despite a build or a test Target failing.Pros:
awaittasks.Cons:
Is there a common way to define a target such as with a conditional such as "ReportFailure" which only fires in the event of a failed target?
Beta Was this translation helpful? Give feedback.
All reactions