Class BodyInvoker
java.lang.Object
org.jenkinsci.plugins.workflow.steps.BodyInvoker
Builder pattern for controlling how to execute a body block of a
Step
.- Author:
- Kohsuke Kawaguchi
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConsoleLogFilter
mergeConsoleLogFilters
(ConsoleLogFilter original, ConsoleLogFilter subsequent) Merge two console log filters so that both are applied.static LauncherDecorator
mergeLauncherDecorators
(LauncherDecorator original, LauncherDecorator subsequent) Merge two launcher decorators so that both are applied.abstract BodyExecution
start()
Schedules an asynchronous invocation of the body that's given as an argument to the step invocation (in a host language dependent manner), with settings configured on this object via other methods.final BodyInvoker
withCallback
(com.google.common.util.concurrent.FutureCallback<Object> callback) Deprecated.abstract BodyInvoker
withCallback
(BodyExecutionCallback callback) Registers a callback that tracks the progress of the body execution.abstract BodyInvoker
withContext
(Object override) Overrides to the context values that are in effect while evaluating the body.withContexts
(Object... overrides) Equivalent to callingwithContext(java.lang.Object)
on each object.withContexts
(Collection<?> overrides) Equivalent to callingwithContext(java.lang.Object)
on each object.abstract BodyInvoker
withDisplayName
(String name) Sets a human readable name that describes this body invocation.
-
Constructor Details
-
BodyInvoker
public BodyInvoker()
-
-
Method Details
-
withContext
Overrides to the context values that are in effect while evaluating the body.Note that only one instance of a given class can be in the context at a time. Thus for certain types, an invoker will generally need to look up any instance in its own enclosing context amd create a proxy/merge:
EnvVars
- use
EnvironmentExpander
instead EnvironmentExpander
- use
EnvironmentExpander.merge(org.jenkinsci.plugins.workflow.steps.EnvironmentExpander, org.jenkinsci.plugins.workflow.steps.EnvironmentExpander)
ConsoleLogFilter
- use
mergeConsoleLogFilters(hudson.console.ConsoleLogFilter, hudson.console.ConsoleLogFilter)
LauncherDecorator
- use
mergeLauncherDecorators(hudson.LauncherDecorator, hudson.LauncherDecorator)
- Returns:
- this object
- See Also:
-
withContexts
Equivalent to callingwithContext(java.lang.Object)
on each object. -
withContexts
Equivalent to callingwithContext(java.lang.Object)
on each object. -
withDisplayName
Sets a human readable name that describes this body invocation. By default, this body invocation is anonymous.- Returns:
- this object
-
withCallback
Registers a callback that tracks the progress of the body execution.- Returns:
- this object
-
withCallback
public final BodyInvoker withCallback(com.google.common.util.concurrent.FutureCallback<Object> callback) Deprecated.UsewithCallback(BodyExecutionCallback)
and callBodyExecutionCallback.wrap(com.google.common.util.concurrent.FutureCallback<java.lang.Object>)
if this is what you really wanted. -
start
Schedules an asynchronous invocation of the body that's given as an argument to the step invocation (in a host language dependent manner), with settings configured on this object via other methods. -
mergeConsoleLogFilters
public static ConsoleLogFilter mergeConsoleLogFilters(@CheckForNull ConsoleLogFilter original, @NonNull ConsoleLogFilter subsequent) Merge two console log filters so that both are applied.- Parameters:
original
- the original filter inStepContext.get(java.lang.Class<T>)
, if anysubsequent
- your implementation; should expectnull
for thebuild
parameter, and beSerializable
- Returns:
- a merge of the two, or just yours if there was no original
- See Also:
-
mergeLauncherDecorators
public static LauncherDecorator mergeLauncherDecorators(@CheckForNull LauncherDecorator original, @NonNull LauncherDecorator subsequent) Merge two launcher decorators so that both are applied.- Parameters:
original
- the original decorator inStepContext.get(java.lang.Class<T>)
, if anysubsequent
- your implementation; should beSerializable
- Returns:
- a merge of the two, or just yours if there was no original
- See Also:
-
withCallback(BodyExecutionCallback)
and callBodyExecutionCallback.wrap(com.google.common.util.concurrent.FutureCallback<java.lang.Object>)
if this is what you really wanted.