Getting Started with Jenkins
What will you learn today?
What is Continuous Integration?
What is Jenkins and how to install it?
Creating a Job with Jenkins
Hands On – CI with Jenkins
Old Days of Software Development
Code changes made by individual team
members are merged together into
working software, which was known as
Integration phase was a hard work
which often results in code conflicts,
hard to find bugs and even harder to fix
them which lead to significant delivery
Today businesses need new features to be incorporated into application into days/weeks not months.
This requires a change in how softwares are built.
Continuous Integration (CI)
Continuous Integration (CI) is a development
practice that requires developers to integrate
code into a shared repository several times a day.
Each check-in is then verified by an automated
build, allowing teams to detect problems early
and deliver the software early.
Benefits of CI
Catch issues fast and nip them in the bud
Everyone can see what’s happening
Automate the build
Keep the build fast
Stop waiting to find out if your code’s going to work
Continuous Integration leads to Continuous Deployment allowing you to deliver software more rapidly
Continuous Integration brings following benefits to software development
Jenkins – The ultimate CI Tool
Jenkins is a cross platform continuous integration application. Jenkins is used to build and
test softwares continuously making it easier for developers to build softwares rapidly
Who is using Jenkins?
A long list of companies using Jenkins is available here https://wiki.jenkins-ci.org/pages/viewpage.action?pageId=58001258
To get started with Jenkins , download the jenkins.war from https://jenkins-ci.org/
Once downloaded you can start the jenkins as shown below
Once you run the Jenkins war you can access the Jenkins dashboard from localhost:8080
Another way to get started with Jenkins is to, put the downloaded jenkins.war into webapps
directory of your servlet container like Apache Tomcat and then start the Tomcat
When you start the tomcat it will deploy the jenkins war file
Once jenkins is deployed successfully, you can access the Jenkins dashboard from localhost:8080/jenkins
Jenkins – Configuring JDK
Once jenkins is running, the first step will be to configure JDK and build tools (Maven/Ant)
If you don’t have JDK installed you can select the Install automatically checkbox
Jenkins – Configuring Maven/Ant
To configure Maven/Ant just provide the value for MAVEN_HOME or ANT_HOME path variables.
If you haven’t installed Maven/Ant, choose the Install automatically checkbox
Jenkins – Setting up Git
Next we will configure Jenkins to work with Git. For that we will add GIT Plugin to Jenkins
Jenkins – Java Project
Now we are ready to build our projects using Jenkins. To borrow ourself a maven based java
project. We are going to fork the https://github.com/wakaleo/game-of-life.git
Cloning the project
Lets clone the project locally so that we can make changes and push our changes to GitHub repository
Jenkins – Creating a new job
Lets create our first Job (i.e. the-first-job)
Job – Setting Git repository
Next we set the Git repository for the Job
Job – Setting Build Triggers
Above we have selected the Poll SCM checkbox and set the schedule to * * * * *, which means poll the
source code management every day of every month and every minute of every hour
Job – Setting Build Goal
Below we have set the build goal to clean package, which means that build job will fail if the code does
not compile or if any of the unit tests fail
Jenkins – Running the Job
Once the new job is configured you can explicitly run the Job by clicking on Build Now button
Jenkins – Successful Build
If build was successful Jenkins will show the blue circle for that build as shown below
Job – Console Output
You can see the detailed output of your build from the Console Output menu
Lets change the code, below we just done one change. Changed the LIVE_CELL symbol from * to +
Committing the changes
Lets commit our change to remote repository
Jenkins – Running the build
Once we commit the changes to remote repository, Jenkins will automatically detect the changes and
run a new build.
Jenkins – Build Failure
As shown in the below snapshot, 6 tests failed after we changed one line of code.
Job – Tracking the changes
From the changes option you can easily figure out which code change resulted in build failure.
Jenkins shows the failed build with red circle
Job – Successful Build
Lets change the code to that of first build by changing the + to * again, commit the changes and
push it to GitHub repository. Jenkins will automatically detect the SCM change and start a new build
Continuous Integration :
Companies using Jenkins :
Sending Email at every build with Jenkins
Your feedback is vital for us, be it a compliment, a suggestion or a complaint. It helps us to
make your experience better!
Please spare few minutes to take the survey after the webinar.
Edureka's Continuous Integration with Jenkins course:
• Become an expert in Jenkins by mastering Build Pipeline, Reporting, Email & Build plugins
• Online Live Classes: 30 hours
• Assignments: 25 hours
• Project: 20 hours
• Lifetime Access + 24 X 7 Support
Go to www.edureka.co/jenkins
Batch starts from 05 December (Weekend Batch)
Understand the Continuous Integration/Delivery concepts and Build Pipelines with Jenkins
Thank You …
Recording and presentation will be made available to you within 24 hours