ZenTao open source 12.1.stable and up has the CI(Continuous Integration) module added, which includes features such as Jenkins.
1. Create a repo
Go to CI->Code. If no repo exists, you will be directed to the page to create a repo first.
- Name: the name of a repository.
- Path: the path of a repository, such as http://zentaoms.googlecode.com/svn. This path does not have to be a root.
- Encoding: utf-8 or GBK.
- Client: the path of a client. In Linux, it might be / usr /bin/svn (for Git , it might be / usr /bin/git). In Windows, you can download sliksvn which have been integrated into the one-click installation package( for Git, use msysGit), and then specify the path of svn.exe. (Tips 1. The client has to be installed on the same server that installed ZenTao; 2. The path of the SVN should not have spaces; 3. If using HTTPS, make sure that it is valid and the IP address should not be right after it.)
- Username and password: account information of a repository . If you do not need a username and password, just leave it blank.
After clicking Save, ZenTao will be initialized and previous change logs are saved.
2. Browse a repo
You can browse a repo after configuration. Click Refresh and you can synchronize the code.
3. Diff files
Now you can view codes in ZenTao and compare and diff them.
4. Integrate Jenkins
4.1 Install Jenkins
It might take a while to install Jenkins. Refer HERE for Jenkins installation.
4.2 Start Jenkins
Create an item.
Set parameters.
Check Git and set repo URLs.
Set the Build.
Execute shell
GIT ===Jenkins export command=== echo "PARAM_TAG = $PARAM_TAG"; echo "PARAM_REVISION = $PARAM_REVISION"; [ -z ${PARAM_TAG} ] || git checkout "${PARAM_TAG}" [ -z ${PARAM_REVISION} ] || git checkout "${PARAM_REVISION}" cat README ===Note=== Parameter PARAM_TAG:tag name PARAM_REVISION:revison number Initialize git clone https://gitee.com/aaronchen2k/ci_test.git Export tag export PARAM_TAG=tag111 [ -z ${PARAM_TAG} ] || git checkout "${PARAM_TAG}" Export revision export PARAM_REVISION=6c3a7bf931855842e261c7991bb143c1e0c3fb19 [ -z ${PARAM_REVISION} ] || git checkout "${PARAM_REVISION}" SVN ===Jenkins command after export=== echo "PARAM_TAG = $PARAM_TAG"; echo "PARAM_REVISION = $PARAM_REVISION"; svn upgrade [ -z ${PARAM_TAG} ] || svn switch --ignore-ancestry "${PARAM_TAG}" [ -z ${PARAM_REVISION} ] || svn up -r "${PARAM_REVISION}" cat README ===Note=== Parameter PARAM_TAG:tag url PARAM_REVISION:revison number Initialize svn checkout --username aaronchen2k --password P2ssw0rd svn://svnbucket.com/aaronchen2k/ci_test_svn/trunk/ . Export tag export PARAM_TAG=svn://svnbucket.com/aaronchen2k/ci_test_svn/tags/tag111 [ -z ${PARAM_REVISION} ] || svn upgrade [ -z ${PARAM_TAG} ] || svn switch --ignore-ancestry "${PARAM_TAG}" Export revision export PARAM_REVISION=9 [ -z ${PARAM_REVISION} ] || svn upgrade [ -z ${PARAM_REVISION} ] || svn up -r "${PARAM_REVISION}"
4.3 Integrate Jenkins in ZenTao
Go to CI->Jenkins and create Jenkins.
5. Compile and create a job
Go to CI->Compile and click Create Job.
Trigger can be
- Git: a new tag is created in the repo
- SVN: a change of directories
- Code Commit: a word in a comment that matches the keyword set here
- Schedule:
In order to make sure that it will be executed, go to Admin-> System-> Cron.
Execute the job manually.
You can also check the history.
6. Set rules
ZenTao will parse the comments of the repository according to the rules set here, and the matching tasks are processed accordingly.
Note:
Synchronize Git and SVN should be active in Admin->System->Cron.
If you have questions about Jenkins integration, contact us at [email protected].