root / README.ci @ c4e70532
History | View | Annotate | Download (4 kB)
1 |
Continuous integration with Jenkins |
---|---|
2 |
=================================== |
3 |
|
4 |
Preparing a GIT mirror |
5 |
---------------------- |
6 |
|
7 |
Jenkins cannot currently work with Git over encrypted HTTP. To solve this |
8 |
problem we currently mirror the central Git repository locally on the jenkins |
9 |
installation machine. To setup such a mirror do the following: |
10 |
|
11 |
-edit .netrc |
12 |
|
13 |
machine code.grnet.gr |
14 |
login accountname |
15 |
password accountpasswd |
16 |
|
17 |
-Create the mirror |
18 |
|
19 |
git clone --mirror https://code.grnet.gr/git/synnefo synnefo |
20 |
|
21 |
-Setup cron to pull from the mirror periodically. Ideally, Git mirror updates |
22 |
should run just before Jenkins jobs check the mirror for changes. |
23 |
|
24 |
4,14,24,34,44,54 * * * * cd /path/to/mirror && git fetch && git remote prune origin |
25 |
|
26 |
Jenkins setup |
27 |
------------- |
28 |
|
29 |
The following instructions will setup Jenkins to run synnefo tests with the |
30 |
SQLite database. To run the tests on MySQL and/or Postgres, step 5 must be |
31 |
replicated. Also, the correct configuration file must be copied (line 6 of the |
32 |
build script). |
33 |
|
34 |
1. Install and start Jenkins. On Debian Squeeze: |
35 |
|
36 |
wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | apt-key add - |
37 |
echo "deb http://pkg.jenkins-ci.org/debian binary/" >>/etc/apt/sources.list |
38 |
echo "deb http://ppa.launchpad.net/chris-lea/zeromq/ubuntu lucid main" >> /etc/apt/sources.list |
39 |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C7917B12 |
40 |
sudo apt-get update |
41 |
sudo apt-get install jenkins |
42 |
|
43 |
Also install the following packages: |
44 |
|
45 |
apt-get install python-virtualenv libcurl3-gnutls libcurl3-gnutls-dev |
46 |
uuid-dev libmysqlclient-dev libpq-dev libsqlite-dev |
47 |
python-dev libzmq-dev |
48 |
|
49 |
2. After Jenkins starts, go to |
50 |
|
51 |
http://$HOST:8080/pluginManager/ |
52 |
|
53 |
and install the following plug-ins at |
54 |
|
55 |
-Jenkins Cobertura Plugin |
56 |
-Jenkins Email Extension Plugin |
57 |
-Jenkins GIT plugin |
58 |
-Jenkins SLOCCount Plug-in |
59 |
-Hudson/Jenkins Violations plugin |
60 |
|
61 |
3. Configure the Jenkins user's Git details: |
62 |
su jenkins |
63 |
git config --global user.email "buildbot@lists.grnet.gr" |
64 |
git config --global user.name "Buildbot" |
65 |
|
66 |
4. Make sure that all system-level dependencies specified in README.develop |
67 |
are correctly installed |
68 |
|
69 |
5. Create a new "free-style software" job and set the following values: |
70 |
|
71 |
-Project name: synnefo |
72 |
-Source Code Management: Git |
73 |
-URL of repository: Jenkins Git does not support HTTPS for checking out directly |
74 |
from the repository. The temporary solution is to checkout |
75 |
with a cron script in a directory and set the checkout path |
76 |
in this field |
77 |
-Branches to build: master and perhaps others |
78 |
-Git->Advanced->Local subdirectory for repo (optional): synnefo |
79 |
-Git->Advanced->Prune remote branches before build: check |
80 |
-Repository browser: redmineweb, |
81 |
URL: https://code.grnet.gr/projects/synnefo/repository/ |
82 |
-Build Triggers->Poll SCM: check |
83 |
Schedule: # every five minutes |
84 |
0,5,10,15,20,25,30,35,40,45,50,55 * * * * |
85 |
|
86 |
-Build -> Add build step-> Execute shell |
87 |
|
88 |
Command: |
89 |
|
90 |
#!/bin/bash -ex |
91 |
cd synnefo |
92 |
mkdir -p reports |
93 |
/usr/bin/sloccount --duplicates --wide --details api util ui logic auth > reports/sloccount.sc |
94 |
cp conf/ci/manage.py . |
95 |
if [ ! -e requirements.pip ]; then cp conf/ci/pip-1.2.conf requirements.pip; fi |
96 |
cat settings.py.dist conf/ci/settings.py.sqlite > settings.py |
97 |
python manage.py update_ve |
98 |
python manage.py hudson api db logic |
99 |
|
100 |
-Post-build Actions->Publish JUnit test result report: check |
101 |
Test report XMLs: synnefo/reports/TEST-*.xml |
102 |
|
103 |
-Post-build Actions->Publish Cobertura Coverage Report: check |
104 |
Cobertura xml report pattern: synnefo/reports/coverage.xml |
105 |
|
106 |
-Post-build Actions->Report Violations: check |
107 |
pylint[XML filename pattern]: synnefo/reports/pylint.report |
108 |
|
109 |
-Post-build Actions->Publish SLOCCount analysis results |
110 |
SLOCCount reports: synnefo/reports/sloccount.sc |
111 |
(also, remember to install sloccount at /usr/bin) |
112 |
--------------- |
113 |
See also: |
114 |
|
115 |
http://sites.google.com/site/kmmbvnr/home/django-hudson-tutorial |