A repo of useful groovy init scripts for working with jenkins hooks..
Jenkins allows adding groovy scripts for initialization, which means these scripts will run every time Jenkins starts.
The jenkins server automatically looks for groovy.d
folder under the home dir of where Jenkins run from e.g. /var/lib/jenkins/groovy.d
or /root/.jenkins/groovy.d
if running in a container, and any groovy script in folder get executed anytime jenkins starts.
Its a pretty handy way of automating Jenkins installation; lets say you want your CI setup to be automated, like everytime you install your jenkins environment, it should be pre-configured with certain user accounts created, have LDAP configured automatically or some global properties set.
Groovy is an easy way of calling Jenkins base classes of Java without getting to know much of Java itself ;)
I have scripts for :
anonymous
, authenticated
or any specific user.Cheers :)