Sign in Join
Wiki copytemporary

Jenkins: what changed

Revision 1 to 2. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11## Overview
22
3-Jenkins is a continuous integration server that can be used to automatically build and test projects based on commits to your source control system.
3+Jenkins is a continuous integration server that can be used to automatically build and test projects based on commits to your source control system.
44
5-This article describes how to set up Jenkins to automatically build FPC when a commit happens in SVN. You can of course adapt these instructions to your own projects.
5+This article describes how to set up Jenkins to automatically build FPC when a commit happens in SVN. You can of course adapt these instructions to your own projects.
66
77## Jenkins set up
88
9-A possible version to use is Turnkey Linux Jenkins on Debian 6.0.5 (Squeeze); this article tested with Jenkins 1.464)
9+A possible version to use is Turnkey Linux Jenkins on Debian 6.0.5 (Squeeze); this article tested with Jenkins 1.464)
1010
11-Whichever way you install Jenkins, make sure the SVN plugin is enabled
11+Whichever way you install Jenkins, make sure the SVN plugin is enabled
1212
13-## Resource compiler setup
13+## Jenkins set up - Docker for Lazarus
1414
15-At least the Debian FPC packages don't install a [[Lazarus Resources|resource compiler]], which is needed in sections below:
15+Docker image ready FPC + Lazarus build environment: [Docker (Castle Game Engine)](<https://castle-engine.io/docker>)
1616
17-``` bash
17+Setting up Jenkins instruction: [Jenkins (Castle Game Engine)](<https://castle-engine.io/jenkins>)
18+
19+## Resource compiler setup
20+
21+At least the Debian FPC packages don't install a [[Lazarus Resources|resource compiler]], which is needed in sections below:
22+```
1823# Get resource compiler, not provided by fpc 2.6 packages:
19-apt-get install mingw32-binutils
20-# symlink:
21-ln -s /usr/bin/i586-mingw32msvc-windres /usr/bin/windres
24+ apt-get install mingw32-binutils
25+ # symlink:
26+ ln -s /usr/bin/i586-mingw32msvc-windres /usr/bin/windres
2227```
2328
2429## Database driver setup
2530
26-For testing database connections/writing results to databases, make sure the relevant operating system database drivers/client connection libraries are installed, e.g.:
27-
28-``` bash
31+For testing database connections/writing results to databases, make sure the relevant operating system database drivers/client connection libraries are installed, e.g.:
32+```
2933apt-get install libfbembed2.5 firebird2.5-super firebird2.5-dev \
30-postgresql-client libpq-dev \
31-freetds-bin freetds-dev \
32-mysql-client libmysqlclient-dev \
33-libsqlite3-0 libsqlite3-dev \
34-unixodbc unixodbc-dev tdsodbc #adjust to taste/distribution
35-# we install the -dev packages so we get the correct driver names for older FPC versions (e.g. libfbclient.so.2.5 instead of libfbclient). Alternatively: symlink these or specify explicit .so names in any code using databases
36-#freetds should pull in unixodbc, but we specify it explicitly.
37-#Strangely, on Debian, we need to explicilty specify tdsodbc to get the actual FreeTDS ODBC driver!?
34+ postgresql-client libpq-dev \
35+ freetds-bin freetds-dev \
36+ mysql-client libmysqlclient-dev \
37+ libsqlite3-0 libsqlite3-dev \
38+ unixodbc unixodbc-dev tdsodbc #adjust to taste/distribution
39+ # we install the -dev packages so we get the correct driver names for older FPC versions (e.g. libfbclient.so.2.5 instead of libfbclient). Alternatively: symlink these or specify explicit .so names in any code using databases
40+ #freetds should pull in unixodbc, but we specify it explicitly.
41+ #Strangely, on Debian, we need to explicilty specify tdsodbc to get the actual FreeTDS ODBC driver!?
3842```
3943
4044## Setting up jobs
4145
42-Use the job screen to set the svn source to the FPC trunk or branch you want to use (e.g. <http://svn.freepascal.org/svn/fpc/trunk>)
43-
44-Set 'use svn update as much as possible'
46+Use the job screen to set the svn source to the FPC trunk or branch you want to use (e.g. <http://svn.freepascal.org/svn/fpc/trunk>)
4547
46-Polling every 5 minutes could be a good setup. Alternatively, you can set up your own SVN server and write a commit hook script for that. This would result in this entry:
48+Set 'use svn update as much as possible'
4749
48-``` bash
50+Polling every 5 minutes could be a good setup. Alternatively, you can set up your own SVN server and write a commit hook script for that. This would result in this entry:
51+```
4952# every 20 minutes
50-*/20 * * * *
53+ */20 * * * *
5154```
5255
5356## Background: the regular build & problems
5457
55-> **Note:** This section is included for completeness; problems with system wide fpc.cfg and current FPC trunk (October 2012) may make using fpcup much easier. See below for that.
58+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** This section is included for completeness; problems with system wide fpc.cfg and current FPC trunk (October 2012) may make using fpcup much easier. See below for that.
5659
5760### Stable FPC setup
5861
59-Install binutils+resource compiler+stable FPC - for some reason the debian packages don't pull in the required dependencies:
60-
61-``` bash
62+Install binutils+resource compiler+stable FPC - for some reason the debian packages don't pull in the required dependencies:
63+```
6264apt-get install build-essential mingw32-binutils
63-# now make an easier name for the resource compiler; adjust to your specific version
64-# you could also adjust -FC<resourcecompilername> in /etc/fpc.cfg
65-ln -s /usr/bin/i586-mingw32msvc-windres /usr/bin/windres
66-
67-#fpc would get old FPC 2.4 on this Debian Squeeze=> symptom in Jenkins build log:
68-#generic.inc(2505,13) Fatal: Internal error 8
69-#Fatal: Compilation aborted
70-#make[7]: *** [system.ppu] Error 1
71-
72-#get stable compiler (2.6 at time of writing); we're on a 32 bit system:
73-cd /root
74-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-compiler-2.6.0_2.6.0-0_i386.deb/download
75-mv download fp-compiler-2.6.0_2.6.0-0_i386.deb
76-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-compiler_2.6.0-0_i386.deb/download
77-mv download fp-compiler_2.6.0-0_i386.deb
78-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-rtl_2.6.0-0_i386.deb/download
79-mv download fp-units-rtl_2.6.0-0_i386.deb
80-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-rtl-2.6.0_2.6.0-0_i386.deb/download
81-mv download fp-units-rtl-2.6.0_2.6.0-0_i386.deb
82-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-i386-2.6.0_2.6.0-0_i386.deb/download
83-mv download fp-units-i386-2.6.0_2.6.0-0_i386.deb
84-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-i386_2.6.0-0_i386.deb/download
85-mv download fp-units-i386_2.6.0-0_i386.deb
86-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils-2.6.0_2.6.0-0_i386.deb/download
87-mv download fp-utils-2.6.0_2.6.0-0_i386.deb
88-wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils_2.6.0-0_i386.deb/download
89-mv download fp-utils_2.6.0-0_i386.deb
90-
91-dpkg -i fp-units-rtl-2.6.0_2.6.0-0_i386.deb
92-dpkg -i fp-units-rtl_2.6.0-0_i386.deb
93-dpkg -i fp-compiler-2.6.0_2.6.0-0_i386.deb
94-dpkg -i fp-utils-2.6.0_2.6.0-0_i386.deb
95-#no idea what the other .debs are for that we downloaded
96-#todo: this could be trimmed down a bit, but this seems to work
65+ # now make an easier name for the resource compiler; adjust to your specific version
66+ # you could also adjust -FC<resourcecompilername> in /etc/fpc.cfg
67+ ln -s /usr/bin/i586-mingw32msvc-windres /usr/bin/windres
68+
69+ #fpc would get old FPC 2.4 on this Debian Squeeze=> symptom in Jenkins build log:
70+ #generic.inc(2505,13) Fatal: Internal error 8
71+ #Fatal: Compilation aborted
72+ #make[7]: *** [system.ppu] Error 1
73+
74+ #get stable compiler (2.6 at time of writing); we're on a 32 bit system:
75+ cd /root
76+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-compiler-2.6.0_2.6.0-0_i386.deb/download
77+ mv download fp-compiler-2.6.0_2.6.0-0_i386.deb
78+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-compiler_2.6.0-0_i386.deb/download
79+ mv download fp-compiler_2.6.0-0_i386.deb
80+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-rtl_2.6.0-0_i386.deb/download
81+ mv download fp-units-rtl_2.6.0-0_i386.deb
82+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-rtl-2.6.0_2.6.0-0_i386.deb/download
83+ mv download fp-units-rtl-2.6.0_2.6.0-0_i386.deb
84+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-i386-2.6.0_2.6.0-0_i386.deb/download
85+ mv download fp-units-i386-2.6.0_2.6.0-0_i386.deb
86+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-units-i386_2.6.0-0_i386.deb/download
87+ mv download fp-units-i386_2.6.0-0_i386.deb
88+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils-2.6.0_2.6.0-0_i386.deb/download
89+ mv download fp-utils-2.6.0_2.6.0-0_i386.deb
90+ wget http://sourceforge.net/projects/freepascal/files/Linux/2.6.0/deb/fp-utils_2.6.0-0_i386.deb/download
91+ mv download fp-utils_2.6.0-0_i386.deb
92+
93+ dpkg -i fp-units-rtl-2.6.0_2.6.0-0_i386.deb
94+ dpkg -i fp-units-rtl_2.6.0-0_i386.deb
95+ dpkg -i fp-compiler-2.6.0_2.6.0-0_i386.deb
96+ dpkg -i fp-utils-2.6.0_2.6.0-0_i386.deb
97+ #no idea what the other .debs are for that we downloaded
98+ #todo: this could be trimmed down a bit, but this seems to work
9799```
98100
99-### Jenkins build commands
101+
100102
101-As build commands in Jenkins, you could use the shell commnds
103+### Jenkins build commands
102104
103-``` bash
105+As build commands in Jenkins, you could use the shell commnds
106+```
104107make all
105108```
106109
107-and, to install inside the "workspace" or top of the build directory environment:
108-
109-``` bash
110+and, to install inside the "workspace" or top of the build directory environment:
111+```
110112make install PREFIX=$WORKSPACE
111113```
112114
113-Note: installing somewhere else may be a good idea, please refer to the Build FAQ.
114-
115-Make install does not generate an fpc.cfg for you; you have to do that yourself:
115+Note: installing somewhere else may be a good idea, please refer to the Build FAQ.
116116
117-``` bash
117+Make install does not generate an fpc.cfg for you; you have to do that yourself:
118+```
118119$WORKSPACE/bin/fpcmkcfg -o $WORKSPACE/bin/fpc.cfg
119120```
120121
121122### A problem: /etc/fpc.cfg
122123
123-The stable we compiled using packages works, but puts an fpc.cfg into the /etc directory. This fpc.cfg is picked up by default and there is no way to disable that unless you e.g. call a script fpc.sh as your compiler instead of the fpc executable. This script passes options to the real compiler so it ignores /etc/fpc.cfg
124+The stable we compiled using packages works, but puts an fpc.cfg into the /etc directory. This fpc.cfg is picked up by default and there is no way to disable that unless you e.g. call a script fpc.sh as your compiler instead of the fpc executable. This script passes options to the real compiler so it ignores /etc/fpc.cfg
124125
125-This will give problems with running e.g. the compiler test suite. These problems may be solved by:
126+This will give problems with running e.g. the compiler test suite. These problems may be solved by:
126127
127-- use an PPC_CONFIG_PATH environment variable or fpc.cfg in home dir, which may work.
128-- perhaps a simpler solution is just not to install FPC/FPC sources, but only download a bootstrap compiler. Therefore no fpc.cfg, and no problem. Bonus is that we build it closer to the "official way". (which is a full install of the previous release)
128+ * use an PPC_CONFIG_PATH environment variable or fpc.cfg in home dir, which may work.
129+ * perhaps a simpler solution is just not to install FPC/FPC sources, but only download a bootstrap compiler. Therefore no fpc.cfg, and no problem. Bonus is that we build it closer to the "official way". (which is a full install of the previous release)
129130
130-To work around is, you can also use fpcup; see the next section.
131+To work around is, you can also use fpcup; see the next section.
131132
132133### A problem: make clean
133134
134-Current (October 2012) FPC trunk does not clean all relevant files when running make clean/make distclean.
135+Current (October 2012) FPC trunk does not clean all relevant files when running make clean/make distclean.
135136
136137## Solution: getting FPC using fpcup
137138
138-The [[Projects using Lazarus|fpcup]] tool can download and install FPC and Lazarus from scratch (no starting compiler needed), so a solution could be:
139-
140-- get fpcup into your workspace
141-- change build steps to call fpcup with --only=fpc --fpcrevision=\$SVN_REVISION
139+The [[Projects using Lazarus|fpcup]] tool can download and install FPC and Lazarus from scratch (no starting compiler needed), so a solution could be:
142140
143-We could have run fpcup so it downloads the latest SVN version, but then we lose the integration with subversion.
141+ * get fpcup into your workspace
142+ * change build steps to call fpcup with --only=fpc --fpcrevision=$SVN_REVISION
144143
145-Make sure you have a resource compiler (see installation section above). Download fpcup (bitness should match your Jenkins machine). Put e.g. fpcup_linux_x86 in your /usr/local/bin directory, then:
144+We could have run fpcup so it downloads the latest SVN version, but then we lose the integration with subversion.
146145
147-``` bash
146+Make sure you have a resource compiler (see installation section above). Download fpcup (bitness should match your Jenkins machine). Put e.g. fpcup_linux_x86 in your /usr/local/bin directory, then:
147+```
148148chmod ugo+rx /usr/local/bin/fpcpup_linux_x86
149149```
150150
151-(If using an x64 Linux, naming will obviously differ)
152-
153-Then set your build steps like this. Note: we could have used one big shell script, but the advantage of putting the commands in execute shell commands is that the build will stop on the first error (non-zero exit status) encountered; you'd have to build that error detection into a script.
151+(If using an x64 Linux, naming will obviously differ)
154152
155-``` bash
153+Then set your build steps like this. Note: we could have used one big shell script, but the advantage of putting the commands in execute shell commands is that the build will stop on the first error (non-zero exit status) encountered; you'd have to build that error detection into a script.
154+```
156155rm --force $WORKSPACE/fpcup.log #remove any existing logs; use force to not generate error message if log does not exist
157156```
158157
159-Download/install using fpcup. Note it gets the SVN URL and desired revision ID from environment variables set by the Jenkins SVN plugin. Once again, adjust if you don't use x86 Linux.
160-
161-``` bash
158+Download/install using fpcup. Note it gets the SVN URL and desired revision ID from environment variables set by the Jenkins SVN plugin. Once again, adjust if you don't use x86 Linux.
159+```
162160/usr/local/bin/fpcup_linux_x86 --fpcbootstrapdir=$WORKSPACE/fpcbootstrap --fpcdir=$WORKSPACE --fpcuplinkname= --fpcURL=$SVN_URL --fpcrevision=$SVN_REVISION --keeplocalchanges --lazdir=$WORKSPACE/lazarus --lazlinkname= --logfilename=$WORKSPACE/fpcup.log --noconfirm --primary-config-path=$WORKSPACE/lazarusconfig --only=fpc
163161```
164162
165-Now check the fpc output in another build step. Note that fpcup uses a custom fpc.sh script to avoid problems with systemwide fpc.cfg. Once again, adjust if not on Linux x86.
166-
167-``` bash
163+Now check the fpc output in another build step. Note that fpcup uses a custom fpc.sh script to avoid problems with systemwide fpc.cfg. Once again, adjust if not on Linux x86.
164+```
168165$WORKSPACE/bin/i386-linux/fpc.sh -iD; $WORKSPACE/bin/i386-linux/fpc.sh -iW #get FPC version output to check if it was built correctly
169166```
170167
171-The last build step runs the "compiler test suite".
172-
173-``` bash
168+The last build step runs the "compiler test suite".
169+```
174170cd $WORKSPACE/tests; make all TEST_FPC=$WORKSPACE/bin/i386-linux/fpc.sh #make full doesn't work, can't delete file
175171```
176172
177-You could archive the test suite results using a Jenkins post-build step.
173+You could archive the test suite results using a Jenkins post-build step.
178174
179175## FPCUnit/DBTestframework tests with database output
180176
181-If you want to run the [[Databases|dbtestframework]] tests and output the results to a separated database server, you can use the testdbwriter programs. This lets you compare runs from various revisions - which are automatically built by Jenkins.
182-
183-This method of outputting test results to databases can also be used by other projects that use fpcunit tests - you'd have to use the testdbwriter listener and adjust the console runner to include that.
177+If you want to run the [[Databases|dbtestframework]] tests and output the results to a separated database server, you can use the testdbwriter programs. This lets you compare runs from various revisions - which are automatically built by Jenkins.
184178
185-Though this section contains a fair amount of setup, fortunately it is once only; each job will reuse the existing configuration.
179+This method of outputting test results to databases can also be used by other projects that use fpcunit tests - you'd have to use the testdbwriter listener and adjust the console runner to include that.
186180
187-You could of course also run the normal dbtestframework code with output to plain text or XML.
181+Though this section contains a fair amount of setup, fortunately it is once only; each job will reuse the existing configuration.
188182
189-Check if mercurial/hg is installed:
183+You could of course also run the normal dbtestframework code with output to plain text or XML.
190184
191-``` bash
185+Check if mercurial/hg is installed:
186+```
192187hg --help
193188```
194189
195-if not install it, e.g.
196-
197-``` bash
190+if not install it, e.g.
191+```
198192apt-get install mercurial
199193```
200194
201-Get the repository version into a fixed directory:
202-
203-``` bash
195+Get the repository version into a fixed directory:
196+```
204197mkdir -p /opt/testdbwriter
205-cd /opt
206-hg clone https://bitbucket.org/reiniero/testdbwriter #will create /opt/testdbwriter
207-cd /opt/testdbwriter
208-# the following 2 steps are not necessary but show you how you can update with newest changes in the repository if needed:
209-hg pull #get newest changes from remote repo
210-hg up #adapt local version to newest changes we just downloaded
198+ cd /opt
199+ hg clone https://bitbucket.org/reiniero/testdbwriter #will create /opt/testdbwriter
200+ cd /opt/testdbwriter
201+ # the following 2 steps are not necessary but show you how you can update with newest changes in the repository if needed:
202+ hg pull #get newest changes from remote repo
203+ hg up #adapt local version to newest changes we just downloaded
211204```
212205
213206### Database setup
214207
215-Now the files in this directory can be used to compile the test program with the FPC in each build. We will also need to setup our database connections.
208+Now the files in this directory can be used to compile the test program with the FPC in each build. We will also need to setup our database connections.
216209
217210#### Tested databases
218211
219-First the databases where the tests will run on. Please create an empty database (or at least one that the test user can thrash) on each db server that you want to test, and have a username and password ready.
212+First the databases where the tests will run on. Please create an empty database (or at least one that the test user can thrash) on each db server that you want to test, and have a username and password ready.
220213
221214Then edit database.ini, used by the db test framework tests (see [[Databases|Databases#Running_FPC_database_tests]]
222-
223-``` bash
215+```
224216cd /opt/testdbwriter/dbtests2db
225-cp database.ini.txt database.ini #copy over template to config file
226-nano database.ini # or another editor.
227-# now set up your credentials in each section
217+ cp database.ini.txt database.ini #copy over template to config file
218+ nano database.ini # or another editor.
219+ # now set up your credentials in each section
228220```
229221
230222#### Test results database
231223
232-Now the database where the results should go to.
233-
234-Set up a database with the instructions pointed to in the readme.txt file (e.g. use the *testdbwriter.sql* for Firebird/Interbase databases and *testdbwriter_postgresql.sql* for PostgreSQL databases).
224+Now the database where the results should go to.
235225
236-Now edit the ini file:
226+Set up a database with the instructions pointed to in the readme.txt file (e.g. use the _testdbwriter.sql_ for Firebird/Interbase databases and _testdbwriter_postgresql.sql_ for PostgreSQL databases).
237227
238-``` bash
228+Now edit the ini file:
229+```
239230cd /opt/testdbwriter/dbtests2db
240-cp ../testdbwriter.ini.txt testdbwriter.ini #copy over template to config file
241-nano testdbwriter.ini #or another editor
242-# now set up your credentials in the right section, and choose your profile/database in the [Database] section
231+ cp ../testdbwriter.ini.txt testdbwriter.ini #copy over template to config file
232+ nano testdbwriter.ini #or another editor
233+ # now set up your credentials in the right section, and choose your profile/database in the [Database] section
243234```
244235
245236### Adding the tests to your Jenkins job
246237
247-We'll put the dbtests2db.lpr console runner and the db output writer code it needs (testdbwriter.pas) into the directory where the dbtestframework tests live so dbtests2db can pick up those tests. Then we'll compile the test suite, and run it for each database you want to test.
248-
249-In your Jenkins job configuration, add an Execute shell build step to set up the test environment. Note: we copy forcing overwrites to avoid the script aborting the Jenkins job if the target exists:
238+We'll put the dbtests2db.lpr console runner and the db output writer code it needs (testdbwriter.pas) into the directory where the dbtestframework tests live so dbtests2db can pick up those tests. Then we'll compile the test suite, and run it for each database you want to test.
250239
251-``` bash
240+In your Jenkins job configuration, add an Execute shell build step to set up the test environment. Note: we copy forcing overwrites to avoid the script aborting the Jenkins job if the target exists:
241+```
252242cp -f /opt/testdbwriter/testdb* \
253-/opt/testdbwriter/dbtests2db/database.ini \
254-/opt/testdbwriter/dbtests2db/dbtests2db.lpr \
255--t $WORKSPACE/packages/fcl-db/tests/; \
256-cd $WORKSPACE/packages/fcl-db/tests; \
257-$WORKSPACE/bin/i386-linux/fpc.sh $WORKSPACE/packages/fcl-db/tests/dbtests2db.lpr \
258-#copy & compile db test program using the fpc dbtestframework tests
243+ /opt/testdbwriter/dbtests2db/database.ini \
244+ /opt/testdbwriter/dbtests2db/dbtests2db.lpr \
245+ -t $WORKSPACE/packages/fcl-db/tests/; \
246+ cd $WORKSPACE/packages/fcl-db/tests; \
247+ $WORKSPACE/bin/i386-linux/fpc.sh $WORKSPACE/packages/fcl-db/tests/dbtests2db.lpr \
248+ #copy & compile db test program using the fpc dbtestframework tests
259249```
260250
261-Then for each database you want to test, add test runs. The names of the database connectors you specify as arguments must match the section names in database.ini, e.g. postgresql, mysql40, mysql41, mysql50, oracle, interbase etc.
251+Then for each database you want to test, add test runs. The names of the database connectors you specify as arguments must match the section names in database.ini, e.g. postgresql, mysql40, mysql41, mysql50, oracle, interbase etc.
262252
263-> **Note:** The dbtests2db program requires that the database connector is the first parameter; we also pick up the subversion revision number from the Jenkins subversion module we use. The examples below show how you can add more information to the test results database.
253+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** The dbtests2db program requires that the database connector is the first parameter; we also pick up the subversion revision number from the Jenkins subversion module we use. The examples below show how you can add more information to the test results database.
264254
265-If you are testing multiple branches/versions of FPC (e.g. 2.6 and trunk) at the same time, you have a problem: the SVN revision number does not apply to branches but to the whole repository.
255+If you are testing multiple branches/versions of FPC (e.g. 2.6 and trunk) at the same time, you have a problem: the SVN revision number does not apply to branches but to the whole repository.
266256
267-This means that the code in the FPC fixes26 branch commit 2500 may be older than the code in the FPC trunk branch 2300. Fortunately, there is a solution: we prepend the revision number passed to the executable with a value (e.g. 020701 for FPC 2.7.1, 020600 for FPC 2.6.0). This serves to preserve the relative "newness" of the various branches... and permits running regression queries on the database to show e.g. that FPC trunk has a failing test where 2.6.0 succeeded.
257+This means that the code in the FPC fixes26 branch commit 2500 may be older than the code in the FPC trunk branch 2300. Fortunately, there is a solution: we prepend the revision number passed to the executable with a value (e.g. 020701 for FPC 2.7.1, 020600 for FPC 2.6.0). This serves to preserve the relative "newness" of the various branches... and permits running regression queries on the database to show e.g. that FPC trunk has a failing test where 2.6.0 succeeded.
268258
269-> **Note:** Older versions of this instruction proposed using
270->
271-> ``` bash
272-> --svnbranch="trunk"
273-> ```
274->
275-> which can also be done, but then you separate your testsuite hierarchies into different trees in the database. This does not allow running regression queries so easily.
259+![Light bulb](https://upload.wikimedia.org/wikipedia/commons/d/d8/Nuvola_apps_ktip.png) **Note:** Older versions of this instruction proposed using
260+```
261+--svnbranch="trunk"
262+```
276263
277-Examples:
264+which can also be done, but then you separate your testsuite hierarchies into different trees in the database. This does not allow running regression queries so easily.
278265
279-``` bash
266+Examples:
267+```
280268cd $WORKSPACE/packages/fcl-db/tests; \
281-$WORKSPACE/packages/fcl-db/tests/dbtests2db interbase --revisionid=020701$SVN_REVISION --comment="Jenkins trunk interbase"
269+ $WORKSPACE/packages/fcl-db/tests/dbtests2db interbase --revisionid=020701$SVN_REVISION --comment="Jenkins trunk interbase"
282270```
283271
284-With MySQL, as usual, the client version you installed on the Jenkins server has to match the version you specify here - in the example version 5.1:
285-
286-``` bash
272+With MySQL, as usual, the client version you installed on the Jenkins server has to match the version you specify here - in the example version 5.1:
273+```
287274cd $WORKSPACE/packages/fcl-db/tests; \
288-$WORKSPACE/packages/fcl-db/tests/dbtests2db mysql51 --revisionid=020701$SVN_REVISION --comment="Jenkins trunk mysql51"
275+ $WORKSPACE/packages/fcl-db/tests/dbtests2db mysql51 --revisionid=020701$SVN_REVISION --comment="Jenkins trunk mysql51"
289276```
290-
291-``` bash
277+```
292278cd $WORKSPACE/packages/fcl-db/tests; \
293-$WORKSPACE/packages/fcl-db/tests/dbtests2db postgresql --revisionid=020701$SVN_REVISION --comment="Jenkins trunk postgresql"
279+ $WORKSPACE/packages/fcl-db/tests/dbtests2db postgresql --revisionid=020701$SVN_REVISION --comment="Jenkins trunk postgresql"
294280```
295-
296-``` bash
281+```
297282cd $WORKSPACE/packages/fcl-db/tests; \
298-$WORKSPACE/packages/fcl-db/tests/dbtests2db sqlite --revisionid=020701$SVN_REVISION --comment="Jenkins trunk sqlite"
283+ $WORKSPACE/packages/fcl-db/tests/dbtests2db sqlite --revisionid=020701$SVN_REVISION --comment="Jenkins trunk sqlite"
299284```
300-
301-``` bash
285+```
302286cd $WORKSPACE/packages/fcl-db/tests; \
303-$WORKSPACE/packages/fcl-db/tests/dbtests2db bufdataset --revisionid=020701$SVN_REVISION --comment="Jenkins trunk bufdataset"
287+ $WORKSPACE/packages/fcl-db/tests/dbtests2db bufdataset --revisionid=020701$SVN_REVISION --comment="Jenkins trunk bufdataset"
304288```
305-
306-``` bash
289+```
307290cd $WORKSPACE/packages/fcl-db/tests; \
308-$WORKSPACE/packages/fcl-db/tests/dbtests2db dbase4 --revisionid=020701$SVN_REVISION --comment="Jenkins trunk dbase4"
291+ $WORKSPACE/packages/fcl-db/tests/dbtests2db dbase4 --revisionid=020701$SVN_REVISION --comment="Jenkins trunk dbase4"
309292```
310293
311-Note: with all this building and testing, your job running time may extend a bit. Please make sure you set the SVN polling interval to a big enough value to avoid building all the time.
294+Note: with all this building and testing, your job running time may extend a bit. Please make sure you set the SVN polling interval to a big enough value to avoid building all the time.
312295
313-If this works, you can see the test results on your database server, analyze regressions, test succcess percentages, etc.
296+If this works, you can see the test results on your database server, analyze regressions, test succcess percentages, etc.
314297
315298## Windows/Linux... build slave
316299
317-You can set up other machines apart from the Jenkins server to act as "slaves": they are controlled from Jenkins and used to run jobs.
300+You can set up other machines apart from the Jenkins server to act as "slaves": they are controlled from Jenkins and used to run jobs.
318301
319-This can be useful when running a Windows build/test run from a Linux server.
302+This can be useful when running a Windows build/test run from a Linux server.
320303
321-See [1](https://wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM) for details on how to set up Windows build slaves via DCOM (note: there are other ways to set up (Windows) build slaves; please refer to the Jenkins documentation)
304+See [[1]](<https://wiki.jenkins-ci.org/display/JENKINS/Windows+slaves+fail+to+start+via+DCOM>) for details on how to set up Windows build slaves via DCOM (note: there are other ways to set up (Windows) build slaves; please refer to the Jenkins documentation)
322305
323306## Enhancements
324307
325-Possible enhancements:
308+Possible enhancements:
326309
327-- run make install into a different prefix
328-- run Lazarus compile
329-- save dbtests2db results to XML, see if Jenkins supports that
330-- add installer builders
310+ * run make install into a different prefix
311+ * run Lazarus compile
312+ * save dbtests2db results to XML, see if Jenkins supports that
313+ * add installer builders
331314
332315## Troubleshooting
333316
334317### Build fails
335318
336-Your builds may fail because the user Jenkins runs under runs a different shell under a different user with a different path than you might expect.
319+Your builds may fail because the user Jenkins runs under runs a different shell under a different user with a different path than you might expect.
337320
338321### Find out which user Jenkins runs under
339322
340-If you have problems with scripts/shell commands in jobs not having permissions, it helps if you know which user Jenkins runs under. Try this command (or of course the documentation):
341-
342-``` bash
323+If you have problems with scripts/shell commands in jobs not having permissions, it helps if you know which user Jenkins runs under. Try this command (or of course the documentation):
324+```
343325ps aux |grep jenkins | grep -v grep | cut -d" " -f1 | uniq #perhaps only works if jenkins is running a job
344326```
345327
346-On Debian, it gives the tomcat6 user.
328+On Debian, it gives the tomcat6 user.
347329
348330## See also
349331
350-- [[Build server]]
332+ * [[Build server]]
351333
352334## External links
353335
354-- [First look on Jenkins pipelines with a simple Lazarus application](https://medium.com/@Zawuza/first-look-on-jenkins-pipelines-with-a-simple-lazarus-application-36c77af56829)
336+ * [First look on Jenkins pipelines with a simple Lazarus application](<https://medium.com/@Zawuza/first-look-on-jenkins-pipelines-with-a-simple-lazarus-application-36c77af56829>)
355337
356338---
357-*From the Free Pascal wiki, page "Jenkins", as it stood on 2022-08-16 after a change by Skalogryz, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
358-Category: CI/CD
339+*From the Free Pascal wiki, page "Jenkins", as the Internet Archive kept it on 2025-12-29, last changed on 2025-10-31. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history