Package hudson.model
Class AbstractBuild.AbstractBuildExecution
- java.lang.Object
-
- hudson.model.Run.RunExecution
-
- hudson.model.Run.Runner
-
- hudson.model.AbstractBuild.AbstractBuildExecution
-
- Direct Known Subclasses:
AbstractBuild.AbstractRunner
- Enclosing class:
- AbstractBuild<P extends AbstractProject<P,R>,R extends AbstractBuild<P,R>>
public abstract class AbstractBuild.AbstractBuildExecution extends Run.Runner
-
-
Field Summary
Fields Modifier and Type Field Description protected LauncherlauncherSince configuration can be changed while a build is in progress, create a launcher once and stick to it for the entire build duration.protected BuildListenerlistenerOutput/progress of this build goes here.
-
Constructor Summary
Constructors Constructor Description AbstractBuildExecution()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcleanUp(BuildListener listener)Performs final clean up action.protected LaunchercreateLauncher(BuildListener listener)Creates aLauncherthat this build will use.protected WorkspaceList.LeasedecideWorkspace(Node n, WorkspaceList wsl)Allocates the workspace fromWorkspaceList.voiddefaultCheckout()protected abstract ResultdoRun(BuildListener listener)The portion of a build that is specific to a subclass ofAbstractBuildgoes here.protected NodegetCurrentNode()Returns the currentNodeon which we are building.LaunchergetLauncher()BuildListenergetListener()protected booleanperform(BuildStep bs, BuildListener listener)Calls a build step.protected voidperformAllBuildStep(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase)Deprecated.as of 1.356 UseperformAllBuildSteps(BuildListener, Iterable, boolean)protected voidperformAllBuildStep(BuildListener listener, Map<?,? extends BuildStep> buildSteps, boolean phase)Deprecated.as of 1.356 UseperformAllBuildSteps(BuildListener, Map, boolean)protected booleanperformAllBuildSteps(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase)Runs all the given build steps, even if one of them fail.protected booleanperformAllBuildSteps(BuildListener listener, Map<?,? extends BuildStep> buildSteps, boolean phase)voidpost(BuildListener listener)Performs the post-build action.protected abstract voidpost2(BuildListener listener)protected booleanpreBuild(BuildListener listener, Iterable<? extends BuildStep> steps)protected booleanpreBuild(BuildListener listener, Collection<? extends BuildStep> steps)protected booleanpreBuild(BuildListener listener, Map<?,? extends BuildStep> steps)Resultrun(BuildListener listener)Performs the main build and returns the status code.-
Methods inherited from class hudson.model.Run.RunExecution
getAttributes, getBuild, getProject
-
-
-
-
Field Detail
-
launcher
protected Launcher launcher
Since configuration can be changed while a build is in progress, create a launcher once and stick to it for the entire build duration.
-
listener
protected BuildListener listener
Output/progress of this build goes here.
-
-
Method Detail
-
getCurrentNode
@NonNull protected final Node getCurrentNode() throws IllegalStateException
Returns the currentNodeon which we are building.- Returns:
- Returns the current
Node - Throws:
IllegalStateException- if that cannot be determined
-
getLauncher
public Launcher getLauncher()
-
getListener
public BuildListener getListener()
-
decideWorkspace
protected WorkspaceList.Lease decideWorkspace(@NonNull Node n, WorkspaceList wsl) throws InterruptedException, IOException
Allocates the workspace fromWorkspaceList.- Parameters:
n- Passed in for the convenience. The node where the build is running.wsl- Passed in for the convenience. The returned path must be registered to this object.- Throws:
InterruptedExceptionIOException
-
run
@NonNull public Result run(@NonNull BuildListener listener) throws Exception
Description copied from class:Run.RunExecutionPerforms the main build and returns the status code.- Specified by:
runin classRun.RunExecution- Throws:
Exception- exception will be recorded and the build will be considered a failure.
-
createLauncher
@NonNull protected Launcher createLauncher(@NonNull BuildListener listener) throws IOException, InterruptedException
Creates aLauncherthat this build will use. This can be overridden by derived types to decorate the resultingLauncher.- Parameters:
listener- Always non-null. Connected to the main build output.- Throws:
IOExceptionInterruptedException
-
defaultCheckout
public void defaultCheckout() throws IOException, InterruptedException- Throws:
IOExceptionInterruptedException
-
doRun
protected abstract Result doRun(BuildListener listener) throws Exception
The portion of a build that is specific to a subclass ofAbstractBuildgoes here.- Returns:
- null to continue the build normally (that means the doRun method itself run successfully) Return a non-null value to abort the build right there with the specified result code.
- Throws:
Exception
-
post2
protected abstract void post2(BuildListener listener) throws Exception
- Throws:
Exception- See Also:
post(BuildListener)
-
post
public final void post(@NonNull BuildListener listener) throws ExceptionDescription copied from class:Run.RunExecutionPerforms the post-build action.This method is called after the main portion of the build is completed. This is a good opportunity to do notifications based on the result of the build. When this method is called, the build is not really finalized yet, and the build is still considered in progress --- for example, even if the build is successful, this build still won't be picked up by
Job.getLastSuccessfulBuild().- Specified by:
postin classRun.RunExecution- Throws:
Exception
-
cleanUp
public void cleanUp(@NonNull BuildListener listener) throws ExceptionDescription copied from class:Run.RunExecutionPerforms final clean up action.This method is called after
Run.RunExecution.post(BuildListener), after the build result is fully finalized. This is the point where the build is already considered completed.Among other things, this is often a necessary pre-condition before invoking other builds that depend on this build.
- Specified by:
cleanUpin classRun.RunExecution- Throws:
Exception
-
performAllBuildStep
@Deprecated protected final void performAllBuildStep(BuildListener listener, Map<?,? extends BuildStep> buildSteps, boolean phase) throws InterruptedException, IOException
Deprecated.as of 1.356 UseperformAllBuildSteps(BuildListener, Map, boolean)- Throws:
InterruptedExceptionIOException
-
performAllBuildSteps
protected final boolean performAllBuildSteps(BuildListener listener, Map<?,? extends BuildStep> buildSteps, boolean phase) throws InterruptedException, IOException
- Throws:
InterruptedExceptionIOException
-
performAllBuildStep
@Deprecated protected final void performAllBuildStep(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase) throws InterruptedException, IOException
Deprecated.as of 1.356 UseperformAllBuildSteps(BuildListener, Iterable, boolean)- Throws:
InterruptedExceptionIOException
-
performAllBuildSteps
protected final boolean performAllBuildSteps(BuildListener listener, Iterable<? extends BuildStep> buildSteps, boolean phase) throws InterruptedException, IOException
Runs all the given build steps, even if one of them fail.- Parameters:
phase- true for the post build processing, and false for the final "run after finished" execution.- Returns:
- false if any build step failed
- Throws:
InterruptedExceptionIOException
-
perform
protected final boolean perform(BuildStep bs, BuildListener listener) throws InterruptedException, IOException
Calls a build step.- Throws:
InterruptedExceptionIOException
-
preBuild
protected final boolean preBuild(BuildListener listener, Map<?,? extends BuildStep> steps)
-
preBuild
protected final boolean preBuild(BuildListener listener, Collection<? extends BuildStep> steps)
-
preBuild
protected final boolean preBuild(BuildListener listener, Iterable<? extends BuildStep> steps)
-
-