0
votes

How to start with Jenkins scripting using groovy as the scripting language? where can i find a proper documentation of all the methods and how to use them that i can use to automate Jenkins using groovy?

2

2 Answers

0
votes

At first, refer to the plugin itself, it has nice and detailed explanations: Groovy Postbuild Plugin

Than just learn a bit about Groovy as a language and start using it.

Add Groovy postbuild action and type the script content.

0
votes

The Scripler plugin is a powerful plugin that let's you run your groovy code from any build step. (it can even be used to code Jenkins dynamic parameters in the UI!)

There are two additional advantages of using this plugin:

  1. You can test your groovy code on your actual Jenkins server: After you install the plugin, go to: "Manage Jenkins" --> "Scriptler" or "YOUR_SERVER_URL/scriptler" and click "Add a new Script". Save it with an initial code something like println "Hello Scriptler!" and click "submit". you will now be able to run your script for testing by clicking on the small Terminal icon.
  2. It has a fair share of already made scripts created by the people in the community: Visit https://github.com/jenkinsci/jenkins-scripts