Show Menu

DevOps: Jenkins Cheat Sheet


Jenkins is an open source automation tool written in Java that allows continuous integr­ation and continuous delivery of projects.


1. Install Java Develo­pment Kit (JDK)
2. Set the Path for the Enviro­nmental Variable for JDK.
3. Download and Install Jenkins.
4. Run Jenkins on Localhost 8080.

1. Install Java ($sudo apt install openjd­k-8-jdk or 11-jdk).
2. Add the Jenkins reposi­tory.
3. Install Jenkins ($sudo apt update, $sudo apt install Jenkins).
4. Set up Jenkins (http:­//l­oca­lho­st:­8080).


1. Freestyle build jobs are genera­l-p­urpose build jobs, which provides maximum flexib­ility. It can be used for any type of project.
2. Pipeline runs the entire software develo­pment workflow as code.
3. Multic­onf­igu­ration project allows us to run the same build job on different enviro­nments.
4. Folder allows users to create folders to organize and categorize similar jobs.
5. GitHub Organi­zation scans your entire GitHub organi­zation and creates Pipeline jobs for each repository containing a Jenkin­sfile.
6. Multib­ranch Pipeline lets us implement different Jenkin­sfiles for different branches of the same project.
7. Maven builds a maven project. Jenkins takes advantage of our POM files for packaging.


Build Pipeline can be used to chain several jobs together and run them in a sequence.
1. Create 3 freestyle Jobs.
2. Chain the 3 jobs together.
Job1 ->c­onf­igure ->Post Build ->Build other projects ->Job2
Job2 ->c­onf­igure ->Post Build ->Build other projects ->Job3
3. Create a build pipeline view.
Jenkins Dashboard ->Add view ->Enter a name ->Build pipeline view ->ok ->c­onf­igure ->P­ipeline flow ->S­elect Initial job ->Job1 ->ok
4. Run the Build Pipeline.


Jenkins pipeline is a single platform that runs the entire pipeline as code instead of building several jobs for each
phase and it puts it in a Jenkin­sfile. Jenkin­sfile is a text file that stores the pipeline as code. It is written using the Groovy DSL. It can be written based on two syntaxes:
1. Scripted pipeline: Code is written on the Jenkins UI instance and is enclosed within the node block.
node {
scripted pipeline code
2. Declar­ative pipeline: Code is written locally in a file and is checked into a SCM and is enclosed within the pipeline block.
node {
declar­ative pipeline code


Most Commonly Used Jenkins Plugins:
Jenkins comes with over 2000 plugins and each plugin has a unique functi­ona­lity. But when it comes to software develo­pment most developers use a set of plugins, such as, Maven, Git, Ant, Docker, Amazon EC2, HTML publisher, Copy artefact, etc.
Follow the below step to install the above plugins or any other Jenkins plugin.
Jenkins Dashbo­ard­-> Manage Jenkin­s-> Manage Plugin­s-> Available
In the filter text field enter the name of the plugin you want to install.


1. Build Step where we can write goals and options. We can write different maven commands
here such as CLEAN, INSTALL, COMPILE, TEST, PACKAGE, etc. that affect the POM.xml file present on our system or GitHub Reposi­tory.
2. We can also deploy war/ear to a container using post-build actions and archive the same.
3. We can execute batch or shell commands as a part of pre-build steps.


1. Head to the manage plugins and install the respective plugins
2. It takes the war/ear file and deploys that to the running remote applic­ation build.
3. Go-to build and configure and click on ‘deploy to war/ear to container’
4. In the war container section save details about the destin­ation server and click save.
Open a freestyle project. Paste the URL of GitHub repository where POM.xml file is stored in SCM. Add a maven command (MVN CLEAN INSTALL). This will give us a war/jar file which we can deploy onto TOMCAT.


Jenkins allows us to give different permis­sions to a user across different jobs using "­Project Based Matrix Author­ization strate­gy".
To use Projec­t-based Matrix Author­ization Strategy, First login with Admin user go to
Manage Jenkins -> Configure Global Security.
In "­Aut­hor­iza­tio­n", Select "­Pro­jec­t-based Matrix Author­ization Strate­gy". Then add "­Adm­in"user and check all the checkbox to grant all permission to admin user.


No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          DevOps Troubleshooting Study Guide Cheat Sheet
          AWS-DevOps Overview Cheat Sheet
          DevOps Cheat Sheet