Package jenkins.tasks

Class SimpleBuildWrapper.Disposer

java.lang.Object
jenkins.tasks.SimpleBuildWrapper.Disposer
All Implemented Interfaces:
Serializable
Enclosing class:
SimpleBuildWrapper

public abstract static class SimpleBuildWrapper.Disposer extends Object implements Serializable
An optional callback to run at the end of the wrapped block. Must be safely serializable, so it receives runtime context comparable to that of the original setup.
See Also:
  • Constructor Details

    • Disposer

      public Disposer()
  • Method Details

    • requiresWorkspace

      @Restricted(org.kohsuke.accmod.restrictions.Beta.class) public final boolean requiresWorkspace()
      Determines whether or not this end-of-wrapped-block callback requires a workspace context (working directory and launcher).

      When such a context is required (the default), then tearDown(Run, FilePath, Launcher, TaskListener) applies. Otherwise, tearDown(Run, TaskListener) applies.

      Returns:
      true when this end-of-wrapped-block callback requires a workspace context; false otherwise.
      Since:
      2.258
    • tearDown

      public void tearDown(Run<?,?> build, FilePath workspace, Launcher launcher, TaskListener listener) throws IOException, InterruptedException
      Attempt to clean up anything that was done in the initial setup.

      This method must be overridden when this end-of-wrapped-block callback requires a workspace context. If such a context is not required, it does not need to be overridden; it will then forward to tearDown(Run, TaskListener).

      Parameters:
      build - a build being run
      workspace - a workspace of the build
      launcher - a way to start commands
      listener - a way to report progress
      Throws:
      AbstractMethodError - if this end-of-wrapped-block callback requires a workspace and this method is not overridden.
      IOException - if something fails; AbortException for user errors
      InterruptedException - if tear down is interrupted
    • tearDown

      public void tearDown(Run<?,?> build, TaskListener listener) throws IOException, InterruptedException
      Attempt to clean up anything that was done in the initial setup.

      This method must be overridden when this end-of-wrapped-block callback does not require a workspace context, and will not be called when such a context is required.

      Parameters:
      build - a build being run
      listener - a way to report progress
      Throws:
      AbstractMethodError - if this this method is not overridden
      IllegalStateException - if this end-of-wrapped-block callback requires a workspace
      IOException - if something fails; AbortException for user errors
      InterruptedException - if tear down is interrupted
      Since:
      2.258