NO.159 Integrated Zen path and Git

Source: Internet
Author: User
Tags git client

Zen Road from the 5.0 version of the built-in Git integration features, the Zen Path of the task, bugs and other related to the code to make it easier for users to view. Here's how to configure Zen Lane integration with Git.


One, git integration mechanism description

The basic mechanism for GIT integration is to parse the comments when the code is submitted and to draw the corresponding story, task, BugID, and write to the database of Zen trails.

There are two scenarios for implementing the above functions, one scheme is to use the hook mechanism of git, when the code is submitted, trigger a hook script, and then analyze the comment, draw the corresponding bug, story or task ID number, and then call the Zen Path API, the relevant records to write to the database. Another option is to use the log command of the GIT client software to get all the commit records, then parse, draw the corresponding ID, write to the database.

Each of the two scenarios has its own merits and demerits, and we finally chose the second option. Because the second solution debugging is better debugging, deployment is relatively convenient, but also can resolve all previous records, there is a better flexibility.


Ii. deploy the GIT command-line client on the same machine as the Zen Road

A git command-line client is a git command that comes with Git. Below Windows is git.exe,linux git with no suffix below.

The machine where Zen Road is located can be separated from the Git machine and not on a single machine.

If it's a Linux machine, you need to install a git client. Rhel,centos can use Yum to install Git, Debian can be installed under Apt-get.


Third, configure the Zen path about git parameters

3.1 Code Location

The configuration file for the Git module is located in zentao/module/git/config.php. You can modify this file directly, but it is recommended that you save the changes to git/ext/config/git.php. This will not overwrite your profile in the future as we upgrade.

3.2 Configuration Content

1. Location of the git client command.

2. Library (Repo): Multiple libraries can be configured.

Let's take a practical example to illustrate this.

3.2.1, find the position of the red-framed flag in the image

3.2.2 Modifying code

The notation is shown in the following example


$config->git->client fill in the Git client path;

$config->git->repos[$i [' path '] fill in the path of the Git library

3.3 Configuring multiple libraries

3.3.1 Ibid, find the following code in the same file

3.3.2 Modifying code

① the Code "/*" and "* *" Delete, the remaining changes as above, note: $i + + cannot be modified.

② If you have a git library, copy this code and make the same configuration.


Iv. Code Submission Comment format

When the developer submits the code to git, it needs to indicate the need for the modification, or the task, or the ID of the bug, in the notes. For example, the following format:

bug#123,234, 1234, or the bug:123,234 1234,id list, can be separated by commas and spaces.

Story#123 task#123

A bug, story, task must be labeled. :)


V. Execute the git sync command

5.1 Refer to Initialization management script This article initializes the command-line script.

5.2 Go to the zentao/bin/directory and execute the Syncgit.bat or syncgit.sh script.

5.3 Programs Run:

5.4 View the appropriate bug:


Vi. deployment of Scheduled Tasks

6.1 After the above command has been deployed, add the command to the scheduled task. For example, it can be executed in 5 minutes. Using Scheduled Tasks under Windows, use Crontab under Linux.

6.2 The configured code base also uses timed tasks to synchronize updates every 5 minutes git pull.


NO.159 Integrated Zen path and Git

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.