Class ReplayAction

java.lang.Object
org.jenkinsci.plugins.workflow.cps.replay.ReplayAction
All Implemented Interfaces:
Action, ModelObject

public class ReplayAction extends Object implements Action
Attached to a Run when it could be replayed with script edits.
  • Field Details

  • Method Details

    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action
    • isRebuildEnabled

      public boolean isRebuildEnabled()
    • isEnabled

      public boolean isEnabled()
    • isReplayableSandboxTest

      public boolean isReplayableSandboxTest()
      Runs the extra tests for replayability beyond isEnabled() that require a blocking load of the execution.
    • getOriginalScript

      public String getOriginalScript()
      See Also:
    • getOriginalLoadedScripts

      public Map<String,String> getOriginalLoadedScripts()
      See Also:
    • getOwner

      public Run getOwner()
    • doRun

      @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doRun(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws javax.servlet.ServletException, IOException
      Throws:
      javax.servlet.ServletException
      IOException
    • doRebuild

      @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doRebuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp) throws javax.servlet.ServletException, IOException
      Throws:
      javax.servlet.ServletException
      IOException
    • run

      @CheckForNull public QueueTaskFuture run(@NonNull String replacementMainScript, @NonNull Map<String,String> replacementLoadedScripts)
      For whitebox testing.
      Parameters:
      replacementMainScript - main script; replacement for getOriginalScript()
      replacementLoadedScripts - auxiliary scripts, keyed by class name; replacement for getOriginalLoadedScripts()
      Returns:
      a way to wait for the replayed build to complete
    • run2

      @CheckForNull public Queue.Item run2(@NonNull String replacementMainScript, @NonNull Map<String,String> replacementLoadedScripts)
      For use in projects that want initiate a replay via the Java API.
      Parameters:
      replacementMainScript - main script; replacement for getOriginalScript()
      replacementLoadedScripts - auxiliary scripts, keyed by class name; replacement for getOriginalLoadedScripts()
      Returns:
      build queue item
    • replacementsIn

      @NonNull public static Set<String> replacementsIn(@NonNull CpsFlowExecution execution) throws IOException
      Finds a set of Groovy class names which are eligible for replacement.
      Parameters:
      execution - the associated execution
      Returns:
      Groovy class names expected to be produced, like Script1
      Throws:
      IOException
    • replace

      @CheckForNull public static String replace(@NonNull CpsFlowExecution execution, @NonNull String clazz) throws IOException
      Replaces some loaded script text with something else. May be done only once per class.
      Parameters:
      execution - the associated execution
      clazz - an entry possibly in replacementsIn(org.jenkinsci.plugins.workflow.cps.CpsFlowExecution)
      Returns:
      the replacement text, or null if no replacement was available for some reason
      Throws:
      IOException
    • getDiff

      public String getDiff()
    • doCheckScript

      public FormValidation doCheckScript()
    • doCheckScriptCompile

      public net.sf.json.JSON doCheckScriptCompile(@AncestorInPath Item job, @QueryParameter String value)
    • ensurePermissionRegistered

      @Initializer(after=PLUGINS_STARTED, before=EXTENSIONS_AUGMENTED) public static void ensurePermissionRegistered()