Recover from a failed build


(Daryl Teo) #1

Is there no way to recover from a failed task? I would like to catch any failures in a task, recover by continuing on to the next task and dealing with it there. The task I’m looking at in particular is “build” and its dependencies.

I’ve tried looking at TaskState but that happens after the fact. Finalizer tasks only cleans up the task, and does not do much else. Prefer not to have to use the --continue argument.


(Luke Daley) #2

You’ll have to explain what you’re trying to achieve in more detail.


(Daryl Teo) #3

I want to grab the compile output, and if the build failed, put that into a html report.

The idea here is that I still get meaningful output from the task, and I can still work with it without it “failing”.


(Luke Daley) #4

So how would a finalizer task on the compile task not do what you need?


(Daryl Teo) #5

The finalized task is still flagged as failed.


(Luke Daley) #6

So you don’t want the build to fail if compilation fails?


(Daryl Teo) #7

Yup! Exactly.

I’ve personally also tried it with GradleBuild, but the GradleBuild task itself fails if any of the tasks it runs fails too (even with the --continue StartParameter).


(Daryl Teo) #8

As per our irc discussion, I’d like for this to be considered as a feature request / enhancement to TaskState =). This could theroetically be implemented by TaskState allowing us to manipulate the final TaskState when the task completes (either through the TaskExecutionListener, or Finalizer). A Finalizer task could allow for recovery from a task failure (like a try catch), without needing to make modifications to the task in question.

Thanks!


(Luke Daley) #9

Hi Darryl,

I’m not keen on this idea. It raises a lot of questions about how dependent tasks would deal with the fact that they can’t rely on their dependency successfully getting what they need in to the right state. That is, it’s somewhat against the dependency based model.

Also, we’d need one ore more compelling use cases in order to consider it.