Interface PrePostTaskActions
-
- All Superinterfaces:
BambooPluginModule
@ExperimentalApi public interface PrePostTaskActions extends BambooPluginModule
Custom actions that run before and after a build task (TaskType
), a deployment task (com.atlassian.bamboo.deployments.execution.DeploymentTaskType, or a common task (CommonTaskType
) in a build or a deployment plan. This actions object will be handled by a task executor as stateful, which means that the same instance will be used to callexecuteBefore
andexecuteAfter
methods. Thanks to this, you can store some data inexecuteBefore
and use it inexecuteAfter
.- Since:
- 5.7
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TaskResult
executeAfter(@NotNull InternalTaskType task, @Nullable TaskResult taskResult)
Executes a custom action after the task is executed.void
executeBefore(@NotNull InternalTaskType task, @NotNull CommonTaskContext context)
Executes a custom action before the task is executed.
-
-
-
Method Detail
-
executeBefore
void executeBefore(@NotNull @NotNull InternalTaskType task, @NotNull @NotNull CommonTaskContext context) throws Exception
Executes a custom action before the task is executed.- Parameters:
task
- a current task, it can be actually a subclass of TaskType (build plans), DeploymentTaskType (deployment plans) or CommonTaskType (build or deployment plans)context
- a current task context, can be actually a TaskContext (build plans) or DeploymentTaskContext (deployment plans), TODO can it be a CommonTaskContext? flow in TaskExecutorImpl suggests that it may happen - but under which conditions actually?- Throws:
Exception
- in case when a pre-task action fails
-
executeAfter
TaskResult executeAfter(@NotNull @NotNull InternalTaskType task, @Nullable @Nullable TaskResult taskResult) throws Exception
Executes a custom action after the task is executed.- Parameters:
task
- a current task which was executedtaskResult
- a result of a task execution; may benull
in case task terminated abnormally- Returns:
- TaskResult a result of a task execution (you may return the original result or modify it)
- Throws:
Exception
- in case when a post-task action fails
-
-