Continuous integration of code management platform svn version library control (2)

Source: Internet
Author: User

Svn (subversion) is a version management tool that has emerged in recent years and is the successor of cvs. Currently, most open-source software uses svn as the code version management software, and the continuous code building platform needs to pull code from svn. Therefore, this chapter mainly configures svn.I. svn environment installation:# Yum install subversion mysql-server httpd mod_dav_svn mod_perl sendmail wget gcc-c ++ make unzip perl * ntsysv vim-enhanced mod_ssl-yIi. Configure the svn Repository:1. create a directory to store all SVN files # mkdir/data/svn 2. create a version repository # svnadmin create/data/svn/project 3. it is easy to add SVN users. You only need to add an entry in the/data/svn/project/conf/passwd file, such as "username = password. For testing, I added the following content:

 
 
  1. [users] 
  2. luowei = luowei 
  3. zhangyp = zyp  
4. Modify the User Access Policy # vim/data/svn/project/conf/authz records the user's access policy. The following is a reference:
 
 
  1. [groups] 
  2. admin  = luowei,zhangyp 
  3. [/] 
  4. @admin = rw 
  5. * = 
Note: The preceding information indicates that only the admin user group has the permission to read and write the root directory. R indicates that the directory has read permission, w indicates that the directory has write permission, and rw indicates that the directory has read and write permissions. * = In the last row indicates that no one except the user group with the preceding permissions is allowed to access this directory. This is very important and must be added! 5. Modify the svnserve. conf file to improve the efficiency of user and policy configuration. # The content of vim/data/svn/project/conf/svnserve. conf is as follows:
 
 
  1. [general] 
  2. anon-access = none 
  3. auth-access = write 
  4. password-db = /data/svn/project/conf/passwd 
  5. authz-db = /data/svn/project/conf/authz 
6. start the server # svnserve-d-r/data/svn Note: If the svn configuration is modified, restart the svn Service as follows: # ps-aux | grep svnserve # kill-9 ID # svnserve-d-r/data/svn 3. Configure http support for the svn Server1. The svn conversion password is in plain text and is not supported by the HTTP server. Therefore, the format supported by HTTP must be converted. The following is a step-by-step conversion using perl:
 
 
  1. #!/usr/bin/perl  
  2. #  
  3. use warnings; 
  4. use strict; 
  5. #open the svn passwd file  
  6. open (FILE, "passwd") or die ("Cannot open the passwd file!!!n"); 
  7. #clear the apache passwd file  
  8. open (OUT_FILE, ">webpasswd") or die ("Cannot open the webpasswd file!!!n"); 
  9. close (OUT_FILE); 
  10. #begin  
  11. foreach (<FILE>) { 
  12.   if($_ =~ m/^[^#].*=/) 
  13.     { $_ =~ s/=//; 
  14.       `htpasswd -b webpasswd $_`; 
  15.     } 
Run the command. 2. Modify the apache configuration file and add svn-supported content: # vim/etc/httpd/conf/httpd. conf Add the following content:
 
 
  1. <Location/project>
  2. DAV svn
  3. SVNPath/data/svn/project/
  4. AuthType Basic
  5. AuthName "svn for project"
  6. AuthUserFile/data/svn/project/conf/webpasswd
  7. AuthzSVNAccessFile/data/svn/project/conf/authz
  8. Satisfy all
  9. Require valid-user
  10. </Location>
# Chown-R apache. apache/data/svn/project/restart apache service: # service httpd restart
3. Add ssl authentication: Survival key file

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/030224L41-0.png "border =" 0 "alt =" "/>

Modify the apache configuration file: # vim/etc/httpd/conf. d/ssl. conf // modify the following two items:
 
 
  1. SSLCertificateFile /etc/httpd/conf/httpd.pem 
  2. SSLCertificateKeyFile /etc/httpd/conf/httpd.key 
As shown in:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0302244X7-1.png "border =" 0 "alt =" "/>

Modify the apache main configuration file:
 
 
  1. <Directory/>
  2. Options FollowSymLinks
  3. AllowOverride None
  4. SSLRequireSSL // Add this line
  5. </Directory>
Restart apache to complete the configuration, and then implement advanced svn configuration. 4. Configure email reminder support1. Install the Perl Module: Build
 
 
  1. # tar xvf Module-Build-0.36_11.tar.gz 
  2. # cd Module-Build-0.36_11 
  3. # perl Build.PL 
  4. # ./Build 
  5. # ./Build test 
  6. # ./Build install 
  7. # cd .. 
2. Install the Perl module Authen: SASL
 
 
  1. # tar xvf Authen-SASL-2.15.tar.gz 
  2. # cd Authen-SASL-2.15 
  3. # perl Makefile.PL 
  4. # make test 
  5. # make install 
  6. # cd .. 
3. Install the Perl module. Net: SMTP_auth
 
 
  1. # tar xvf Net-SMTP_auth-0.08.tar.gz 
  2. # cd Net-SMTP_auth-0.08 
  3. # perl Makefile.PL 
  4. # make test 
  5. # make install 
  6. # cd .. 
4. Install the Perl module SVN: Running y
 
 
  1. # tar xvf SVN-Notify-2.80.tar.gz 
  2. # cd SVN-Notify-2.80 
  3. # perl Build.PL 
  4. # ./Build 
  5. # ./Build test 
  6. # ./Build install 
  7. # cd .. 
5. start the mail server # service sendmail restartShutting down sendmail: [FAILED] Starting sendmail: [OK] Starting sm-client: [OK] 6. configure the automatic mail script to modify the post-commit script to support the mail Notification function. # cd/data/svn/project/hooks/# vim post-commit content is as follows:
 
 
  1. #! /Bin/sh
  2. REPOS = "$1"
  3. REV = "$2"
  4.  
  5. Cat>/tmp/userlist <EOF
  6. Luoweiro@126.com
  7. Wei.luo@baisonmail.com
  8. EOF // Add email notification list
  9.  
  10. IFS = $ '\ N'
  11. For LINE in 'cat/tmp/userlist'; do
  12. /Usr/bin/svnnotify -- repos-path "$1" -- revision "$2" -- to $ LINE -- from 282127408@qq.com -- handler "HTML :: colorDiff "-- with-diff -- smtp localhost -- smtp-user root -- smtp-pass 5201314318-c" UTF-8 "-g zh_CN-O raw -- svnlook/usr/bin/svnlook -- subject -prefix '[svn update]'
  13. Done
Test submitted update received email:

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0302241Y4-2.png "border =" 0 "alt =" "/>

  5. Use svnstat to analyze SVN data:1. svnstat is a JAVA application. You must first install the JAVA environment. Download jre, URL: http://javadl.sun.com/webapps/download/AutoDL? BundleId = 39484 installation:
 
 
  1. # rpm -ivh jre-6u20-linux-i586.rpm  
 
2. Download and decompress svnstat
 
 
  1. # wget http://downloads.sourceforge.net/project/svnstat/svnstat/Release-1.0/SvnStat-1.0.zip?use_mirror=jaist 
  2. # unzip SvnStat-1.0.zip 

3. Update the Code # pwd/root # svn co svn: // 192.168.158.216/projectAuthentication realm: <svn: // 192.168.158.216: 3690> a445a473-9def-448a-9560-b008c929378fPassword for 'baison ': ----------------------------------------------------------------------- ATTENTION! Your password for authentication realm: <svn: // 192.168.158.216: 3690> a445a473-9def-448a-9560-b008c929378f can only be stored to disk unencrypted! You are advised to configureyour system so that Subversion can store passwords encrypted, ifpossible. see the documentation for details. you can avoid future appearances of this warning by setting the valueof the 'store-plaintext-password' option to either 'yes' or 'no' in '/root /. subversion/servers '. ----------------------------------------------------------------------- Store password unencrypted (Yes/no )? Yes 4. Generate svnstat data
 
 
  1. # svn log project -v --xml --non-interactive > project.log 
  2. # cd SvnStat-1.0 
  3. # java -classpath SvnStat-all.jar de.agentlab.svnstat.SvnStat -jar SvnStat-all.jar -r /root/project.log -d /var/www/html/ 
5. log on to the browser and you will see many statistical charts. See figure: https: // 192.168.158.216

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/030224E23-3.png "border =" 0 "alt =" "/>

6. Use statsvn to analyze SVN data1. Download and decompress statsvn
 
 
  1. # unzip statsvn-0.7.0.zip 
  2. # cd statsvn-0.7.0  
2. Generate statsvn data
 
 
  1. # mkdir /var/www/html/statsvn 
  2. # java -jar statsvn.jar -verbose -output-dir /var/www/html/statsvn/ /root/project.log /root/project 

3. Use a browser to test the effect, for example, https: // 192.168.158.216/statsvn.

 

650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/0302241492-4.png "border =" 0 "alt =" "/>

 

This configuration is complete!

This article is from the "Ro blog" blog, please be sure to keep this source http://luoweiro.blog.51cto.com/2186161/1095193

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.