Package jenkins.util.groovy
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.
- /WEB-INF/HOOK.groovy in the war file
- /WEB-INF/HOOK.groovy.d/*.groovy in the war file
- $JENKINS_HOME/HOOK.groovy
- $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 ofHOOK.groovy.d
allows configuration management tools to control scripts easily.- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Constructor Description GroovyHookScript(String hook)
Deprecated.GroovyHookScript(String hook, javax.servlet.ServletContext servletContext, File jenkinsHome, ClassLoader loader)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description GroovyHookScript
bind(String name, Object o)
protected groovy.lang.GroovyShell
createShell()
Can be used to customize the environment in which the script runs.protected void
execute(groovy.lang.GroovyCodeSource s)
protected void
execute(File f)
protected void
execute(URL bundled)
groovy.lang.Binding
getBindings()
void
run()
-
-
-
Constructor Detail
-
GroovyHookScript
@Deprecated public GroovyHookScript(String hook)
Deprecated.
-
GroovyHookScript
public GroovyHookScript(String hook, @NonNull javax.servlet.ServletContext servletContext, @NonNull File jenkinsHome, @NonNull ClassLoader loader)
-
-
Method Detail
-
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.
-
-