version control and continuous integration
DESCRIPTION
This is Greg Montaño's slides on "Version Control and Continuous Integration", which was presented at the Cebu StackOverflow Meetup on 26 May 2012.TRANSCRIPT
![Page 1: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/1.jpg)
Version Control and Continuous Integration
THE STACKOVERFLOW MEETUP – CEBUMAY 26, 2012
emxsi
![Page 2: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/2.jpg)
Introduction
• Batch, Pascal, PERL, Javascript, C++, JAVA
• DUNE2
• Shell Scripts• Modern Conflict
• University Faculty • Employee - IT Company
• I love to visit all the nearby islands of Cebu.
![Page 3: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/3.jpg)
Expectations
• Introduce version control and CI• Focus only on Subversion and Jenkins• Discuss about installation and getting started
with these tools.• Sharing of personal experiences pertaining to
the tools mentioned is also encouraged during the Q&A.
![Page 4: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/4.jpg)
Version Control
• Also known as revision control.
• According to http://www.smashingmagazine.com/ the most obvious benefit of revision control is– ability to have an unlimited number of people
working on the same code base, without having to constantly send files back and forth.
![Page 5: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/5.jpg)
Models of Version Control Software
• Local data Model
• Client-Server Model
• Distributed Model
![Page 6: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/6.jpg)
Version Control in the Market
• Proprietary– BitKeeper– PVCS– Synergy– Perforce– ClearCase– Visual SourceSafe– Rational Team Concert
![Page 7: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/7.jpg)
Version Control in the Market
• Open Source– Concurrent Versions System (CVS)– Subversion (SVN)– Distributed Concurrent Versions System (DCVS)– Bazaar – Mercurial– Git
![Page 8: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/8.jpg)
Subversion
• Triggered development by CollabNet, Inc in early 2000• Took 14 months to develop• Became part of ASF's family of top-level projects on
early 2010.
• Book titled Version Control with Subversion can be found and/or downloaded at
http://svnbook.red-bean.com/• Subversion current version is 1.7
![Page 9: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/9.jpg)
SUBVERSION'S ARCHITECTURE
![Page 10: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/10.jpg)
Subversion repository
![Page 11: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/11.jpg)
Repository access URLs Schema Access method
file:/// Direct repository access (on local disk)
http:// Access via WebDAV protocol to Subversion-aware Apache server
https:// Same as http://, but with SSL encryption
svn:// Access via custom protocol to an svnserve server
svn+ssh:// Same as svn://, but through an SSH tunnel
![Page 12: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/12.jpg)
5 steps to getting started (Version Control)
1. Download and install2. Create the repository3. Set-up authentication4. Customize (e.g. pre-commit hooks)5. Perform maintenance like backups
![Page 13: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/13.jpg)
Create the repository
• Create the directorymkdir –p /var/www/svn
• Create the repocd /var/www/svnsvnadmin create myrepo
• Access the repo via httphttp://143.143.143.143/svn/myrepo
![Page 14: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/14.jpg)
Content of subversion.conf
LoadModule dav_svn_module modules/mod_dav_svn.so
LoadModule authz_svn_module modules/mod_authz_svn.so
<Location /svn> DAV svn SVNParentPath /var/www/svn AuthType Basic AuthName "Subversion repositories" AuthUserFile /etc/httpd/svn-users.passwd Require valid-user</Location>
![Page 15: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/15.jpg)
Structure of SVN Repository
• trunk - directory to hold the “main line” of development;
• branches - directory to contain branch copies;• tags - directory to contain tag copies;
![Page 16: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/16.jpg)
Customize
• Use of hooks like pre-commit• The pre-commit hook is run just before a
commit transaction is promoted to a new revision.
• Useful for freezing a release and/or requiring for log messages before revisions are committed to the repository.
• /var/www/svn/myrepo/hooks/pre-commit
![Page 17: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/17.jpg)
Backups
• Full backupsvnadmin hotcopy /var/www/svn/myrepo ~/repo-backuptar cjvhpf repo-backup.bz2 ~/repo-backup
• Incrementalsvnadmin dump /var/www/svn/myrepo –r 143:HEAD --
incremental > `date +%s`.dump
![Page 18: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/18.jpg)
Subversion Best Practices
1. Use a sane repository layout2. Commit logical changesets3. Use the issue-tracker wisely4. Provide meaningful log message5. Know when to branch
![Page 19: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/19.jpg)
Continuous Integration (CI)
• implements continuous processes of applying quality control — small pieces of effort, applied frequently.
• a set of software development practices, behaviors, and principles for automating and improving how to integrate and certify software continuously.
• Started around 1999
![Page 20: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/20.jpg)
Why use CI?
• to deliver stable, high-quality code consistently and quickly;
• detect and fix problems early;• deliver quality software; • reduce time to market of the finish product;
![Page 21: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/21.jpg)
0% interest
Buy Now Pay Later
![Page 22: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/22.jpg)
Principles
• Maintain a Single Source Repository• Automate the Build• Make Your Build Self-Testing• Everyone Commits To the Mainline Every Day• Every Commit Should Build the Mainline on an Integration
Machine• Keep the Build Fast• Test in a Clone of the Production Environment• Make it Easy for Anyone to Get the Latest Executable• Everyone can see what's happening• Automate Deployment
![Page 23: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/23.jpg)
CI in the Market
• Proprietary– Build Forge– AnthillPro– BuildMaster– TeamCity
![Page 24: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/24.jpg)
CI in the Market
• OpenSource– CruiseControl– Jenkins/Hudson
![Page 25: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/25.jpg)
4 steps to getting started (Jenkins)
1. Download and install2. Create and configure the project/job3. Run your first build4. Customize
![Page 26: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/26.jpg)
http://jenkins-ci.org/
![Page 27: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/27.jpg)
Configure Jenkins
![Page 28: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/28.jpg)
New job/project
![Page 29: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/29.jpg)
![Page 30: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/30.jpg)
![Page 31: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/31.jpg)
Plug-ins
• Over 400 plug-ins• Source code management (e.g. Git, Mercurial)• Artifact uploaders (e.g. Tomcat, JBOSS,
Websphere)• Build Reports (e.g. Cobertura, Sonar, Ruby)• Authentication and user management• UI Plugins
![Page 32: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/32.jpg)
Reasons for CI
• Reports Any Build Failures to the Team• Reduces the Risk of Integrating Code
Private builds –> integration builds –> release builds
• Establishes Greater Confidence in the Product– Incorporated automated unit test in the build
• Improves the Efficiency of the Team
![Page 33: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/33.jpg)
MAKE LIFE EASY FOR EVERYBODY
![Page 34: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/34.jpg)
Salamat!
![Page 35: Version Control and Continuous Integration](https://reader035.vdocument.in/reader035/viewer/2022062418/55581089d8b42a5e468b480c/html5/thumbnails/35.jpg)
Reference:
• Internet