Skip to content

Instantly share code, notes, and snippets.

@ansig
Created December 22, 2018 12:16
Show Gist options
  • Save ansig/3fe186dbfc51ca3773db1a16ba7338f6 to your computer and use it in GitHub Desktop.
Save ansig/3fe186dbfc51ca3773db1a16ba7338f6 to your computer and use it in GitHub Desktop.
Jenkins Groovy script that executes all scripts in init.groovy.d
import groovy.io.FileType
def initGroovyDir = new File("${System.getenv('JENKINS_HOME')}/init.groovy.d")
initGroovyDir.eachFileMatch(FileType.FILES, ~/.*\.groovy/) {
println "Running: ${it}"
new GroovyShell(this.class.classLoader).evaluate(it)
}
println "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment