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 aRun
when it could be replayed with script edits.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ReplayAction.Factory
-
Field Summary
Fields Modifier and Type Field Description static Permission
REPLAY
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description FormValidation
doCheckScript()
net.sf.json.JSON
doCheckScriptCompile(Item job, String value)
void
doRebuild(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
void
doRun(org.kohsuke.stapler.StaplerRequest req, org.kohsuke.stapler.StaplerResponse rsp)
static void
ensurePermissionRegistered()
String
getDiff()
String
getDisplayName()
String
getIconFileName()
Map<String,String>
getOriginalLoadedScripts()
String
getOriginalScript()
Run
getOwner()
String
getUrlName()
boolean
isEnabled()
boolean
isRebuildEnabled()
boolean
isReplayableSandboxTest()
Runs the extra tests for replayability beyondisEnabled()
that require a blocking load of the execution.static String
replace(CpsFlowExecution execution, String clazz)
Replaces some loaded script text with something else.static Set<String>
replacementsIn(CpsFlowExecution execution)
Finds a set of Groovy class names which are eligible for replacement.QueueTaskFuture
run(String replacementMainScript, Map<String,String> replacementLoadedScripts)
For whitebox testing.Queue.Item
run2(String replacementMainScript, Map<String,String> replacementLoadedScripts)
For use in projects that want initiate a replay via the Java API.
-
-
-
Field Detail
-
REPLAY
public static final Permission REPLAY
-
-
Method Detail
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
isRebuildEnabled
public boolean isRebuildEnabled()
-
isEnabled
public boolean isEnabled()
-
isReplayableSandboxTest
public boolean isReplayableSandboxTest()
Runs the extra tests for replayability beyondisEnabled()
that require a blocking load of the execution.
-
getOriginalScript
public String getOriginalScript()
- See Also:
CpsFlowExecution.getScript()
-
getOriginalLoadedScripts
public Map<String,String> getOriginalLoadedScripts()
- See Also:
CpsFlowExecution.getLoadedScripts()
-
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 forgetOriginalScript()
replacementLoadedScripts
- auxiliary scripts, keyed by class name; replacement forgetOriginalLoadedScripts()
- 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 forgetOriginalScript()
replacementLoadedScripts
- auxiliary scripts, keyed by class name; replacement forgetOriginalLoadedScripts()
- 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 executionclazz
- an entry possibly inreplacementsIn(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()
-
-