SlideShare a Scribd company logo
CI Server Configuration : Jenkins 
    
Continuous integration 
 
Continuous integration (CI) is the practice, in software engineering, of merging all 
developer working copies with a shared mainline several times a day. It was first named and 
proposed by Grady Booch in his method, who did not advocate integrating several times a day.. 
The main aim of CI is to prevent integration problems, referred to as "integration hell". 
 
CI was originally intended to be used in combination with automated unit tests written 
through the practices of test­driven development. Initially this was conceived of as running all 
unit tests in the developer's local environment and verifying they all passed before committing to 
the mainline. This helps avoid one developer's work in progress breaking another developer's 
copy. Later elaborations of the concept introduced build servers, which automatically run the 
unit tests periodically or even after every commit and report the results to the developers. 
 
 
Best practices 
 
1 Maintain a code repository 
2 Automate the build 
3 Make the build self­testing 
4 Everyone commits to the baseline every day 
5 Every commit (to baseline) should be built 
6 Keep the build fast 
7 Test in a clone of the production environment 
8 Make it easy to get the latest deliverables 
9 Everyone can see the results of the latest build 
10 Automate deployment 
 
 
Costs and benefits 
 
Continuous integration is intended to produce benefits such as: 
 
Integration bugs are detected early and are easy to track down due to small change 
sets. This saves both time and money over the lifespan of a project. 
 
Avoids last­minute chaos at release dates, when everyone tries to check in their slightly 
incompatible versions 
 
When unit tests fail or a bug emerges, if developer need to revert the codebase to a 
bug­free state without debugging, only a small number of changes are lost (because integration 
happens frequently) 
Constant availability of a "current" build for testing, demo, or release purposes 
Frequent code check­in pushes developers to create modular, less complex 
code[citation needed] 
 
With continuous automated testing benefits can include: 
 
Enforces discipline of frequent automated testing 
Immediate feedback on system­wide impact of local changes 
Metrics generated from automated testing and CI (such as metrics for code coverage, 
code complexity, and features complete) focus developers on developing functional, quality 
code, and help develop momentum in a team 
 
 
  Installing Jenkins on ubuntu 
 
Installation: 
For installation follow below steps: 
1.  ​wget ­q ­O ­ https://jenkins­ci.org/debian/jenkins­ci.org.key | sudo apt­key add ­ 
2.  ​sudo sh ­c 'echo deb http://pkg.jenkins­ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list' 
3.  ​sudo apt­get update 
4.  sudo apt­get install jenkins 
 
Upgrade: 
Once installed like this, you can update to the later version of Jenkins (when it comes out) by 
running the following commands: 
1. sudo apt­get update 
2. sudo apt­get install jenkins 
 
 
 
 
 
 
 
 
 
 
Configure Jenkins: 
Next, you need to use the Jenkins web interface to install plugins, configure security and add 
users. 
 
Open your web browser to ​http://localhost:8080​. (If you’re running Jenkins remotely, you 
should be able to use the server’s domain or IP address.) 
 
currently for ip: ​x.x.x.x  
credential 
username: yourUserName 
pass: yourPassword 
 
Install Plugins:  
From the root page, click ​“Manage Jenkins”​ then ​“Manage Plugins”​. From the ​“Available” 
tab, check the following plugins: 
 
1. Git 
2. GitHub 
3. rbenv Or rvm 
4. Rake 
5. Rcov 
6. RubyMetrics plugin 
7. Mailer 
 
Next, select ​“Download now and install after restart” 
 
Configuration of Global Security part is skipped. You can see details here ​Security 
 
Manage Jenkins: 
 
Step 1: ​ Go to yourip:jenkinport/configure (​http://x.x.x.x:8080/configure​) . You can do it by jenkin 
home ­> manage jenkins ­> configure system 
 
Step 2:   
Home   
check home directory is /var/lib/jenkins or not . otherwise you have to set all 
default home configuration to that particular home directory. 
 
Email notification  
 
1. go to yourjenkinserver/configure  
2. In Email notification block smtp server => smtp.gmail.com 
3. select Use SMTP Authentication 
4. give user name password, select use ssh, smtp port => 465 , chracter­set => 
UTF­8 
5. select ​Test configuration by sending test e­mail ​to check configuration is 
succesful or not . 
6. If fails follow it from above link. 
7. Finally under your project settings , In ​Post­build Actions ​in  ​Email notification 
set up your emails. 
Configure Global Security
1. Enable security. 
2. Security Realm ­> Jenkins’ own user database ­> Allow users to sign up 
3. Authorization ­> Anyone can do anything 
4. after you sign up  ­> change authorization to​ Logged­in users can do anything or 
Matrix­based security or Project­based Matrix Authorization Strategy  ​as your wish 
. in Matrix­based security​ you can set up configuration for a particular user/ group 
which is created in jenkins ui ​. 
 
N.B.​ while configuring global security  you may have security problem like locking yourself 
(Hope you have not  :) ). 
but If you , then​ ​Disable Security 
 
or for your convenience  
One may accidentally set up security realm / authorization in such a way that you may no longer 
able to reconfigure Jenkins. 
When this happens, you can fix this by the following steps: 
1. Stop Jenkins (the easiest way to do this is to kill the servlet container.) 
2. Go to $JENKINS_HOME in the file system and find config.xml file. 
3. Open this file in the editor. 
4. Look for the <useSecurity>true</useSecurity> element in this file. 
5. Replace true with false 
6. Remove the elements authorizationStrategy and securityRealm 
7. Start Jenkins 
When Jenkins comes back, it's in the unsecured mode where everyone gets full access to the 
system. 
If this is still not working, trying renaming or deleting config.xml. 
 
 
 
   
Configure your project: 
Next, you need to configure your Rails project. To complete this follow below steps: 
 
Step 1:​ From the Jenkins home page, click on ​“New Item”​, then select “Build a free­style 
software project” and click “OK”. 
 
Step 2: ​Fill in the “​Project Name”​ and “​GitHub project” ​fields.” Project Name” must be a single 
word. 
 
Step 3: ​Under “​Source Code Management”,​ select “​Git”​ and fill in the repo url. (If you need to 
authenticate with SSH, configure that here.) 
   ​Step 3.1: 
      ​You need to switch jenkins user to generate ssh key by following command: 
su ­s /bin/bash jenkins 
It is because jenkins web interface expect all command will be executed as 
a bash command. Hence whenever we executing by switching only by su jenkins 
then it’s environment will not same as the jenkins expect. So that the known host 
will not allow the user to clone the remote private repository. 
 
Step 4:​ Check the “​rbenv build wrapper”​ box. 
 
If you are using ​RVM​ instead of ​RBENV then, 
Check the  ​Run the build in a RVM­managed environment =>Implementation  
put ruby version for that project​. 
 
Step 5:​  Database credential need to configure to sync the code with jenkin. So that we need to 
create database.yml . To do so, follow the below command: 
 
touch ~/project­database.yml 
 
Then you need to write your db config in  ​~/project­database.yml ​according to your Database 
configuration. To accomplish that follow: 
 
         ​nano ~/project­database.yml 
 
and put your custom configuration in ​~/project­database.yml 
 
Step 6: 
Tick on  ​Build when a change is pushed to GitHub ​from​ Build Triggers 
 
Step 7:​ Under “​Add build step​”, select “​Execute shell”.  
 
Now we are ready and a typical Rails app script might look like this: 
cp ~/project­database.yml config/database.yml 
mkdir ­p coverage/rcov 
mkdir ­p rcov 
bundle install 
rake db:create RAILS_ENV=test 
rake db:migrate RAILS_ENV=test 
rake spec 
 
Make sure the database is configured properly. If you need a special database.yml, you can 
store this in Jenkins’ home directory. 
 
OPTIONAL: ​To make sure you know when a build fails, set up email notifications (under 
“Add post­build action”). Configure SMTP on the “Configure System” page, found under 
“Manage Jenkins”. See the Jenkins wiki for ​an easy Gmail setup:  
Or You can follow below step. 
8. got to yourjenkinserver/configure  
9. In Email notification block smtp server => smtp.gmail.com 
10. select Use SMTP Authentication 
11. give user name password, select use ssh, smtp port => 465 , chracter­set => 
UTF­8 
12. select ​Test configuration by sending test e­mail ​to check configuration is 
succesful or not . 
13. If fails follow it from above link. 
14. Finally under your project settings , In ​Post­build Actions ​in  ​Email notification 
set up your emails. 
 
Post­build Actions 
1. select publlish rcov report 
2. set directory => coverage/rcov 
3. Also before do this you need to ensure that you have right gem in your gem file: 
  gem 'simplecov', :require => false, :group => :test 
  gem 'simplecov­rcov' 
4. And also configure your spec/spec_helper.rb like this: 
               ​ require 'simplecov' 
                require 'simplecov­rcov' 
                SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter 
                SimpleCov.start 'rails' 
 
 
Try out your build by clicking “​Build Now”​. 
 
 
GitHub Integration 
 
Finally, I'll set up the GitHub integration, so that a push triggers a new build in Jenkins. 
 
Navigate to “​Webhooks & Services​” under “​Settings”​ on the GitHub repository page. 
You’ll need to be a repo admin to do this. 
 
Click “​Configure services​” and select the “​Jenkins (GitHub plugin)” ​option. 
 
Enter the address to your Jenkins server followed by ​/github­webhook/​ (for example 
http://psdd.t.proxylocal.com​/github­webhook/​   or ​http://​x.x.x.x:8080/​github­webhook/​ ​), check 
“Active” and update your settings. 
 
That’s it. Try it out by pushing a commit to GitHub and verifying that a new build is triggered in 
Jenkins. 
 
 
    HardwareRequirementsForJenkins
 
As for your hardware questions we do not typically recommend best practices or hardware 
configurations because these vary based off specific customer needs and these are considered 
consulting questions. Jenkins Enterprise by definition runs exactly the same as OSS Jenkins. 
Here are some generic guidelines we sent out to a specific customer that has a sizable config: 
The machine requirements on Jenkins installations differ based on the artifacts generated. 
Thus, there is no one­size fits all recommendation that we provide. However, here are some 
guidelines: 
1. Everything runs off JENKINS_HOME, so make sure there is enough disk space 
available and the disk can grow. If you run out of disk space, you will see failures. Some 
plugins take more space than others (e.g a report generating plugin vs a build plugin). 
The disk usage plugin helps determine usage. 
2. Have a beefy machine for Jenkins master & do not run slaves on the master machine. 
Every slave has certain memory allocated in the master JVM, so the bigger the RAM for 
the master, the better it is. We typically hear customers allocate 16G or so. 
3. Slaves tend to be run of the mill x86 boxes, typically you want them to have the same 
OS as the release platforms. 
For reference,​ ​this​ presentation from Redhat shares their typical memory/machine 
requirements. 
As for the HA feature this is simply two (or more) masters sharing the same 
JENKINS_HOME—you can read more about the plugin​ ​here​. 
 
To Force restart jenkins 
1. sometimes jenkins goes out of memory exception.  ​sudo service jenkins restart 
donot work then . to we have to kill the java process manually . 
2. sudo netstat ­lpn | grep :8080 # jenkins run on 8080 port 
3. sudo kill ­9 pid 
4. sudo service jenkins start 
 
 
User id  / Password  for test purpose 
user : jenkins 
password : yourPassword 
 
 
               ============== ​THANK YOU ​=============== 
 

More Related Content

PPTX
Continuous Integration for Beginners
Yüce Çelikel
 
PPTX
Keeping Your CI/CD Pipeline as Fast as It Needs to Be
Abraham Marin-Perez
 
PPT
Continuous integration
amscanne
 
PPTX
Continuous integration with Jenkins
Mohammad Hossein Rimaz
 
PPTX
Introduction to Continuous Integration with Jenkins
Brice Argenson
 
PPTX
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
CloudBees
 
PPTX
Jenkins - From Continuous Integration to Continuous Delivery
Virendra Bhalothia
 
PDF
Yale Jenkins Show and Tell
E. Camden Fisher
 
Continuous Integration for Beginners
Yüce Çelikel
 
Keeping Your CI/CD Pipeline as Fast as It Needs to Be
Abraham Marin-Perez
 
Continuous integration
amscanne
 
Continuous integration with Jenkins
Mohammad Hossein Rimaz
 
Introduction to Continuous Integration with Jenkins
Brice Argenson
 
Jumping from Continuous Integration to Continuous Delivery with Jenkins Enter...
CloudBees
 
Jenkins - From Continuous Integration to Continuous Delivery
Virendra Bhalothia
 
Yale Jenkins Show and Tell
E. Camden Fisher
 

What's hot (20)

PDF
Jfokus 2017 - The DevOps Disaster
Bert Jan Schrijver
 
PDF
Jenkins CI
haochenglee
 
PDF
Devops | CICD Pipeline
Binish Siddiqui
 
PPTX
Jenkins Introduction
Pavan Gupta
 
ZIP
Continuous Integration, Build Pipelines and Continuous Deployment
Christopher Read
 
PPT
Part 2 improving your software development v1.0
Jasmine Conseil
 
PDF
Continuous integration and delivery
Danilo Pianini
 
PPTX
Flusso Continuous Integration & Continuous Delivery
Joost van der Griendt
 
PPTX
Continuous integration using jenkins
Vinay H G
 
PPTX
不只自動化而且更敏捷的Android開發工具 gradle
sam chiu
 
PDF
Jenkins tutorial
HarikaReddy115
 
PPTX
Jenkins CI
Viyaan Jhiingade
 
PPTX
Dev-QA-Ops UNICOM WCNGT 2014 Bangalore
Manoj Jain
 
PDF
Standardizing Jenkins with CloudBees Jenkins Team
Deborah Schalm
 
PDF
Let’s start Continuous Integration with jenkins
Tomohide Kakeya
 
PPTX
Continuous integration
Yoshan madhumal
 
PDF
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Troublemaker Khunpech
 
PPT
Continuous Integration (Jenkins/Hudson)
Dennys Hsieh
 
PDF
Introducing CI/CD to Engineering Teams - By: Matt Brunsdon
Matt Brunsdon
 
PDF
OpenTuesday: Aktuelle Standards der agilen Softwareentwicklung
Digicomp Academy AG
 
Jfokus 2017 - The DevOps Disaster
Bert Jan Schrijver
 
Jenkins CI
haochenglee
 
Devops | CICD Pipeline
Binish Siddiqui
 
Jenkins Introduction
Pavan Gupta
 
Continuous Integration, Build Pipelines and Continuous Deployment
Christopher Read
 
Part 2 improving your software development v1.0
Jasmine Conseil
 
Continuous integration and delivery
Danilo Pianini
 
Flusso Continuous Integration & Continuous Delivery
Joost van der Griendt
 
Continuous integration using jenkins
Vinay H G
 
不只自動化而且更敏捷的Android開發工具 gradle
sam chiu
 
Jenkins tutorial
HarikaReddy115
 
Jenkins CI
Viyaan Jhiingade
 
Dev-QA-Ops UNICOM WCNGT 2014 Bangalore
Manoj Jain
 
Standardizing Jenkins with CloudBees Jenkins Team
Deborah Schalm
 
Let’s start Continuous Integration with jenkins
Tomohide Kakeya
 
Continuous integration
Yoshan madhumal
 
CI/CD with Jenkins and Docker - DevOps Meetup Day Thailand
Troublemaker Khunpech
 
Continuous Integration (Jenkins/Hudson)
Dennys Hsieh
 
Introducing CI/CD to Engineering Teams - By: Matt Brunsdon
Matt Brunsdon
 
OpenTuesday: Aktuelle Standards der agilen Softwareentwicklung
Digicomp Academy AG
 
Ad

Viewers also liked (15)

PPTX
Урок БП: Параллели истории
Unification_Ru
 
PDF
Kansalaisopistot somessa
Johanna Janhonen
 
PPT
WeTalk 01, English Environment, 20160507
Duy (Donald) DOAN
 
DOCX
Raghavendra Prasad Reddy_resume
Raghavendra Prasad Reddy
 
PDF
farouk cv ..
Farouk Ahlawy
 
PDF
Vy Le_Goldman Sachs Stock Valuatio Project
Vy Le
 
PDF
Oppimisen tilat – näkökulmia tulevaisuuden kouluun ja oppilaitosrakentamiseen
Satu Aksovaara
 
PPTX
Medialunas de panaderia
Marcos Holgado
 
PPTX
Necesidades educativas especiales
JosselineCC
 
DOCX
Mohamed Abdel Aziz CV 2015
Mohamed Abdelkarim
 
PDF
第4回 Machine Learning 15minutes!
XCompass
 
PPTX
Genres Of Music During Spanish Time
teruzmo_647
 
DOC
s.chand-CURRICULUM VITAE
shree chand
 
PPTX
TALLER NECESIDADES EDUCATIVAS ESPECIALES
PSICOLOGIA Y EDUCACION INTEGRAL A.C.
 
PPTX
Placenta y Membranas Fetales
Elda Soto
 
Урок БП: Параллели истории
Unification_Ru
 
Kansalaisopistot somessa
Johanna Janhonen
 
WeTalk 01, English Environment, 20160507
Duy (Donald) DOAN
 
Raghavendra Prasad Reddy_resume
Raghavendra Prasad Reddy
 
farouk cv ..
Farouk Ahlawy
 
Vy Le_Goldman Sachs Stock Valuatio Project
Vy Le
 
Oppimisen tilat – näkökulmia tulevaisuuden kouluun ja oppilaitosrakentamiseen
Satu Aksovaara
 
Medialunas de panaderia
Marcos Holgado
 
Necesidades educativas especiales
JosselineCC
 
Mohamed Abdel Aziz CV 2015
Mohamed Abdelkarim
 
第4回 Machine Learning 15minutes!
XCompass
 
Genres Of Music During Spanish Time
teruzmo_647
 
s.chand-CURRICULUM VITAE
shree chand
 
TALLER NECESIDADES EDUCATIVAS ESPECIALES
PSICOLOGIA Y EDUCACION INTEGRAL A.C.
 
Placenta y Membranas Fetales
Elda Soto
 
Ad

Similar to JenkinsCIdocumentations-removedcredentials.docx (20)

PPTX
Continuous Integration
Robert Watts
 
PPT
Introduction to continuous integration
Philip Johnson
 
PDF
CONTINUOUS INTEGRATION WITH JENKINS AND GIT
Benjamin Lutaaya
 
ODP
Ci Basics & Jenkins
Jenna Pederson
 
PPTX
CI CD using Docker and Jenkins
Sukant Kumar
 
PDF
Jenkins
penetration Tester
 
PDF
Continuous Integration Introduction
Fáber D. Giraldo
 
PPTX
Continuous Integration (& Mr Jenkins)
Ciro Donato Caiazzo
 
PPTX
Lets talk about CI CD Pipeline in Agile
Poonam Panday
 
ODP
Continous integration
Jeremy Wilken
 
PPTX
Jenkins
Sunil Komarapu
 
PPTX
Jenkins Build System
Khan625
 
PPTX
Jenkins
Shahid Shaik
 
PPTX
Jenkins
Hasan Syed
 
PDF
Introduction to Continuous Integration
Hùng Nguyễn Huy
 
ODP
Learn Continuous Integration with Jenkins All in One Guide
Sam Dias
 
PDF
Quickstart for continuous integration
Fabricio Epaminondas
 
PDF
Continuous integration & Continuous Delivery @DeVz
Denis Ristic
 
PPTX
Contineous integration
Radhakrishna Mutthoju
 
DOCX
Continuous Integration
Chandra Sabbavarpu
 
Continuous Integration
Robert Watts
 
Introduction to continuous integration
Philip Johnson
 
CONTINUOUS INTEGRATION WITH JENKINS AND GIT
Benjamin Lutaaya
 
Ci Basics & Jenkins
Jenna Pederson
 
CI CD using Docker and Jenkins
Sukant Kumar
 
Continuous Integration Introduction
Fáber D. Giraldo
 
Continuous Integration (& Mr Jenkins)
Ciro Donato Caiazzo
 
Lets talk about CI CD Pipeline in Agile
Poonam Panday
 
Continous integration
Jeremy Wilken
 
Jenkins Build System
Khan625
 
Jenkins
Shahid Shaik
 
Jenkins
Hasan Syed
 
Introduction to Continuous Integration
Hùng Nguyễn Huy
 
Learn Continuous Integration with Jenkins All in One Guide
Sam Dias
 
Quickstart for continuous integration
Fabricio Epaminondas
 
Continuous integration & Continuous Delivery @DeVz
Denis Ristic
 
Contineous integration
Radhakrishna Mutthoju
 
Continuous Integration
Chandra Sabbavarpu
 

JenkinsCIdocumentations-removedcredentials.docx