Class DurableTaskStep

  • All Implemented Interfaces:
    ExtensionPoint, Describable<org.jenkinsci.plugins.workflow.steps.Step>, EnvVarsFilterableBuilder
    Direct Known Subclasses:
    BatchScriptStep, PowerShellCoreScriptStep, PowershellScriptStep, ShellStep

    public abstract class DurableTaskStep
    extends org.jenkinsci.plugins.workflow.steps.Step
    implements EnvVarsFilterableBuilder
    Runs a durable task, such as a shell script, typically on an agent.

    “Durable” in this context means that Jenkins makes an attempt to keep the external process running even if either the Jenkins controller or an agent JVM is restarted. Process standard output is directed to a file near the workspace, rather than holding a file handle open. Whenever a Remoting connection between the two can be reëstablished, Jenkins again looks for any output sent since the last time it checked. When the process exits, the status code is also written to a file and ultimately results in the step passing or failing.

    Tasks can also be run on the built-in node, which differs only in that there is no possibility of a network failure.

    • Field Detail

      • WATCHING_RECURRENCE_PERIOD

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static long WATCHING_RECURRENCE_PERIOD
      • USE_WATCHING

        @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class)
        public static boolean USE_WATCHING
        If set to false, disables DurableTaskStep.Execution.watching mode.
      • REMOTE_TIMEOUT

        public static long REMOTE_TIMEOUT
        How many seconds to wait before interrupting remote calls and before forcing cleanup when the step is stopped
    • Constructor Detail

      • DurableTaskStep

        public DurableTaskStep()
    • Method Detail

      • task

        protected abstract org.jenkinsci.plugins.durabletask.DurableTask task()
      • isReturnStdout

        public boolean isReturnStdout()
      • setReturnStdout

        @DataBoundSetter
        public void setReturnStdout​(boolean returnStdout)
      • getEncoding

        public String getEncoding()
      • setEncoding

        @DataBoundSetter
        public void setEncoding​(String encoding)
      • isReturnStatus

        public boolean isReturnStatus()
      • setReturnStatus

        @DataBoundSetter
        public void setReturnStatus​(boolean returnStatus)
      • setLabel

        @DataBoundSetter
        public void setLabel​(String label)
      • getLabel

        public String getLabel()
      • start

        public org.jenkinsci.plugins.workflow.steps.StepExecution start​(org.jenkinsci.plugins.workflow.steps.StepContext context)
                                                                 throws Exception
        Specified by:
        start in class org.jenkinsci.plugins.workflow.steps.Step
        Throws:
        Exception
      • shutDownThreadPool

        @Terminator
        public static void shutDownThreadPool()