public interface SimpleBuildStep extends BuildStep
Builder
or Publisher
) which may be called at an arbitrary time during a build (or multiple times), run, and be done.
Such a build step would typically be written according to some guidelines that ensure it makes few assumptions about how it is being used:
BuildStep.prebuild(hudson.model.AbstractBuild<?, ?>, hudson.model.BuildListener)
, since this presupposes a particular execution order.
BuildStep.getProjectActions(hudson.model.AbstractProject<?, ?>)
, since this might never be called
if the step is not part of the static configuration of a project; instead, add a SimpleBuildStep.LastBuildAction
to a build when run.
BuildStep.getRequiredMonitorService()
to be BuildStepMonitor.NONE
, since this facility
only makes sense for a step called exactly once per build.
DependencyDeclarer
since this would be limited to use in AbstractProject
.
BuildStepDescriptor.isApplicable(java.lang.Class<? extends hudson.model.AbstractProject>)
(there is currently no filtering for other Job
types).
Executor.currentExecutor()
to be non-null, and by extension do not use Computer.currentComputer()
.
BuildStepCompatibilityLayer.perform(AbstractBuild, Launcher, BuildListener)
Modifier and Type | Interface and Description |
---|---|
static interface |
SimpleBuildStep.LastBuildAction
Marker for explicitly added build actions (as
Run.addAction(hudson.model.Action) ) which should imply a transient project
action (Actionable.getActions() ) when present on the Job.getLastSuccessfulBuild() . |
static class |
SimpleBuildStep.LastBuildActionFactory |
BuildStep.PublisherList
BUILDERS, PUBLISHERS
Modifier and Type | Method and Description |
---|---|
default void |
perform(Run<?,?> run,
EnvVars env,
TaskListener listener)
Run this step, without a workspace context.
|
default void |
perform(Run<?,?> run,
FilePath workspace,
EnvVars env,
Launcher launcher,
TaskListener listener)
Run this step.
|
default void |
perform(Run<?,?> run,
FilePath workspace,
Launcher launcher,
TaskListener listener)
Deprecated.
|
default boolean |
requiresWorkspace()
Determines whether or not this step requires a workspace context (working directory and launcher).
|
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
@Deprecated default void perform(@NonNull Run<?,?> run, @NonNull FilePath workspace, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException
perform(Run, FilePath, EnvVars, Launcher, TaskListener)
instead.run
- a build this is running as a part ofworkspace
- a workspace to use for any file operationslauncher
- a way to start processeslistener
- a place to send outputInterruptedException
- if the step is interruptedIOException
- if something goes wrong; use AbortException
for a polite errordefault void perform(@NonNull Run<?,?> run, @NonNull FilePath workspace, @NonNull EnvVars env, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException
This method must be overridden when this step requires a workspace context. If such a context is
not required, it does not need to be overridden; it will then forward to
perform(Run, EnvVars, TaskListener)
.
run
- a build this is running as a part ofworkspace
- a workspace to use for any file operationsenv
- environment variables applicable to this steplauncher
- a way to start processeslistener
- a place to send outputAbstractMethodError
- if this step requires a workspace context and neither this method nor perform(Run, FilePath, Launcher, TaskListener)
is overriddenInterruptedException
- if the step is interruptedIOException
- if something goes wrong; use AbortException
for a polite errordefault void perform(@NonNull Run<?,?> run, @NonNull EnvVars env, @NonNull TaskListener listener) throws InterruptedException, IOException
This method must be overridden when this step does not require a workspace context, and will not be called when such a context is required.
run
- a build this is running as a part ofenv
- environment variables applicable to this steplistener
- a place to send outputAbstractMethodError
- if this method is not overriddenIllegalStateException
- if this step requires a workspace contextInterruptedException
- if the step is interruptedIOException
- if something goes wrong; use AbortException
for a polite errordefault boolean requiresWorkspace()
When such a context is required (the default), perform(Run, FilePath, EnvVars, Launcher, TaskListener)
applies. Otherwise, perform(Run, EnvVars, TaskListener)
applies.
true
if this step requires a workspace context; false
otherwise.Copyright © 2004–2021. All rights reserved.