Integration of subversion and mantis

Source: Internet
Author: User

Source Address: http://www.ichiayi.com/wiki/tech/svnmantis

1 goal

When mantis has released a new issue, the Subversion associated with this issue can be automatically restored to the bug within Mantis.

To achieve this goal, we mainly create a svn2mantis. Pl to integrate the hook in the subversion with the checkin. php In Mantis. You can refer to the following concepts:

2 related environments
    • Both mantis and subversion are installed on the same host orThe Subversion master machine can log on to the Mantis master machine through SSH without requiring authentication.

    • Version 1.0.7 of mantis is installed in/var/www/html/Mantis.

    • Subversion 1.4.3-1

3 preset program 3.1 mantis to establish special integrated user
    • Creates a special userid named svnbot.

    • Access permission is setDeveloper(If there are multiple cases, each case must be granted with the permission of svnbot)

3.2 set mantis metric data

VI/var/www/html/mantis/config_inc.php

: # Source control $ g_source_control_account = 'svnbot '; $ g_source_control_regexp ='/\ B (? : Bug | issue | mantis) \ s * [#] {0, 1} (\ D +) \ B/I '; $ g_source_control_set_status_to = resolved; $ g_source_control_set_resolution_to = fixed; $ g_source_control_fixed_regexp = '/\ bfix (? : Ed | ES) \ s + (? : Bug | issue | mantis )? \ S * [#] {0, 1} (\ D +) \ B/I ';:
    • Set svnbot to a special user in this integrated Mantis.

    • As long as a bug or issue or mantis # issue occurs in the subversion, it indicates integrating the issue in mantis # bug record

    • As long as the fixed, fixes + bug, issue, or mantis # conflict occurs in the subversion, it indicates integrating the issue in mantis # Out-of-memory bug, in addition, the issue authentication mechanism will be changed to the corrected solution.

3.3 zookeeper integration with Mantis

Run the following command directly to add a bug record in Issue #2 in Mantis.

 
PHP/var/www/html/mantis/CORE/checkin. php <"test issue #2 by svnbot. "or PHP/var/www/html/mantis/scripts/checkin. php <"test issue #2 by svnbot."

Run the following command directly to add a bug record in Issue #2 in mantis and change the problem into a solution.

 
PHP/var/www/html/mantis/CORE/checkin. php <"test Fixed issue #2 by svnbot. "or PHP/var/www/html/mantis/scripts/checkin. php <"test Fixed issue #2 by svnbot."

If this step does not correctly display a new bug record in mantis, it may be that this case does not give svnbot the special user privilege.

3.4 mantis and SVN security guard integrate mantis scripts on the same host machine 3.4.1
    • Click here to directly download the svn2mantis. pl variable

VI/var/www/svn2mantis. pl

#! /Usr/bin/perl #11: 23 2008/4/30 # Jonathan Tsai # ver 1.11 # automatically inject SVN information into mantis internal modules # explain the way to test http://www.ichiayi.com/trywiki/tech/svnmantis # this script must be used: #1. /var/www/SVN/xxxrepos/hooks/post-commit used together #2. apache users can use SSH password-free login to log on to the Mantis host <-different times between the svn host and the Mantis host #1.00 () for the first version of login #1.01) description of automatic integration after commit #1.10 (2007/6/22) added the login terminal to the Mantis host function setting #1.11 (2008/4/30) added the Third Metric data. Shcmd external settings (avoid mixing with source) # $ prgname = substr ($0, rindex ($0, "/") + 1 ); $ ver = "1.11 (2008/4/30)"; # retrieve metadata $ repos = $ argv [0]; $ REV = $ argv [1]; # $ when sshcmd is set to an empty string, it indicates that SVN and Mantis are on the same host. $ sshcmd = defined ($ argv [2])? "/Usr/bin/ssh ". $ argv [2]: ""; # The third parameter is the SSH command used by the svn master to log on to the Mantis master without password. Exp. jonathan@10.10.10.96-> $ sshcmd = "/usr/bin/ssh Jonathan \ @ 10.10.10.96"; # define External commands $ svnlook = "Export lang = zh_TW.UTF-8; /usr/bin/svnlook "; $ phpcmd ="/usr/bin/PHP "; $ checkincmd ="/var/www/html/mantis/CORE/checkin. PHP "; # obtain SVN related information $ auth = '$ svnlook author-r $ rev $ repos'; $ dt = '$ svnlook date-r $ rev $ repos '; $ changed = '$ svnlook changed-r $ rev $ repos'; $ log = '$ svnlook log-r $ rev $ repos'; $ MSG = "Changeset [". $ rev. "] by $ auth \ N $ DT \ N $ log \ N $ changed"; # Send To mantisif (length ($ sshcmd)> 0) {'$ sshcmd $ phpcmd-Q $ checkincmd <"$ MSG"';} else {'$ phpcmd-Q $ checkincmd <"$ MSG "';}
3.4.2 merge into multiple rows of script
    • SVN with false servercfg is stored in/var/www/SVN/servercfg

    • The reversion 644 of the pseudo-configuration servercfg contains mantis #2 metadata, which indicates integration to mantis issue #2.

 
Chmod A + x/var/www/svn2mantis. pl/var/www/svn2mantis. pl/var/www/SVN/servercfg 644
    • In this way, we can see a new bug notebook in mantis issue #2. The content is as follows:

 
Changeset [644] By jonathan2007-03-26 11:29:55 + 0800 (A, 26 March 20 07) before the svnlook command added lang = zh_TW.UTF-8 to integrate mantis Chinese interest questions. mantis # 2u PD-920/var/www/svn2mantis. PL
3.4.3 configure SVN commit and automatically upload row svn2mantis. pl

If there are multiple SVN repos, follow these steps in each repos. The following is an example of the svn repos of servercfg.

 
CD/var/www/SVN/server‑cd hooks

VI post-commit

 
1 :#! /Bin/SH2: 3: repos = "$1" 4: REV = "$2" 5: 6:/var/www/svn2mantis. PL "$ repos" "$ rev"
 
Chown Apache: Apache post-commitchmod A + X Post-commit

In this case, after the commit, the shell script of the Post-commit will be uploaded to the svn2mantis line. PL integrates the internal repository content in SVN into the issue bug repository of Mantis.

3.5 set mantis and SVN on different hosts 3.5.1 on the svn master machine, you can log on to the Mantis master machine without password authentication.
    • SVN server: 10.10.10.91

    • Mantis server: 10.10.10.96

    • The false SVN server is integrated with httpd and runs through Apache.

    • First, set the configuration of Jonathan zookeeper In the svn master machine to log on to the Mantis master machine using the same zookeeper.

    • You can also set Apache authentication keys in the svn master machine to log on to the Mantis master machine without using the password Jonathan authentication.

3.5.1.1 SVN host
    • Create a license and a Public License in/home/Jonathan/. SSH

    • Change the name of the public IP address to the Mantis host to 10.10.10.91 _ authorized_keys2.

 
Su-jonathanssh 10.10.10.96 <-confirm the password and log on to exit <-Return to the svn master machine CD. sshssh-keygen-D <-generate id_dsa.pub (enter and do not input any characters when the client fails) SCP id_dsa.pub 10.10.10.96:/home/Jonathan /. SSH/10.10.10.91 _ authorized_keys2
3.5.1.2 mantis host
    • Add the svn master machine public token to the authentication public token list

    • Set the permission of the certificate statement to allow only the user to renew the ticket.

 
Su-jonathancd. sshcat 10.10.10.91 _ authorized_keys2> authorized_keys2chmod 600 authorized_keys2
3.5.1.3 login using the svn master machine password-free login to the Mantis master machine
    • Log on to the svn host using Jonathan zookeeper

    • Just line SSH 10.10.10.96 and you can find that you can log on to the Mantis host without password authentication.

 
[Jonathan @ eddev ~] $ SSH jonathan@10.10.10.96Last login: Fri Jun 22 10:14:40 2007 from 10.10.10.91 [Jonathan @ tryboxap04 ~] $
3.5.1.4 configure Apache password-free login on the svn master to log on to the Mantis master
    • Log OnSVNHost, switch to root

    • Set/home/Jonathan/. SSH to/var/www.

 
Su-CD/var/wwwcp-~ Jonathan/. Ssh. chown-r Apache: Apache. SSH
3.5.2 compile a script that integrates mantis on the terminal
    • After svn2mantis. pl ver 1.11 (2008/4/30), we will not partition the local and local versions, and increase the number of third-party incoming data (the number required by the local SSH client)

    • Specify the SSH quota through the hook/post-commit in SVN.

3.5.3 Merge multiple rows of script
    • SVN with false settings moeaprj is stored in/var/www/SVN/moeaprj

    • The reversion 1700 of the false parameter moeaprj contains mantis #516 metadata indicating integration to mantis issue #516

 
Chmod A + x/var/www/svn2mantis. pl/var/www/svn2mantis. pl/var/www/SVN/moeaprj 1700 jonathan@10.10.10.96
    • In this way, we can see a new bug issue in mantis issue #516. The content is as follows:

 
Changeset [1700] By chou2007-06-20 12:09:04 + 0800 (3, 20 June 20) change the source of the Article containing the attachment printed mantis # 516u edoc2/source/docsrv_html/INC/templates/edrecvquery_2.inc.htm
3.5.4 configure SVN commit and automatically upload row svn2mantis. pl

If there are multiple SVN repos, follow these steps in each repos. The following is an example of SVN repos of moeaprj.

 
CD/var/www/SVN/moeaprjcd hooks

VI post-commit

 
#! /Bin/sh repos = "$1" REV = "$2"/var/www/svn2mantis. pl "$ repos" "$ rev" jonathan@10.10.10.96
 
Chown Apache: Apache post-commitchmod A + X Post-commit

In this case, after the commit, the shell script of the Post-commit will be uploaded to the svn2mantis line. PL integrates the internal repository content in SVN into the issue bug repository of Mantis.

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.