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