Mainly to Jesse,

I'm working on this card
<https://trello.com/c/xj0fsz7O/92-ability-to-write-to-log-at-end-of-block-step>,
where we want to be able to write to console log and do stuff at the end of
the body invocation.

The challenge here is that the Step API has no dependency to the workflow
Flow Node API (it goes the other way around), so we need to do this in a
way that doesn't force Flow API into the likes of RetryStep. That pretty
much means we need to do the context injection of TaskListener like
StepContext does.

I thought about two ways to do this.

One is to reuse the existing StepContext instance. We could just say that
at the point of the callback from the body execution, StepContet.get()
would return the context objects for the end of the body (TaskListener
connecte to the right FlowNode, etc.) We could then provide some
convenience base class that performs @StepContextParameter injection, so
that everything gets reinjected.

This works, but I also feel that it's bit brittle, especially for
ParallelStep that invokes multiple bodies at the same time, and thus it
wants multiple different post body execution context. So I started thinking
about another way, where the end of the body execution is notified to
FutureCallback<BodyExecutionResult> instead of FutureCallback<Object>, and
the newly added BodyExecutionResult class would have properties like
outcome, the same get(Class) method that returns contextual object, and so
on.

That also makes it more explicit that the context injection works
differently post body execution.


What do you think?

-- 
Kohsuke Kawaguchi

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to