你的位置:首页 > 软件开发 > ASP.net > gitlab+gerrit+jenkins持续集成框架

gitlab+gerrit+jenkins持续集成框架

发布时间:2015-12-09 12:00:10
1.持续集成之gitlab+gerrit+jenkins1.1. GitLab1.1.1. 简介  GitLab 是一个使用使用Ruby on Rails搭建的,用于仓库管理系统的开源项目。使用Git作为代码管理工具,并在此基础上搭建起来的web服务1.1.2. 环境搭建  a) ...

gitlab+gerrit+jenkins持续集成框架

1.持续集成之gitlab+gerrit+jenkins

1.1. GitLab

1.1.1. 简介

  GitLab 是一个使用使用Ruby on Rails搭建的,用于仓库管理系统的开源项目。使用Git作为代码管理工具,并在此基础上搭建起来的web服务

1.1.2. 环境搭建

  a) Install and configure the necessary dependencies

    If you install Postfix to send email please select 'Internet Site' during setup. Instead of using Postfix you can also use Sendmail or configure a custom SMTP server. If you wish to use Exim, please configure it as an SMTP server.

    On Centos 6 and 7, the commands below will also open HTTP and SSH access in the system firewall.

    sudo apt-get install curl openssh-server ca-certificates postfix

  b) Add the GitLab package server and install the package.

    • Apt-get安装

      Curl https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.deb.sh|sudo bash

      sudo apt-get install gitlab-ee

      If you are not comfortable installing the repository through a piped script, you can find the entire script here.

      Alternatively you can select and download the package manually and install using

    • deb包安装

      下载deb包

      https://packages.gitlab.com/gitlab/gitlab-ee

      安装deb包

      sudo dpkg -i gitlab-ee_8.1.2-ee.0_amd64.deb

  c) 1.1.2.3. Configure and start GitLab

    sudo gitlab-ctl reconfigure

  d) 1.1.2.4. Browse to the hostname and login

    http://10.24.6.8:80

    Username: root     gitlab+gerrit+jenkins持续集成框架

1.2.4.2  自动同步项目到gitlab

  同步 Gerrit 的test项目到 Gitlab 上的test项目

  当用户 git review 后,代码通过 jenkins 测试、人工 review 后,代码只是 merge 到了 Gerrit 的 test-project1 项目中,并没有 merge 到 Gitlab 的 test 项目中,所以需要当 Gerrit test项目仓库有变化时自动同步到 Gitlab 的 test项目仓库中。Gerrit 自带一个 Replication 功能,同时我们在安装 Gerrit 时候默认安装了这个 Plugin。现在只需要添加一个 replication.config 给 Gerrit

 

  a) 进入gerrit代码存放目录gerrit_dir,增加replication.config

    gerrit@gerrit:~/gerrit_dir$ vim etc/replication.config

     文件内容为:

    [remote "test"]

           projects = test

           url = git@10.24.6.8:root/test.git

      push = +refs/heads/*:refs/heads/*

             push = +refs/tags/*:refs/tags/*

      push = +refs/changes/*:refs/changes/*

      threads = 3

    gitlab+gerrit+jenkins持续集成框架 

  b) 设置gerrit用户的 ~/.ssh/config

    文件内容为:

 

    Host 10.24.6.8:

        IdentityFile ~/.ssh/id_rsa

    PreferredAuthentications publickey

原标题:gitlab+gerrit+jenkins持续集成框架

关键词:Git

Git
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。