Package jenkins.tasks
Interface SimpleBuildStep
-
- All Superinterfaces:
BuildStep
- All Known Implementing Classes:
ArtifactArchiver
,Fingerprinter
public interface SimpleBuildStep extends BuildStep
A build step (like aBuilder
orPublisher
) 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:
- Do not implement
BuildStep.prebuild(hudson.model.AbstractBuild<?, ?>, hudson.model.BuildListener)
, since this presupposes a particular execution order. - Do not implement
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 aSimpleBuildStep.LastBuildAction
to a build when run. - Implement
BuildStep.getRequiredMonitorService()
to beBuildStepMonitor.NONE
, since this facility only makes sense for a step called exactly once per build. - Do not implement
DependencyDeclarer
since this would be limited to use inAbstractProject
. - Return true unconditionally from
BuildStepDescriptor.isApplicable(java.lang.Class<? extends hudson.model.AbstractProject>)
(there is currently no filtering for otherJob
types). - Do not expect
Executor.currentExecutor()
to be non-null, and by extension do not useComputer.currentComputer()
.
- Since:
- 1.577
- See Also:
BuildStepCompatibilityLayer.perform(AbstractBuild, Launcher, BuildListener)
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SimpleBuildStep.LastBuildAction
Marker for explicitly added build actions (asRun.addAction(hudson.model.Action)
) which should imply a transient project action (Actionable.getActions()
) when present on theJob.getLastSuccessfulBuild()
.static class
SimpleBuildStep.LastBuildActionFactory
-
Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
-
-
Field Summary
-
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
-
Method Summary
All Methods Instance Methods Default Methods Deprecated Methods Modifier and Type Method 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).-
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
-
-
-
-
Method Detail
-
perform
@Deprecated default void perform(@NonNull Run<?,?> run, @NonNull FilePath workspace, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException
Deprecated.Run this step.- Parameters:
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 output- Throws:
InterruptedException
- if the step is interruptedIOException
- if something goes wrong; useAbortException
for a polite error
-
perform
default void perform(@NonNull Run<?,?> run, @NonNull FilePath workspace, @NonNull EnvVars env, @NonNull Launcher launcher, @NonNull TaskListener listener) throws InterruptedException, IOException
Run this step.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)
.- Parameters:
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 output- Throws:
AbstractMethodError
- if this step requires a workspace context and neither this method norperform(Run, FilePath, Launcher, TaskListener)
is overriddenInterruptedException
- if the step is interruptedIOException
- if something goes wrong; useAbortException
for a polite error- Since:
- 2.241
-
perform
default void perform(@NonNull Run<?,?> run, @NonNull EnvVars env, @NonNull TaskListener listener) throws InterruptedException, IOException
Run this step, without a workspace context.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.
- Parameters:
run
- a build this is running as a part ofenv
- environment variables applicable to this steplistener
- a place to send output- Throws:
AbstractMethodError
- if this method is not overriddenIllegalStateException
- if this step requires a workspace contextInterruptedException
- if the step is interruptedIOException
- if something goes wrong; useAbortException
for a polite error- Since:
- 2.258
-
requiresWorkspace
default boolean requiresWorkspace()
Determines whether or not this step requires a workspace context (working directory and launcher).When such a context is required (the default),
perform(Run, FilePath, EnvVars, Launcher, TaskListener)
applies. Otherwise,perform(Run, EnvVars, TaskListener)
applies.- Returns:
true
if this step requires a workspace context;false
otherwise.- Since:
- 2.258
-
-