Class GroovyHookScript

java.lang.Object
jenkins.util.groovy.GroovyHookScript

public class GroovyHookScript extends Object
A collection of Groovy scripts that are executed as various hooks.

For a given hook name, like "init", the following locations are searched for hook scripts, and then they are executed in turn.

  1. /WEB-INF/HOOK.groovy in the war file
  2. /WEB-INF/HOOK.groovy.d/*.groovy in the war file
  3. $JENKINS_HOME/HOOK.groovy
  4. $JENKINS_HOME/HOOK.groovy.d/*.groovy

Scripts inside /WEB-INF is meant for OEM distributions of Jenkins. Files inside $JENKINS_HOME are for installation local settings. Use of HOOK.groovy.d allows configuration management tools to control scripts easily.

Author:
Kohsuke Kawaguchi
  • Constructor Details

  • Method Details

    • bind

      public GroovyHookScript bind(String name, Object o)
    • getBindings

      public groovy.lang.Binding getBindings()
    • run

      public void run()
    • execute

      protected void execute(URL bundled) throws IOException
      Throws:
      IOException
    • execute

      protected void execute(File f)
    • execute

      protected void execute(groovy.lang.GroovyCodeSource s)
    • createShell

      protected groovy.lang.GroovyShell createShell()
      Can be used to customize the environment in which the script runs.