Groovy is a dynamic language for the Java Virtual Machine that works alongside Java code and adds concise syntax, closures and scripting support. In DevOps work it appears most often in Jenkins, where Jenkinsfiles, the script console and many automation scripts are written in Groovy. It is also the language behind Gradle build scripts.
Most of the posts here focus on Jenkins. They include a complete Jenkins Pipeline reference, guides to variables and the $class parameter in scripted pipelines, and examples of creating folders from pipeline code. Other posts show how to run Groovy scripts through the Groovy plugin, through the script console or remotely over HTTP with curl, and there is a collection of ready-made scripts for managing plugins, tools and agent labels. Beyond Jenkins, you will find language basics such as comments, a comparison of code editors, the CloudBees CD/RO DSL and Gradle interview questions.
The material is aimed at Jenkins administrators, build and release engineers and developers. It teaches enough Groovy to write and debug pipelines or automate a CI server without first learning the whole language.
Start here
- Jenkins Pipeline Complete Reference Tutorials – Covers Jenkinsfile basics and the difference between declarative and scripted pipelines.
- Jenkins Tutorials: Variables in Scripted Pipeline – Shows how to declare string, integer, boolean, list and map variables with def.
- Groovy Tutorials: How to write comments in Groovy? – Language basics: single-line, multiline and GroovyDoc comments, including in Jenkinsfiles.
- How to run/execute groovy script in Jenkins? – Explains the Groovy plugin and the script console for controllers and agents.
- Jenkins Tutorials: Meaning of $class in scripted pipeline – Explains what $class means in scripted pipelines and how plugins define it.
- How to execute grovvy script remotely on Jenkins server? – Run scripts remotely through /script or /scriptText using curl and authentication.
- Database of Groovy Script for Jenkins Automation – Ready-made scripts for plugins, tool installs, system config and agent labels.
Latest Groovy articles
Cloudbees CD RO Tutorials: DSL
CloudBees CD/RO DSL is a Groovy-based language for defining projects, procedures, steps, pipelines and properties as code. You run these scripts on the server with ectool evalDsl….
Groovy Tutorials: How to write comments in Groovy?
Groovy has three kinds of comment that it shares with Java: single-line comments with //, block comments between /* and */, and GroovyDoc comments between /** and…
Automating Jenkins Job Configuration: Job DSL, Multibranch, Job Generator, and JJB
Manually creating many Jenkins jobs is slow and error-prone. This guide compares the main automation options and shows practical jobs-as-code examples for repeatable setup.
Gradle Training Curriculum: Hands-On Learning Path for Build and DevOps Engineers
A revised, practical Gradle training guide based on the original course outline. It maps the agenda to hands-on labs, CI workflow, and team-ready build practices.
Deploying Java EE on Amazon EC2 with EC2Deploy: Workflow, Script, and Modern Lessons
This revised guide breaks down the original EC2Deploy approach for provisioning EC2 instances, deploying Java EE apps, and running JMeter tests. It also maps the same deployment pattern to modern DevOps practices.
Jenkins Pipeline Tutorials: How to create folder and subfolder?
To create folders and subfolders in Jenkins using pipeline code, you can use Jenkins Job DSL or Groovy script. Here’s how you can accomplish this in a…
Jenkins Tutorials: Meaning of $class in scripted pipeline
In Jenkins pipeline scripts, the $class parameter is used to specify the class or type of an object. The complete list of $class values depends on the…
Jenkins Tutorials: Variables in Scripted Pipeline
In a scripted Jenkins pipeline, you can use different types of variables depending on your requirements. Here are examples of different variable types commonly used in scripted…
Best & Most Popular 5 Code Editor for Groovy Programming Language
Groovy, a dynamic and object-oriented programming language, has emerged as a default choice for Java developers. Initially released in 2003, the programming language is largely Scala-like and…
Top Gradle interview questions and answers
What is Gradle build tool? Gradle is a build automation tool based on Groovy and Kotlin. It’s open-source and flexible enough to build almost any type of software….
Jenkins Pipeline Complete Reference Tutorials
What is a Jenkins Pipeline? Jenkins Pipeline (or simply “Pipeline”) is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins. Jenkins Pipeline…
Scripting in Jenkins with Groovy and others Scripting Language
How to run/execute groovy script in Jenkins? Database of Groovy Script for Jenkins Automation Script to check the build status of a Jenkins job Rajesh KumarI’m Rajesh…
How to execute grovvy script remotely on Jenkins server?
A Jenkins Admin can execute groovy scripts remotely by sending an HTTP POST request to /script/ url or /scriptText/. curl example via bash [code] curl -d “script=<your_script_here>”…
How to run/execute groovy script in Jenkins?
Here are the List of way using you can apply grovy code in Jenkins Method -1: Groovy plugin This plugin adds the ability to directly execute Groovy…
Database of Groovy Script for Jenkins Automation
Here are the list of Groovy Script which can be used in Jenkins to automate the JOBs and CI process. Please add your list in the comment…
Monitor and Restart Offline Slaves
rajeshkumar created the topic: Monitor and Restart Offline Slaves If you facing a problem of jenkins node disconnect automatically, you can try this script- This script can…
Groovy: frequently asked questions
What is Groovy used for in Jenkins?
Jenkins uses Groovy for Jenkinsfiles (pipeline as code), shared libraries and administration scripts run in the script console. It lets you automate both builds and the configuration of the Jenkins server itself.
What is the difference between declarative and scripted pipelines?
A declarative pipeline uses a structured, predefined syntax inside a pipeline block, which makes it easier to read and validate. A scripted pipeline is plain Groovy, usually inside a node block, and gives more flexibility at the cost of more complexity.
How do I run a Groovy script in Jenkins?
Open Manage Jenkins > Script Console to run a script directly on the controller or on an agent. You can also add a Groovy build step with the Groovy plugin, or send a POST request to the /scriptText endpoint with valid credentials.
Do I need to know Java to learn Groovy?
No. Groovy's syntax is close to Java's, so Java experience helps, but you can write useful pipeline and automation scripts without it.
