Good Reference:
- Gerrit 与 Jenkins 集成配置的最快上手一站式说明(2014年新版)
- 基于Jenkins的自动构建系统开发
- CI 系统搭建:Git、Gerrit与Jenkins
- Git、Gerrit与Jenkins/Hudson CI服务器
- 软件项目管理平台:repo+gerrit+jenkins+gitlab+sonar+redmine
Note: besides the steps in Gerrit 与 Jenkins 集成配置的最快上手一站式说明(2014年新版), in "Source Code Management", add "Check out to a sub-directory", and specify local directory.
Note: If need add Verified, then no need to remove the --verified
Redmine
http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_on_Ubuntu_step_by_step
TODO for study
https://wiki.jenkins-ci.org/display/JENKINS/Plugins
CIS Plugin
- Repo Plugin — This plugin adds Repo (http://code.google.com/p/git-repo/) as an SCM provider in Jenkins.
- Gerrit Trigger — This plugin integrates Jenkins to Gerrit code review for triggering builds when a "patch set" is created.
C Development Plugin
- Cppcheck Plugin — This plugin generates the trend report for CppCheck, a tool for static C/C++ code analysis.
- CPPNCSS Plugin — This plugin allows you to use CppNCSS build reporting tool.
- Cpptest Plugin — This plugin allows you publish Parasoft C++test test results.
- CppUnit Plugin — This plugin enables you to publish CppUnit test results.
- xUnit Plugin — This plugin makes it possible to publish the test results of an execution of a testing tool in Jenkins.
Documentation
- Doxygen Plugin — This plugin generates Doxygen documentation and publishes HTML reports generated by the Doxygen tool.
CIS Server Configurations
cis=`pwd`
gerrit=$cis/gerrit
jenkins=$cis
install_libs()
{
# install jre
apt-get install default-jre daemon
}
install_gerrit()
{
cd $cis
ver=$1
if [ is"$ver" = is"" ]; then
ver=2.9.4
fi
# download gerrit
#wget http://gerrit-releases.storage.googleapis.com/gerrit-$ver.war
# install or upgrade gerrit (when upgrade, just always enter)
java -jar gerrit-$ver.war init -d $cis/gerrit/
}
install_repo()
{
# get repo for client side, not necessary
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
sudo cp ~/bin/repo /usr/local/bin/repo
# download repo git to speed up initialization
git clone --mirror https://gerrit.googlesource.com/git-repo.git $gerrit/git/git-repo.git
}
install_jenkins()
{
cd $cis
# download jekins
wget http://mirrors.jenkins-ci.org/war/latest/jenkins.war
}
#install_jenkins
start_cis()
{
#start gerrit
cd $gerrit
./gerrit.sh start
#start jenkins
cd $cis
java -jar jenkins.war --httpPort=8081
}
start_cis
setup_jenkins()
{
# add jenkins account in gerrit
ssh -p 29418 localhost gerrit create-account jenkins --ssh-key - < ~/.ssh/id_dsa.pub
# notes:
# 1. if it shows nulljob/calc/17/ in gerrit (BUILDURL=nullojb), then go to
# "System Configuration", and click Save, then it's changed to valid one:
# http://10.37.116.110:8081/job/calc/17/
# 2. can test jenkins to review as bellow
# ssh -p 29418 jenkins@localhost gerrit review 5,4 --message \"verified ok\" --code-review 1 --verified 1
}
CIS Client Configurations
server="10.0.12.110"
repos=`pwd`/repos
gitconfig()
{
# global configurations for current user, in ~/.gitconfig
git config --global user.name "Yongsen Chen"
git config --global user.email yongsenchen@github.com
git config --global core.fileMode false
# operations alias for all users, in /etc/gitconfig
sudo git config --system alias.st status
sudo git config --system alias.ci commit
sudo git config --system alias.co checkout
sudo git config --system alias.br branch
sudo git config --system alias.sh show
}
download_repo()
{
# get repo applications
# curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
sudo curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > /usr/local/bin/repo
sudo chmod a+x /usr/local/bin/repo
}
fetch_code()
{
mkdir -p $repos
cd $repos
# note: when fetch code, must use ssh://$server:29418, http can't work
repo init -u ssh://$server:29418/manifests -b master --repo-url=ssh://$server:29418/git-repo.git
repo sync
repo forall -c "scp -p -P 29418 $server:hooks/commit-msg .git/hooks/"
}
fetch_code