SlideShare a Scribd company logo
1 of 54
2015
CI/CD Overview
Lakshmi Easuwaran
3-Dec-2015
#GHCI15
2015
2015
Agenda
 What is DevOps, continuous delivery and
continuous deployment
 Key underlying Principles
 Various tools & technologies in various phases
 Case study
 Books to read
2015
2015
2015
2015
BUILD
IN
2015
2015
2015
2015
Various tools & technologies
2015
Case Study
 Test strategy (Agile test pyramid)
 How long does compilation take?
 Dev productivity tools
 Automated Infrastructure
 SMS/text messaging notifications
2015
Case study - Agile test pyramid
Back
2015
Books to read
 Continuous delivery by Jezz Humble and David
Farley
 The phoenix project by Gene Kim, Kevin Behr,
George Spafford
2015
Open Source Solution
for
Continuous Delivery-
Git Gerrit and Jenkins
Mythri P K
3-Dec-2015
#GHCI15
2015
2015
GIT – Why Version Control?
 Allows developers to work simultaneously
 No overwriting
 History is maintained
2015
GIT - WHAT
 Developed by Linus Torvalds in 2005
 It is under GPL License.
 It is a revision control system focused on speed
and efficiency
 Core is written in C.
 Compress and stores data hence memory foot
print is low
 Distributed version control system - avoids single
point failure
2015
GIT - Workflow
2015
GERRIT – WHY CODE REVIEW ?
 Early error detection
 Conformation to the source code standards
 Helps to keep code readable and easier to
maintain
 Knowledge exchange
 Shared code ownership
2015
GERRIT- WHAT
 Gerrit is a web based code review system
 Gerrit is a Git server
 Gerrit fine grained access control system
through ssh
 Gerrit is licensed under the Apache 2.0
license.
 Gerrit is based on Google Web Toolkit
2015
GERRIT - WORKFLOW
 Push the change to the Gerrit review system
to create a change for the master branch.
 On Improvement fetch the latest changes and
rebase patch.
Working
Tree
Local
Repository
Remote
Repository
Pull/fetch
Gerrit
Server
Push for review
Local Machine
On successful
Build and Review
2015
JENKINS – WHAT ?
 Jenkins is a cross-platform, continuous
integration and continuous
delivery application
 It is a server based system build and test tool.
 Released under the MIT License
2015
JENKINS – WHY ?
 Build problems are detected immediately by
automatic test builds.
 Checks for compile time errors and runs a test
suite.
2015
CONTINOUS INTEGRATION – HOW
?
Working
Tree
Local Repository
Remote
Repository
Pull/fetch
Gerrit
Server
Push for review
Local Machine
On successful
Build and Review
Jenkins
CI
Auto Build on Submission
Verified on successful build
2015
Git- Workflow
Mythri P K
3-Dec-2015
#GHCI15
2015
2015
Git- Glossary
 Tree: Directory with files (blobs) and
subdirectories (trees)
 Clone: Copy remote repository to local directory
 Head: Currently checked out commit
 Branch: Label given to commit for different line of
development
 Master: Main Branch
 Patch: Commit exported into text format
2015
Git
2015
Git – Push, Pull & Fetch
 Git clone (Clone a repository
into a new directory)
 git fetch (Download objects
and refs from another
repository)
 git pull(Fetch from and
integrate with another
repository or a local branch)
 git push (Update remote refs
along with associated objects)
2015
Git - Branches
 git checkout (To Switch
branches or restore
working tree files)
• –b <branch name>
 git –D <branch name >
(To Delete a branch)
 git branch –a (To List all
branches)
2015
Git- Commits
 git log (show commit logs)
− git log –oneline
− git log –author = “name”
− git log --oneline --date-order -
-graph --all –decorate
 git whatchanged --since= "2
weeks ago“ (Show logs with
difference each commit
introduces)
 git-grep (Print lines matching a
pattern)
2015
Git- Add & commit
 git add <filename> (Add file
contents to the index)
 git commit (Record changes
to the repository)
− git commit –amend
 git rebase (To rearrange
series)
− -i (Interactive)
 git format-patch (To make
change as patch)
2015
Git- Diff, Status & Reset
 git diff (changes between
two commits/ commit &
working Tree)
− git diff –cached.
− git diff –stat
 git status –a (working tree
status)
 git reset ( Reset current
HEAD to the specified state)
− –soft filename
− –hard
2015
Git – Additional commands
 git stash
− git stash pop (To go back to the stashed state, works
like a stack)
− git stash list
 git merge-tool
 Git revert ( Revert a commit)
 Git tag ( To tag a significant commit)
 git-bisect
− Git-bisect visualize
2015
References
 http://gitref.org/
 https://git-scm.com/docs/git-checkout
2015
Open Source Solution
for
Continuous Delivery
Git Gerrit and Jenkins
DEMO
Vinaya
3 Dec 2015
#GHCI15
2015
2015
Github & Gerrithub setup
 Create Github account
https://github.com/
 Login to gerrithub.io using same github account
http://gerrithub.io/
 Open the git bash or Linux terminal
sudo su <username>
cd /home/<username>
 Generate ssh key using following command:
ssh-keygen –t rsa –b 4096 –C <user email id>
This creates id_rsa.pub file in ~/.ssh directory
 Copy id_rsa.pub content and paste it in “Add SSH Public Key” in the gerrithub link
https://review.gerrithub.io/#/settings/ssh-keys
2015
Github & Gerrithub setup
2015
Github & Gerrithub setup
 Git comes with a tool called git config that lets you get and set configuration variables that
control all aspects of how Git looks and operates
 Set identity
− git config --global user.name “Full Name”
− git config --global user.email mailid
 Checking Your Settings
− git config --list
 Checking value of a config key
− git config <key>
− Eg. git config user.name
2015
Jenkins Setup
 Jenkins installation link:
https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins
Jenkins server used for demo & workshop: 10.197.24.59:8081
2015
Jenkins plugins
 Install required Jenkins plugins
using “Manage Plugins” and
configure Jenkins server using
“Configure System”
 Following Jenkins Plugins
required for git and gerrit :
GIT plugin
Hudson Gerrit plugin
Gerrit trigger plugin
Build Environment
GitHub Pull Request Builder
Delivery Pipeline Plugin
2015
Jenkins Configuration
 Following settings required in Jenkins configure system:
 Path to Git executable: Mention the path to GIT executable.
 Update Jenkins URL as below:
2015
Jenkins Configuration
 Set up GitHub Pull Request Builder:
 Configuration of credentials
Username: Github username
Password: gerrithub http password (https://review.gerrithub.io/#/settings/http-password)
ID: Same as username
2015
Configuration of gerrit trigger
 Manage Jenkins Gerrit Trigger:
 Select “Add New Server” and configure the gerrit server as below:
Note: SSH Keyfile Password should be left blank. It is generated automatically
when pressed “Test connection”. The Test connection should be successful.
2015
Jenkins new job configuration
 Open Jenkins URL
 Configure Source Code Management for created new job as follows:
2015
Jenkins new job configuration
 Configure Build Triggers as follows:
2015
Jenkins new job configuration
 Configure Build as follows:
 Select “Execute Shell” option from drop down and mention the build commands.
 Save the configuration by selecting “Save” option at the bottom.
2015
GIT, GERRIT, JENKINS flow
 Log in to gerrithub http://gerrithub.io/
 Filter the project “VinayaNP/ghci_ws_1” and select the same.
 Clone the project by copying the command highlighted below.
2015
GIT, GERRIT, JENKINS flow
 Open the Linux terminal.
 Create directory for the project.
 mkdir workshop
 cd workshop
 Clone the project VinayaNP/ghci_ws_1 by using command copied from gerrithub.
 The ghci_ws_1 project will be available in your directory.
 Edit the file from sample directory:
2015
GIT, GERRIT, JENKINS flow
 Check git status:
 Give following commands to push the changes to gerrithub for review & verification:
git add <filename>
git commit –m <commit message>
git pull
Resolve the conflicts if you get any merge conflict.
git push origin HEAD:refs/for/master
2015
GIT, GERRIT, JENKINS flow
 Give the http password from gerrithub settings:
https://review.gerrithub.io/#/settings/http-password
 The Jenkins job (e.g. Java_junit) will get triggered.
2015
GIT, GERRIT, JENKINS flow
 Once the build is complete, the status of the build is updated as blue (successful build) or red
ball (Failed build). The test result graph is also displayed.
2015
GIT, GERRIT, JENKINS flow
 Go to gerrithub and check status of project:
If the build is successful, verification will get +1.
If the build is Fails, verification will get -1.
Further when Reviewer gives “Code-Review+2”, the changes can be submitted to github.
2015
Delivery Pipeline
2015
Thank You!
2015
Got Feedback?
Rate and review the session on our mobile app – Convene
For all details visit: http://ghcindia.anitaborg.org

More Related Content

What's hot

Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012msohn
 
Gerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI DemonstrationGerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI Demonstrationvanoorts
 
Git and Gerrit Code Review - Tech Talk - 2010_09_23
Git and Gerrit Code Review - Tech Talk - 2010_09_23Git and Gerrit Code Review - Tech Talk - 2010_09_23
Git and Gerrit Code Review - Tech Talk - 2010_09_23msohn
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierChristoph Matthies
 
Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...
Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...
Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...DevOps4Networks
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productiveKarsten Dambekalns
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowMikhail Melnik
 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginLuca Milanesio
 
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...Edureka!
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucketMedhat Dawoud
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGeoff Hoffman
 
Git slides
Git slidesGit slides
Git slidesNanyak S
 

What's hot (20)

Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
Large Scale Development with Git and Gerrit - EclipseCon Europe 2012
 
Gerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI DemonstrationGerrit & Jenkins Workflow: An Integrated CI Demonstration
Gerrit & Jenkins Workflow: An Integrated CI Demonstration
 
Git and Gerrit Code Review - Tech Talk - 2010_09_23
Git and Gerrit Code Review - Tech Talk - 2010_09_23Git and Gerrit Code Review - Tech Talk - 2010_09_23
Git and Gerrit Code Review - Tech Talk - 2010_09_23
 
Git and git flow
Git and git flowGit and git flow
Git and git flow
 
Git presentation
Git presentationGit presentation
Git presentation
 
Git Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easierGit Tricks — git utilities that make life git easier
Git Tricks — git utilities that make life git easier
 
Git
GitGit
Git
 
Git 101
Git 101Git 101
Git 101
 
Git Pull Requests
Git Pull RequestsGit Pull Requests
Git Pull Requests
 
Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...
Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...
Test-Driven-Development for Networking: Making CI Work for You by Colin McNam...
 
How Git and Gerrit make you more productive
How Git and Gerrit make you more productiveHow Git and Gerrit make you more productive
How Git and Gerrit make you more productive
 
Git best practices workshop
Git best practices workshopGit best practices workshop
Git best practices workshop
 
Git Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-FlowGit Series. Episode 3. Git Flow and Github-Flow
Git Series. Episode 3. Git Flow and Github-Flow
 
Git & Github
Git & GithubGit & Github
Git & Github
 
Gerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub pluginGerrit Code Review with GitHub plugin
Gerrit Code Review with GitHub plugin
 
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
Git Tutorial | Git Basics - Branching, Merging, Rebasing | Learn Git | DevOps...
 
Using Git and BitBucket
Using Git and BitBucketUsing Git and BitBucket
Using Git and BitBucket
 
Git 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using GitGit 101 - Crash Course in Version Control using Git
Git 101 - Crash Course in Version Control using Git
 
Introducing GitLab
Introducing GitLabIntroducing GitLab
Introducing GitLab
 
Git slides
Git slidesGit slides
Git slides
 

Viewers also liked

From Protection to Production: Impacts of the Ghana LEAP programme at communi...
From Protection to Production: Impacts of the Ghana LEAP programme at communi...From Protection to Production: Impacts of the Ghana LEAP programme at communi...
From Protection to Production: Impacts of the Ghana LEAP programme at communi...FAO
 
COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...
COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...
COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...EscapadaRural
 
Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]
Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]
Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]Netex Learning
 
Carlos guardado cambio_climático
Carlos guardado cambio_climáticoCarlos guardado cambio_climático
Carlos guardado cambio_climáticoCarlos Guardado
 
Resultats v cursa del sol son servera
Resultats v cursa del sol son serveraResultats v cursa del sol son servera
Resultats v cursa del sol son serveraJesus Estan
 
Vray manual para interiores
Vray manual para interioresVray manual para interiores
Vray manual para interioresAdrian M.
 
Catalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.com
Catalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.comCatalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.com
Catalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.comBeeteco
 
Kelly Services
Kelly ServicesKelly Services
Kelly Serviceslpearson
 
Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2
Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2
Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2Sergio Samoilovich
 
Instruction Manual ARMASIGHT SPARK NV Monocular | Optics Trade
Instruction Manual ARMASIGHT SPARK NV Monocular | Optics TradeInstruction Manual ARMASIGHT SPARK NV Monocular | Optics Trade
Instruction Manual ARMASIGHT SPARK NV Monocular | Optics TradeOptics-Trade
 
Causas del tunel carpiano - Por que surge el Sindrome del tunel del carpo
Causas  del tunel carpiano - Por que surge el Sindrome del tunel del carpoCausas  del tunel carpiano - Por que surge el Sindrome del tunel del carpo
Causas del tunel carpiano - Por que surge el Sindrome del tunel del carpoPako Aguilar
 
Intellectual Capital Management
Intellectual Capital ManagementIntellectual Capital Management
Intellectual Capital ManagementElijah Ezendu
 
Educational Services Sector
Educational Services SectorEducational Services Sector
Educational Services SectorArjun Rajan
 

Viewers also liked (20)

Emprin
EmprinEmprin
Emprin
 
Eurojoint hc omega
Eurojoint hc omegaEurojoint hc omega
Eurojoint hc omega
 
From Protection to Production: Impacts of the Ghana LEAP programme at communi...
From Protection to Production: Impacts of the Ghana LEAP programme at communi...From Protection to Production: Impacts of the Ghana LEAP programme at communi...
From Protection to Production: Impacts of the Ghana LEAP programme at communi...
 
COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...
COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...
COETUR 2014: Nuevas reglas de juego para generar negocio en redes sociales y ...
 
Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]
Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]
Netex learningMaker | Herramienta autora de contenidos e-learning en HTML5 [ES]
 
Carlos guardado cambio_climático
Carlos guardado cambio_climáticoCarlos guardado cambio_climático
Carlos guardado cambio_climático
 
Resultats v cursa del sol son servera
Resultats v cursa del sol son serveraResultats v cursa del sol son servera
Resultats v cursa del sol son servera
 
Dyna85
Dyna85Dyna85
Dyna85
 
Vray manual para interiores
Vray manual para interioresVray manual para interiores
Vray manual para interiores
 
Catalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.com
Catalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.comCatalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.com
Catalog Inverter FR-E700 instruction manual (basic) Mitsubishi-Beeteco.com
 
Tesina narrativa multimedia
Tesina narrativa multimediaTesina narrativa multimedia
Tesina narrativa multimedia
 
Kelly Services
Kelly ServicesKelly Services
Kelly Services
 
Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2
Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2
Historia clinica digital - sistema OpenEMR - instructivo de uso - Parte 2
 
Prezentacja
PrezentacjaPrezentacja
Prezentacja
 
Ccnpv7 routing-ch.3
Ccnpv7 routing-ch.3Ccnpv7 routing-ch.3
Ccnpv7 routing-ch.3
 
Instruction Manual ARMASIGHT SPARK NV Monocular | Optics Trade
Instruction Manual ARMASIGHT SPARK NV Monocular | Optics TradeInstruction Manual ARMASIGHT SPARK NV Monocular | Optics Trade
Instruction Manual ARMASIGHT SPARK NV Monocular | Optics Trade
 
Causas del tunel carpiano - Por que surge el Sindrome del tunel del carpo
Causas  del tunel carpiano - Por que surge el Sindrome del tunel del carpoCausas  del tunel carpiano - Por que surge el Sindrome del tunel del carpo
Causas del tunel carpiano - Por que surge el Sindrome del tunel del carpo
 
Intellectual Capital Management
Intellectual Capital ManagementIntellectual Capital Management
Intellectual Capital Management
 
SAP grc
SAP grc SAP grc
SAP grc
 
Educational Services Sector
Educational Services SectorEducational Services Sector
Educational Services Sector
 

Similar to 2015-ghci-presentation-git_gerritJenkins_final

Version control git day02
Version control   git day02Version control   git day02
Version control git day02Gourav Varma
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03Gourav Varma
 
Version control git day03(amarnath dada)
Version control   git day03(amarnath dada)Version control   git day03(amarnath dada)
Version control git day03(amarnath dada)Gourav Varma
 
Introduction to Git for Force.com Developers
Introduction to Git for Force.com DevelopersIntroduction to Git for Force.com Developers
Introduction to Git for Force.com DevelopersSalesforce Developers
 
Dreamforce 13 developer session: Git for Force.com developers
Dreamforce 13 developer session: Git for Force.com developersDreamforce 13 developer session: Git for Force.com developers
Dreamforce 13 developer session: Git for Force.com developersJohn Stevenson
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing selfChen-Tien Tsai
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03Gourav Varma
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with gitDídac Ríos
 
Git/Gerrit with TeamForge
Git/Gerrit with TeamForgeGit/Gerrit with TeamForge
Git/Gerrit with TeamForgeCollabNet
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?9 series
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and GithubWycliff1
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting StartedWildan Maulana
 

Similar to 2015-ghci-presentation-git_gerritJenkins_final (20)

Version control git day02
Version control   git day02Version control   git day02
Version control git day02
 
Git & GitLab
Git & GitLabGit & GitLab
Git & GitLab
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Version control git day03(amarnath dada)
Version control   git day03(amarnath dada)Version control   git day03(amarnath dada)
Version control git day03(amarnath dada)
 
Github By Nyros Developer
Github By Nyros DeveloperGithub By Nyros Developer
Github By Nyros Developer
 
Introduction to Git for Force.com Developers
Introduction to Git for Force.com DevelopersIntroduction to Git for Force.com Developers
Introduction to Git for Force.com Developers
 
Dreamforce 13 developer session: Git for Force.com developers
Dreamforce 13 developer session: Git for Force.com developersDreamforce 13 developer session: Git for Force.com developers
Dreamforce 13 developer session: Git for Force.com developers
 
Introduction to git & github
Introduction to git & githubIntroduction to git & github
Introduction to git & github
 
Git essential training & sharing self
Git essential training & sharing selfGit essential training & sharing self
Git essential training & sharing self
 
Version control git day03
Version control   git day03Version control   git day03
Version control git day03
 
Improving your workflow with git
Improving your workflow with gitImproving your workflow with git
Improving your workflow with git
 
Git introduction
Git introductionGit introduction
Git introduction
 
Git collaboration
Git collaborationGit collaboration
Git collaboration
 
Git/Gerrit with TeamForge
Git/Gerrit with TeamForgeGit/Gerrit with TeamForge
Git/Gerrit with TeamForge
 
Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?Git Commands Every Developer Should Know?
Git Commands Every Developer Should Know?
 
GIT By Sivakrishna
GIT By SivakrishnaGIT By Sivakrishna
GIT By Sivakrishna
 
Git and Github - A primer
Git and Github - A primerGit and Github - A primer
Git and Github - A primer
 
Introduction to git and Github
Introduction to git and GithubIntroduction to git and Github
Introduction to git and Github
 
Git Workshop : Getting Started
Git Workshop : Getting StartedGit Workshop : Getting Started
Git Workshop : Getting Started
 
Git workshop
Git workshopGit workshop
Git workshop
 

2015-ghci-presentation-git_gerritJenkins_final

  • 2. 2015 Agenda  What is DevOps, continuous delivery and continuous deployment  Key underlying Principles  Various tools & technologies in various phases  Case study  Books to read
  • 10. 2015 Various tools & technologies
  • 11. 2015 Case Study  Test strategy (Agile test pyramid)  How long does compilation take?  Dev productivity tools  Automated Infrastructure  SMS/text messaging notifications
  • 12. 2015 Case study - Agile test pyramid Back
  • 13. 2015 Books to read  Continuous delivery by Jezz Humble and David Farley  The phoenix project by Gene Kim, Kevin Behr, George Spafford
  • 14. 2015 Open Source Solution for Continuous Delivery- Git Gerrit and Jenkins Mythri P K 3-Dec-2015 #GHCI15 2015
  • 15. 2015 GIT – Why Version Control?  Allows developers to work simultaneously  No overwriting  History is maintained
  • 16. 2015 GIT - WHAT  Developed by Linus Torvalds in 2005  It is under GPL License.  It is a revision control system focused on speed and efficiency  Core is written in C.  Compress and stores data hence memory foot print is low  Distributed version control system - avoids single point failure
  • 18. 2015 GERRIT – WHY CODE REVIEW ?  Early error detection  Conformation to the source code standards  Helps to keep code readable and easier to maintain  Knowledge exchange  Shared code ownership
  • 19. 2015 GERRIT- WHAT  Gerrit is a web based code review system  Gerrit is a Git server  Gerrit fine grained access control system through ssh  Gerrit is licensed under the Apache 2.0 license.  Gerrit is based on Google Web Toolkit
  • 20. 2015 GERRIT - WORKFLOW  Push the change to the Gerrit review system to create a change for the master branch.  On Improvement fetch the latest changes and rebase patch. Working Tree Local Repository Remote Repository Pull/fetch Gerrit Server Push for review Local Machine On successful Build and Review
  • 21. 2015 JENKINS – WHAT ?  Jenkins is a cross-platform, continuous integration and continuous delivery application  It is a server based system build and test tool.  Released under the MIT License
  • 22. 2015 JENKINS – WHY ?  Build problems are detected immediately by automatic test builds.  Checks for compile time errors and runs a test suite.
  • 23. 2015 CONTINOUS INTEGRATION – HOW ? Working Tree Local Repository Remote Repository Pull/fetch Gerrit Server Push for review Local Machine On successful Build and Review Jenkins CI Auto Build on Submission Verified on successful build
  • 24. 2015 Git- Workflow Mythri P K 3-Dec-2015 #GHCI15 2015
  • 25. 2015 Git- Glossary  Tree: Directory with files (blobs) and subdirectories (trees)  Clone: Copy remote repository to local directory  Head: Currently checked out commit  Branch: Label given to commit for different line of development  Master: Main Branch  Patch: Commit exported into text format
  • 27. 2015 Git – Push, Pull & Fetch  Git clone (Clone a repository into a new directory)  git fetch (Download objects and refs from another repository)  git pull(Fetch from and integrate with another repository or a local branch)  git push (Update remote refs along with associated objects)
  • 28. 2015 Git - Branches  git checkout (To Switch branches or restore working tree files) • –b <branch name>  git –D <branch name > (To Delete a branch)  git branch –a (To List all branches)
  • 29. 2015 Git- Commits  git log (show commit logs) − git log –oneline − git log –author = “name” − git log --oneline --date-order - -graph --all –decorate  git whatchanged --since= "2 weeks ago“ (Show logs with difference each commit introduces)  git-grep (Print lines matching a pattern)
  • 30. 2015 Git- Add & commit  git add <filename> (Add file contents to the index)  git commit (Record changes to the repository) − git commit –amend  git rebase (To rearrange series) − -i (Interactive)  git format-patch (To make change as patch)
  • 31. 2015 Git- Diff, Status & Reset  git diff (changes between two commits/ commit & working Tree) − git diff –cached. − git diff –stat  git status –a (working tree status)  git reset ( Reset current HEAD to the specified state) − –soft filename − –hard
  • 32. 2015 Git – Additional commands  git stash − git stash pop (To go back to the stashed state, works like a stack) − git stash list  git merge-tool  Git revert ( Revert a commit)  Git tag ( To tag a significant commit)  git-bisect − Git-bisect visualize
  • 34. 2015 Open Source Solution for Continuous Delivery Git Gerrit and Jenkins DEMO Vinaya 3 Dec 2015 #GHCI15 2015
  • 35. 2015 Github & Gerrithub setup  Create Github account https://github.com/  Login to gerrithub.io using same github account http://gerrithub.io/  Open the git bash or Linux terminal sudo su <username> cd /home/<username>  Generate ssh key using following command: ssh-keygen –t rsa –b 4096 –C <user email id> This creates id_rsa.pub file in ~/.ssh directory  Copy id_rsa.pub content and paste it in “Add SSH Public Key” in the gerrithub link https://review.gerrithub.io/#/settings/ssh-keys
  • 37. 2015 Github & Gerrithub setup  Git comes with a tool called git config that lets you get and set configuration variables that control all aspects of how Git looks and operates  Set identity − git config --global user.name “Full Name” − git config --global user.email mailid  Checking Your Settings − git config --list  Checking value of a config key − git config <key> − Eg. git config user.name
  • 38. 2015 Jenkins Setup  Jenkins installation link: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins Jenkins server used for demo & workshop: 10.197.24.59:8081
  • 39. 2015 Jenkins plugins  Install required Jenkins plugins using “Manage Plugins” and configure Jenkins server using “Configure System”  Following Jenkins Plugins required for git and gerrit : GIT plugin Hudson Gerrit plugin Gerrit trigger plugin Build Environment GitHub Pull Request Builder Delivery Pipeline Plugin
  • 40. 2015 Jenkins Configuration  Following settings required in Jenkins configure system:  Path to Git executable: Mention the path to GIT executable.  Update Jenkins URL as below:
  • 41. 2015 Jenkins Configuration  Set up GitHub Pull Request Builder:  Configuration of credentials Username: Github username Password: gerrithub http password (https://review.gerrithub.io/#/settings/http-password) ID: Same as username
  • 42. 2015 Configuration of gerrit trigger  Manage Jenkins Gerrit Trigger:  Select “Add New Server” and configure the gerrit server as below: Note: SSH Keyfile Password should be left blank. It is generated automatically when pressed “Test connection”. The Test connection should be successful.
  • 43. 2015 Jenkins new job configuration  Open Jenkins URL  Configure Source Code Management for created new job as follows:
  • 44. 2015 Jenkins new job configuration  Configure Build Triggers as follows:
  • 45. 2015 Jenkins new job configuration  Configure Build as follows:  Select “Execute Shell” option from drop down and mention the build commands.  Save the configuration by selecting “Save” option at the bottom.
  • 46. 2015 GIT, GERRIT, JENKINS flow  Log in to gerrithub http://gerrithub.io/  Filter the project “VinayaNP/ghci_ws_1” and select the same.  Clone the project by copying the command highlighted below.
  • 47. 2015 GIT, GERRIT, JENKINS flow  Open the Linux terminal.  Create directory for the project.  mkdir workshop  cd workshop  Clone the project VinayaNP/ghci_ws_1 by using command copied from gerrithub.  The ghci_ws_1 project will be available in your directory.  Edit the file from sample directory:
  • 48. 2015 GIT, GERRIT, JENKINS flow  Check git status:  Give following commands to push the changes to gerrithub for review & verification: git add <filename> git commit –m <commit message> git pull Resolve the conflicts if you get any merge conflict. git push origin HEAD:refs/for/master
  • 49. 2015 GIT, GERRIT, JENKINS flow  Give the http password from gerrithub settings: https://review.gerrithub.io/#/settings/http-password  The Jenkins job (e.g. Java_junit) will get triggered.
  • 50. 2015 GIT, GERRIT, JENKINS flow  Once the build is complete, the status of the build is updated as blue (successful build) or red ball (Failed build). The test result graph is also displayed.
  • 51. 2015 GIT, GERRIT, JENKINS flow  Go to gerrithub and check status of project: If the build is successful, verification will get +1. If the build is Fails, verification will get -1. Further when Reviewer gives “Code-Review+2”, the changes can be submitted to github.
  • 54. 2015 Got Feedback? Rate and review the session on our mobile app – Convene For all details visit: http://ghcindia.anitaborg.org

Editor's Notes

  1. DevOps - DevOps (a clipped compound of "development" and "operations") is a culture, movement or practice that emphasizes the collaboration and communication of both software developers and other information-technology (IT) professionals while automating the process of software delivery and infrastructure changes Continuous Delivery is a software development discipline where you build software in such a way that the software can be released to production at any time. Continuous deployment is the next step of continuous delivery: Every change that passes the automated tests is deployed to production automatically. Reliable, Repeatable, Predictable and Low cycle time
  2. CI/CD is a culture - You can’t directly change culture. But you can change behavior, and behavior becomes culture
  3. Theory of constraints - a chain is no stronger than its weakest link The Theory of Constraints is a methodology for identifying the most important limiting factor (i.e. constraint) that stands in the way of achieving a goal and then systematically improving that constraint until it is no longer the limiting factor. In manufacturing, the constraint is often referred to as a bottleneck.
  4. Question: What are the version control system you are aware of?
  5. it is a full mirror with complete working directory, Most operations happen locally quicker, Easier branching strategy
  6. git doesn't track each and every file. when you commit git looks for files in staging area only
  7. Q: How may of you can claim that you have written a bug free code all the time! Logical flaws can be spotted by the human reviewer before any code is merged
  8. If you push to Gerrit, you use a certain path (ref specification) which tells Gerrit that you want to create a change Gerrit uses the Change-Id information in the commit message to identify if the push is a new commit or an update of an existing change
  9. Builds can be started by various means, including being triggered by commit in a version control system Because it is open source there are lots of plugins for use similar to android apps
  10. Show git conflict Checkpatch.pl Git rm
  11. Install Jenkins using below command: sudo apt-get install Jenkins Jenkins will be launched as a daemon up on start. Jenkins stores all the settings, logs and build artifacts in its home directory. The default installation directory is /var/lib/jenkins under Ubuntu. Log file will be placed in /var/log/jenkins/jenkins.log. Check this file if you are troubleshooting Jenkins. /etc/default/jenkins will capture configuration parameters for the launch like e.g. JENKINS_HOME If  /etc/init.d/jenkins file fails to start jenkins, edit the /etc/default/jenkins to replace the line HTTP_PORT=8080 by HTTP_PORT=8081 Here, 8081 was chosen but you can put another port available. Launch Jenkins using <Jenkins_server_IP>:8080
  12. This is the last slide and must be included in the slide deck