Package jenkins.util
Class DefaultScriptListener
- java.lang.Object
-
- jenkins.util.DefaultScriptListener
-
- All Implemented Interfaces:
ExtensionPoint,ScriptListener
@Extension @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public class DefaultScriptListener extends Object implements ScriptListener
Basic default implementation ofScriptListenerthat just logs.- Since:
- 2.427
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Nested classes/interfaces inherited from interface jenkins.util.ScriptListener
ScriptListener.ListenerOutputStream, ScriptListener.ListenerWriter
-
-
Constructor Summary
Constructors Constructor Description DefaultScriptListener()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidonScriptExecution(String script, groovy.lang.Binding binding, Object feature, Object context, String correlationId, User user)Called just before scripts are executed.voidonScriptOutput(String output, Object feature, Object context, String correlationId, User user)Called when a script produces output.
-
-
-
Field Detail
-
LOGGER
public static final Logger LOGGER
-
-
Method Detail
-
onScriptExecution
public void onScriptExecution(String script, groovy.lang.Binding binding, @NonNull Object feature, Object context, @NonNull String correlationId, User user)
Description copied from interface:ScriptListenerCalled just before scripts are executed. Examples include:- Groovy script console script execution
groovyCLI command- Start and end of a
groovyshCLI command session, as well as individual commands submitted - Execution of scripts integrating with Script Security Plugin
- Specified by:
onScriptExecutionin interfaceScriptListener- Parameters:
script- The script to be executed ornullif no script is available yet (e.g. a shell has just been opened).binding- The script binding, ornullif unavailable/inapplicable.feature- The feature that triggered this event. Usually a fixed string or even aClassif that's unambiguously describing the feature (e.g.,Object.getClass()).context- Object representing the script definition context (e.g.Run). Can benullif not applicable (e.g., CLI commands not acting on jobs/builds).correlationId- This value is used to correlate this script event to other, related script events. Callers are expected to provide values that allow receivers to associate script execution and output. Related events should have identical values.user- If available, the user who executed the script. Can benull.
-
onScriptOutput
public void onScriptOutput(String output, @NonNull Object feature, Object context, @NonNull String correlationId, User user)
Description copied from interface:ScriptListenerCalled when a script produces output. This can include error output.- Specified by:
onScriptOutputin interfaceScriptListener- Parameters:
output- The output of the script.feature- The feature that triggered this event. Usually a fixed string or even aClassif that's unambiguously describing the feature (e.g.,Object.getClass()).context- Object representing the script definition context (e.g.Run). Can benullif not applicable (e.g., CLI commands not acting on jobs/builds).correlationId- This value is used to correlate this script event to other, related script events. Callers are expected to provide values that allow receivers to associate script execution and output. Related events should have identical values.user- If available, the user for which the output was created. Can benull.
-
-