18

Click here to load reader

Continuous Integration using Jenkins

Embed Size (px)

Citation preview

Page 1: Continuous Integration using Jenkins

CONTINUOUS INTEGRATION USING JENKINS

- Vinay Gopalkrishna

Page 2: Continuous Integration using Jenkins

AGENDA

Continuous Integration

What is CI?

Why we need CI?

Best Practices

Workflow

Build Ingredients

CI Server – Jenkins

What is Jenkins?

How Jenkins work?

Plugins

What Jenkins can do?

Conclusion

References

Page 3: Continuous Integration using Jenkins

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

Page 4: Continuous Integration using Jenkins

CI – WHAT DOES IT REALLY MEAN?

At a regular frequency (ideally at every commit), the system is :

Integrated All changes up until that point are combined into the project

Built The code is compiled into an executable or package

Tested Automated Test suites are run

Archived Versioned and stored so it can be distributed as is, if desired

Deployed Loaded onto a system where the developers can interact with

it.

Page 5: Continuous Integration using Jenkins

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 super library?”

“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? ”

Page 6: Continuous Integration using Jenkins

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

progress asap.”

Page 7: Continuous Integration using Jenkins

BEST PRACTICES

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

Automate deployment

Page 8: Continuous Integration using Jenkins

CI WORKFLOW

Page 9: Continuous Integration using Jenkins

CI WORKFLOW

Page 10: Continuous Integration using Jenkins

BUILD INGREDIENTS

Compilation

Ensures code actually compiles

On every target platform

Test execution

Ensures product functions as expected

Through repeatable testing

Database integration

Ensures DB and code is in sync

Automates (re)creation of test data

Page 11: Continuous Integration using Jenkins

BUILD INGREDIENTS SOME MORE

Code inspection

Ensures a healthy code base

Identifies problems early

Enforces best practices

Automated deployment

Products can be released anytime

Continually demo-able state

Eliminates “Works on my machine”

Documentation generation

Ensures document is current

Removes burden from developers

Produces build reports and metrics

Page 12: Continuous Integration using Jenkins

CI SERVER - JENKINS

It is an open source CI tool written in java.

It is a server based system running in a servlet

container.

It supports SCM tools including Accurev, CVS,

Subversion, Git, Mercurial, Perforce, Clearcase.

It can execute Apache Ant and Apache maven

based projects.

Builds can be started by various means, including

being triggered by commit in version control

system.

Page 13: Continuous Integration using Jenkins

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

Triggering builds

Execution of shell scripts, bash scripts, Ant targets and

maven targets.

Artifact archival

Publish jUnit test results and javadocs

Email Notifications

Page 14: Continuous Integration using Jenkins

PLUGINS

Jenkins plugin system can enable a wide range of

features including(but not certainly not limited to)

SCM

Testing

Notifications

Reporting

Artifact saving

Triggers

External integration

And most importantly – The CI game

A points based game where developers compete against each

other to develop the most stable, well tested code

Page 15: Continuous Integration using Jenkins

WHAT JENKINS CAN DO?

Generate Test Reports

Integrate with many different version control

systems

Push to various artifact repositories

Deploys directly to production or test environments

Notify stakeholders of build status

Page 16: Continuous Integration using Jenkins

CONCLUSION

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.

Page 17: Continuous Integration using Jenkins

REFERENCES

Continuous integration

http://en.wikipedia.org/wiki/Continuous_integration

http://java.dzone.com/articles/continuous-integration-

how-0

Jenkins

http://en.wikipedia.org/wiki/Jenkins_(software)

Page 18: Continuous Integration using Jenkins

ANY QUESTIONS?