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
-
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
OnBuildFinished
Within this routine, I can test the
build.IsSuccessful
property 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:
await
calls properly. I could useasync void
but 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
ProceedAfterFailure
andAssuredAfterFailure
so I can author Targets to run despite a build or a test Target failing.Pros:
await
tasks.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