CONTINUOUS INTEGRATION USING JENKINS
- Vinay Gopalkrishna
What is CI?
Why we need CI?
CI Server – Jenkins
What is Jenkins?
How Jenkins work?
What Jenkins can do?
CI - DEFINED
Continuous Integration is the practice, in software
engineering, of merging all developer working
copies with a shared mainline several times a day.
CI is a software development practice where
members of a team integrate their work frequently,
usually each person integrates at least daily –
leading to multiple integrations per day. Each
integration is verified by an automated build
(including test) to detect integration errors as
quickly as possible. – Martin Flower
CI – WHAT DOES IT REALLY MEAN?
At a regular frequency (ideally at every commit), the
system is :
All changes up until that point are combined into the project
The code is compiled into an executable or package
Automated Test suites are run
Versioned and stored so it can be distributed as is, if desired
Loaded onto a system where the developers can interact with
WHY WE NEED CI?
Fixing bugs late is costly
Lack of team cohesion
“Your changes to bar are incompatible with mine. How
do we merge now?”
“When did we decided to upgrade to version 2.0 of the
“I thought you fixed that 2 months ago!”
Poor quality code base
“We have 3 classes doing the same thing!!”
“Everybody knows double checked locking is bad idea!”
“Why can’t I just include Foo and not require all of the
other 13 libs? ”
WHY WE NEED CI? CONT…..
Lack of project visibility
“What do you mean the tests are failing? ”
“What’s in the version 1.2.3 of the build”
What’s our code coverage now?
Lack of deployable software
“It works on my machine!”
“I need a new build to test with”
“The boss|customer is coming, we need to demo
Maintain Code Repository
Automate the build
Everyone commits the baseline everyday
Every commit (to baseline) should be built
Keep the build fast
Test in the clone of production environment
Make it easy to get the test deliverables
Everyone can see the results of the latest build
Ensures code actually compiles
On every target platform
Ensures product functions as expected
Through repeatable testing
Ensures DB and code is in sync
Automates (re)creation of test data
BUILD INGREDIENTS SOME MORE
Ensures a healthy code base
Identifies problems early
Enforces best practices
Products can be released anytime
Continually demo-able state
Eliminates “Works on my machine”
Ensures document is current
Removes burden from developers
Produces build reports and metrics
CI SERVER - JENKINS
It is an open source CI tool written in java.
It is a server based system running in a servlet
It supports SCM tools including Accurev, CVS,
Subversion, Git, Mercurial, Perforce, Clearcase.
It can execute Apache Ant and Apache maven
Builds can be started by various means, including
being triggered by commit in version control
HOW JENKINS WORK - SETUP
When setting up a project in Jenkins, out of the box
you have the general options
Associating with a version control server
Execution of shell scripts, bash scripts, Ant targets and
Publish jUnit test results and javadocs
Jenkins plugin system can enable a wide range of
features including(but not certainly not limited to)
And most importantly – The CI game
A points based game where developers compete against each
other to develop the most stable, well tested code
WHAT JENKINS CAN DO?
Generate Test Reports
Integrate with many different version control
Push to various artifact repositories
Deploys directly to production or test environments
Notify stakeholders of build status
Continuous Integration is a necessity on complex
projects due to the benefits it provides regarding
early detection of problems.
A good continuous build system should be flexible
enough to fit into pre-existing development
environments and provide all the features a team
expects from such a system.
Jenkins, a continuous build system, can be an
integral part of any continuous integration system
due to its core feature set and extensibility through
a plugin system.