Class ReplayAction
java.lang.Object
org.jenkinsci.plugins.workflow.cps.replay.ReplayAction
- All Implemented Interfaces:
Action
,ModelObject
Attached to a
Run
when it could be replayed with script edits.-
Nested Class Summary
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionLoaded scripts do not need to be approved.doCheckScript
(String value) Form validation for the main script Jelly onlynet.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
getDiff()
Fetches execution, blocking if needed while we wait for some of the loading process.getOwner()
boolean
boolean
boolean
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.replacementsIn
(CpsFlowExecution execution) Finds a set of Groovy class names which are eligible for replacement.For whitebox testing.For use in projects that want initiate a replay via the Java API.
-
Field Details
-
REPLAY
-
-
Method Details
-
getDisplayName
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getIconFileName
- Specified by:
getIconFileName
in interfaceAction
-
getUrlName
- Specified by:
getUrlName
in interfaceAction
-
getExecutionBlocking
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) @CheckForNull public CpsFlowExecution getExecutionBlocking()Fetches execution, blocking if needed while we wait for some of the loading process. -
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
- See Also:
-
getOriginalLoadedScripts
- See Also:
-
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
-
doCheckLoadedScript
Loaded scripts do not need to be approved. -
doCheckScript
Form validation for the main script Jelly only- Parameters:
value
- the script being checked- Returns:
- a message indicating that the script needs to be approved; nothing if the script is empty; a corresponding message if the script is approved
-
doCheckScriptCompile
-
ensurePermissionRegistered
@Initializer(after=PLUGINS_STARTED, before=EXTENSIONS_AUGMENTED) public static void ensurePermissionRegistered()
-