Skip to content

Instantly share code, notes, and snippets.

@bvcelari
Last active May 12, 2020 09:17
Show Gist options
  • Save bvcelari/2b462752b8232bca967a2806c53d9195 to your computer and use it in GitHub Desktop.
Save bvcelari/2b462752b8232bca967a2806c53d9195 to your computer and use it in GitHub Desktop.
import hudson.license.LicenseManager
import hudson.security.ACL
import jenkins.model.Jenkins
import jenkins.util.groovy.GroovyHookScript
import java.io.File
import java.util.logging.Logger
Logger logger = Logger.getLogger("init.init_01_launch_auto_config.groovy")
ACL.impersonate(ACL.SYSTEM, new Runnable() {
@Override
public void run() {
def j = Jenkins.instance;
// load scripts from /var/jenkins_config/configure-jenkins.groovy and /var/jenkins_config/configure-jenkins.groovy.d/*.groovy
new GroovyHookScript("/var/jenkins_config/configure-jenkins", j.servletContext, new File(""), j.pluginManager.uberClassLoader).run();
// load scripts from $HOME/configure-jenkins.groovy and $HOME/configure-jenkins.groovy.d/*.groovy
new GroovyHookScript("configure-jenkins").run();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment