Jenkins+gerrit Create new Project Hand Shun

Source: Internet
Author: User
Tags i18n git clone webhook

1. Gerrit Create new Project

Admin login Gerrit,project to create a new project with the same project name as the remote git library.

2. Jenkins Configuration

> Configuration Review Jobs

The local git library address that git is configured to Gerrit

Add Gerrit Trigger Configuration

> Configuring remote GIT code base automatic deployment

git configured as remote git library address

Add build triggers: Poll SCM-> H/5 * * *

Add Post Build Action: Execute Shell

3. Add the. Gitreview configuration file in the remote git library

Clone to Local

$git Clone Git@xx.xx.xx.xx:group/project.git

$ CD Project

$ vim. Gitreview




1 2 3 4 [Gerrit] host=xx.xx.xx.xx port=29418 project= project.git defaultbranch=develop

$git Add. Gitreview
$git commit-m  "Add. Gitreview"
$git push

4. In Gerrit git directory to delete the original created the project, clone remote Git library

$CD gerrit_home/git
$rm-rf project.git
$git clone--bare git@xx.xx.xx.xx:group/project.git
$git config-- Global User.Name ' Gerrit '
$git config--global user.email ' gerrit_admin_email '
Solve Chinese garbled
$ git config--global core.quotepath false
$ git config--global i18n.logoutputencoding utf8
$ git config--global I18n.commitencoding UTF8
Support Gitweb
$ git config--file/home/gerrit/gerrit_site/etc/gerrit.config gitweb.cgi/var/www/git/gitweb.cgi
$ git config--file/home/gerrit/gerrit_site/etc/gerrit.config--unset gitweb.url





5. Add the remote git library configuration in the Etc/replication.config file

$ vim Etc/replication.config

1 2 3 4 5 6 7 [Remote Project] projects = Project URL = git@xx.xx.xx.xx:group/project. git push = +refs/heads/*:refs/heads/* Push = +refs/tags/*:refs/tags/* push = +refs/changes/*:refs/changes/* threads = 3


6. Jenkins Webhook

Triggers a remote build in Jenkins, sets the password, and sets the hook Url in the webhook of the Git repository:

Http://xx.xx.xx.xx/buildByToken/build?job=project&token=PASSWORD


7. Add New User

# htpasswd-c/home/gerrit/gerrit_site/etc/passwords Gerrit


8. Run Index

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.