Blog post 2

Built-in Groovy scripting

Jenkins has a built-in scripting language, Groovy. It can be of great help if you need to do something that is not provided by any setting or plugin and you do not feel you want to write a new plugin.

The Groovy script has access to all the internals of Jenkins, so there is a lot you can do with it, both good and bad…

The internals of Jenkins are documented at http://javadoc.jenkins-ci.org/.

You can find a Groovy script console in your Jenkins by clicking on “Manage Jenkins” and “Script console”. You type in small Groovy scripts, hit cmd+Return and Jenkins will evaluate the script. (I’m sure there is a keyboard shortcut for PC users too.)

Jenkins also has a Groovy plugin which adds a build step which can run a Groovy script. And there is also a Groovy post-build plugin, which allows you run a Groovy script after the build is done.