Package jenkins.util

Class DefaultScriptListener

    • Field Detail

      • LOGGER

        public static final Logger LOGGER
    • Constructor Detail

      • DefaultScriptListener

        public DefaultScriptListener()
    • 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: ScriptListener
        Called just before scripts are executed. Examples include:
        • Groovy script console script execution
        • groovy CLI command
        • Start and end of a groovysh CLI command session, as well as individual commands submitted
        • Execution of scripts integrating with Script Security Plugin
        Specified by:
        onScriptExecution in interface ScriptListener
        Parameters:
        script - The script to be executed or null if no script is available yet (e.g. a shell has just been opened).
        binding - The script binding, or null if unavailable/inapplicable.
        feature - The feature that triggered this event. Usually a fixed string or even a Class if that's unambiguously describing the feature (e.g., Object.getClass()).
        context - Object representing the script definition context (e.g. Run). Can be null if 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 be null.
      • onScriptOutput

        public void onScriptOutput​(String output,
                                   @NonNull
                                   Object feature,
                                   Object context,
                                   @NonNull
                                   String correlationId,
                                   User user)
        Description copied from interface: ScriptListener
        Called when a script produces output. This can include error output.
        Specified by:
        onScriptOutput in interface ScriptListener
        Parameters:
        output - The output of the script.
        feature - The feature that triggered this event. Usually a fixed string or even a Class if that's unambiguously describing the feature (e.g., Object.getClass()).
        context - Object representing the script definition context (e.g. Run). Can be null if 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 be null.