Merge "Set distro-check job time limit to 60 minutes"
[releng/builder.git] / docs / jenkins.rst
1 Jenkins
2 =======
3
4 The `Release Engineering Project <releng-wiki_>`_ consolidates the Jenkins jobs from
5 project-specific VMs to a single Jenkins server. Each OpenDaylight project
6 has a tab for their jobs on the `jenkins-master`_. The system utilizes
7 `Jenkins Job Builder <jjb-docs_>`_ for the creation and management of the
8 Jenkins jobs.
9
10 Sections:
11
12 .. contents::
13    :depth: 3
14    :local:
15
16 New Project Quick Start
17 -----------------------
18
19 This section attempts to provide details on how to get going as a new project
20 quickly with minimal steps. The rest of the guide should be read and understood
21 by those who need to create and contribute new job types that is not already
22 covered by the existing job templates provided by OpenDaylight's JJB repo.
23
24 As a new project you will be mainly interested in getting your jobs to appear
25 in the jenkins-master_ silo and this can be achieved by simply creating a
26 <project>.yaml in the releng/builder project's jjb directory.
27
28 .. code-block:: bash
29
30     git clone https://git.opendaylight.org/gerrit/releng/builder
31     cd builder
32     mkdir jjb/<new-project>
33
34 Where <new-project> should be the same name as your project's git repo in
35 Gerrit. So if your project is called "aaa" then create a new jjb/aaa directory.
36
37 Next we will create <new-project>.yaml as follows:
38
39 .. code-block:: yaml
40
41     - project:
42         name: <NEW_PROJECT>-carbon
43         jobs:
44             - '{project-name}-clm-{stream}'
45             - '{project-name}-distribution-{stream}'
46             - '{project-name}-integration-{stream}'
47             - '{project-name}-merge-{stream}'
48             - '{project-name}-periodic-{stream}'
49             - '{project-name}-verify-{stream}-{maven}-{jdks}'
50
51         project: '<NEW_PROJECT>'
52         project-name: '<NEW_PROJECT>'
53         stream: carbon
54         branch: 'master'
55         jdk: openjdk8
56         jdks:
57             - openjdk8
58         maven:
59             - mvn33:
60                 mvn-version: '{mvn33}'
61         mvn-settings: '<NEW_PROJECT>-settings'
62         mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
63         mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
64         dependencies: 'odlparent-merge-{stream},yangtools-merge-{stream},controller-merge-{stream}'
65         email-upstream: '[<NEW_PROJECT>] [odlparent] [yangtools] [controller]'
66         archive-artifacts: ''
67
68     - project:
69         name: <NEW_PROJECT>-sonar
70         jobs:
71             - '{project-name}-sonar'
72
73         project: '<NEW_PROJECT>'
74         project-name: '<NEW_PROJECT>'
75         branch: 'master'
76         mvn-settings: '<NEW_PROJECT>-settings'
77         mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
78         mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
79
80 Replace all instances of <new-project> with the name of your project. This will
81 create the jobs with the default job types we recommend for Java projects. If
82 your project is participating in the simultanious-release and ultimately will
83 be included in the final distribution. We recommend adding the following job
84 types into the job list for the release you are participating.
85
86
87 .. code-block:: yaml
88
89     - '{project-name}-distribution-check-{stream}'
90     - '{project-name}-validate-autorelease-{stream}'
91
92 If you'd like to explore the additional tweaking options available
93 please refer to the `Jenkins Job Templates`_ section.
94
95 Finally we need to push these files to Gerrit for review by the releng/builder
96 team to push your jobs to Jenkins.
97
98 .. code-block:: bash
99
100     git add jjb/<new-project>
101     git commit -sm "Add <new-project> jobs to Jenkins"
102     git review
103
104 This will push the jobs to Gerrit and your jobs will appear in Jenkins once the
105 releng/builder team has reviewed and merged your patch.
106
107 Jenkins Master
108 --------------
109
110 The `jenkins-master`_ is the home for all project's Jenkins jobs. All
111 maintenance and configuration of these jobs must be done via JJB through the
112 `releng-builder-repo`_. Project contributors can no longer edit the Jenkins jobs
113 directly on the server.
114
115 Build Minions
116 -------------
117
118 The Jenkins jobs are run on build minions (executors) which are created on an
119 as-needed basis. If no idle build minions are available a new VM is brought
120 up. This process can take up to 2 minutes. Once the build minion has finished a
121 job, it will remain online for 45 minutes before shutting down. Subsequent
122 jobs will use an idle build minion if available.
123
124 Our Jenkins master supports many types of dynamic build minions. If you are
125 creating custom jobs then you will need to have an idea of what type of minions
126 are available. The following are the current minion types and descriptions.
127 Minion Template Names are needed for jobs that take advantage of multiple
128 minions as they must be specifically called out by template name instead of
129 label.
130
131 Adding New Components to the Minions
132 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133
134 If your project needs something added to one of the minions, you can help us
135 get things added faster by doing one of the following:
136
137 * Submit a patch to RelEng/Builder for the `packer/provision`_ scripts that
138   configures your new piece of software during minion boot up.
139 * Submit a patch to RelEng/Builder for the Packer's templates  in
140   the `packer/templates`_ directory that configures your new piece of
141   software which get baked into the image.
142
143 Going the first route will be faster in the short term as we can inspect the
144 changes and make test modifications in the sandbox to verify that it works.
145
146 .. note::
147
148    The first route may add additional setup time considering this is run every
149    time the minion is booted.
150
151 The second route, however, is better for the community as a whole as it will
152 allow others to utilize our Packer setups to replicate our systems more
153 closely. It is, however, more time consuming as an image snapshot needs to be
154 created based on the updated Packer definitions before it can be attached to
155 the Jenkins configuration on sandbox for validation testing.
156
157 In either case, the changes must be validated in the sandbox with tests to
158 make sure that we don't break current jobs and that the new software features
159 are operating as intended. Once this is done the changes will be merged and
160 the updates applied to the RelEng Jenkins production silo. Any changes to
161 files under `releng/builder/packer`_ will be validated and images would be built
162 triggered by verify-packer and merge-packer jobs.
163
164 Please note that the combination of a Packer definitions from `vars`, `templates`
165 and the `provision` scripts is what defines a given minion. For instance, a minion
166 may be defined as `centos7-java-builder`_ which is a combination of Packer OS image
167 definitions from `vars/centos.json`_, Packer template definitions from
168 `templates/java-buidler.json` and spinup scripts from `provision/java-builder.sh`_.
169 This combination provides the full definition of the realized minion.
170
171 Jenkins starts a minion using the latest image which is built and linked into the
172 Jenkins configuration. Once the base instance is online Jenkins checks out the
173 RelEng/Builder repo on it and executes two scripts. The first is
174 `provision/baseline.sh`_, which is a baseline for all of the minions.
175
176 The second is the specialized script, which handles any system updates,
177 new software installs or extra environment tweaks that don't make sense in a
178 snapshot. Examples could include installing new package or setting up a virtual
179 environment. Its imperative to ensure modifications to these spinup scripts have
180 considered time taken to install the packages, as this could increase the build
181 time for every job which runs on the image. After all of these scripts have
182 executed Jenkins will finally attach the minion as an actual minion and start
183 handling jobs on it.
184
185 Pool: ODLRPC
186 ^^^^^^^^^^^^^^^^^^^
187
188 .. raw:: html
189
190     <table class="table table-bordered">
191       <tr class="warning">
192         <td><b>Jenkins Label</b><br/> dynamic_verify</td>
193         <td><b>Minion Template name</b><br/> centos7-builder</td>
194         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-builder</td>
195         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/builder.sh</td>
196       </tr>
197       <tr>
198         <td colspan="4">
199           A CentOS 7 huild minion. This system has OpenJDK 1.7 (Java7) and OpenJDK
200           1.8 (Java8) installed on it along with all the other components and
201           libraries needed for building any current OpenDaylight project. This is
202           the label that is used for all basic -verify and -daily- builds for
203           projects.
204         </td>
205       </tr>
206
207       <tr class="warning">
208         <td><b>Jenkins Label</b><br/> dynamic_merge</td>
209         <td><b>Minion Template name</b><br/> centos7-builder</td>
210         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-builder</td>
211         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/builder.sh</td>
212       </tr>
213       <tr>
214         <td colspan="4">
215           See dynamic_verify (same image on the back side). This is the label that
216           is used for all basic -merge and -integration- builds for projects.
217         </td>
218       </tr>
219
220       <tr class="warning">
221         <td><b>Jenkins Label</b><br/> matrix_master</td>
222         <td><b>Minion Template name</b><br/> centos7-matrix</td>
223         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
224         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/matrix.sh</td>
225       </tr>
226       <tr>
227         <td colspan="4">
228           This is a very minimal system that is designed to spin up with 2 build
229           instances on it. The purpose is to have a location that is not the
230           Jenkins master itself for jobs that are executing matrix operations
231           since they need a director location. This image should not be used for
232           anything but tying matrix jobs before the matrx defined label ties.
233         </td>
234       </tr>
235
236       <tr class="warning">
237         <td><b>Jenkins Label</b><br/> dynamic_robot</td>
238         <td><b>Minion Template name</b><br/> centos7-robot</td>
239         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/integration-robotframework</td>
240         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/robot.sh</td>
241       </tr>
242       <tr>
243         <td colspan="4">
244           A CentOS 7 minion that is configured with OpenJDK 1.7 (Java7), OpenJDK
245           1.8 (Java8) and all the current packages used by the integration
246           project for doing robot driven jobs. If you are executing robot
247           framework jobs then your job should be using this as the minion that
248           you are tied to. This image does not contain the needed libraries for
249           building components of OpenDaylight, only for executing robot tests.
250         </td>
251       </tr>
252
253       <tr class="warning">
254         <td><b>Jenkins Label</b><br/> ubuntu_mininet</td>
255         <td><b>Minion Template name</b><br/> ubuntu-trusty-mininet</td>
256         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ubuntu-mininet</td>
257         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
258       </tr>
259       <tr>
260         <td colspan="4">
261           Basic Ubuntu system with ovs 2.0.2 and mininet 2.1.0
262         </td>
263       </tr>
264
265       <tr class="warning">
266         <td><b>Jenkins Label</b><br/> ubuntu_mininet_ovs_23</td>
267         <td><b>Minion Template name</b><br/> ubuntu-trusty-mininet-ovs-23</td>
268         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ubuntu-mininet-ovs-23</td>
269         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
270       </tr>
271       <tr>
272         <td colspan="4">
273           Basic Ubuntu system with ovs 2.3 and mininet 2.2.1
274         </td>
275       </tr>
276
277       <tr class="warning">
278         <td><b>Jenkins Label</b><br/> ubuntu_mininet_ovs_25</td>
279         <td><b>Minion Template name</b><br/> ubuntu-trusty-mininet-ovs-25</td>
280         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ubuntu-mininet-ovs-25</td>
281         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
282       </tr>
283       <tr>
284         <td colspan="4">
285           Basic Ubuntu system with ovs 2.5 and mininet 2.2.2
286         </td>
287       </tr>
288
289       <tr class="warning">
290         <td><b>Jenkins Label</b><br/> dynamic_controller</td>
291         <td><b>Minion Template name</b><br/> centos7-java</td>
292         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
293         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/controller.sh</td>
294       </tr>
295       <tr>
296         <td colspan="4">
297           A CentOS 7 minion that has the basic OpenJDK 1.7 (Java7) and OpenJDK
298           1.8 (Java8) installed and is capable of running the controller, not
299           building.
300         </td>
301       </tr>
302
303       <tr class="warning">
304         <td><b>Jenkins Label</b><br/> dynamic_java</td>
305         <td><b>Minion Template name</b><br/> centos7-java</td>
306         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
307         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/controller.sh</td>
308       </tr>
309       <tr>
310         <td colspan="4">
311           See dynamic_controller as it is currently the same image.
312         </td>
313       </tr>
314
315       <tr class="warning">
316         <td><b>Jenkins Label</b><br/> dynamic_java_8g</td>
317         <td><b>Minion Template name</b><br/> centos7-java-8g</td>
318         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
319         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/controller.sh</td>
320       </tr>
321       <tr>
322         <td colspan="4">
323           See dynamic_controller as it is currently the same image but with 8G of RAM.
324         </td>
325       </tr>
326
327       <tr class="warning">
328         <td><b>Jenkins Label</b><br/> dynamic_devstack</td>
329         <td><b>Minion Template name</b><br/> centos7-devstack</td>
330         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ovsdb-devstack</td>
331         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/devstack.sh</td>
332       </tr>
333       <tr>
334         <td colspan="4">
335           A CentOS 7 system purpose built for doing OpenStack testing using
336           DevStack. This minion is primarily targeted at the needs of the OVSDB
337           project. It has OpenJDK 1.7 (aka Java7) and OpenJDK 1.8 (Java8) and
338           other basic DevStack related bits installed.
339         </td>
340       </tr>
341
342       <tr class="warning">
343         <td><b>Jenkins Label</b><br/> dynamic_docker</td>
344         <td><b>Minion Template name</b><br/> centos7-docker</td>
345         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ovsdb-docker</td>
346         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/docker.sh</td>
347       </tr>
348       <tr>
349         <td colspan="4">
350           A CentOS 7 system that is configured with OpenJDK 1.7 (aka Java7),
351           OpenJDK 1.8 (Java8) and Docker. This system was originally custom
352           built for the test needs of the OVSDB project but other projects have
353           expressed interest in using it.
354         </td>
355       </tr>
356
357       <tr class="warning">
358         <td><b>Jenkins Label</b><br/> gbp_trusty</td>
359         <td><b>Minion Template name</b><br/> gbp_trusty</td>
360         <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/gbp-ubuntu-docker-ovs-node</td>
361         <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/ubuntu-docker-ovs.sh</td>
362       </tr>
363       <tr>
364         <td colspan="4">
365           A basic Ubuntu node with latest OVS and docker installed. Used by Group Based Policy.
366         </td>
367       </tr>
368     </table>
369
370 Creating Jenkins Jobs
371 ---------------------
372
373 Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML format
374 and uses them to configure Jenkins.
375
376 * `Jenkins Job Builder (JJB) documentation <jjb-docs_>`_
377 * `RelEng/Builder Gerrit <releng-builder-gerrit_>`_
378 * `RelEng/Builder Git repository <releng-builder-repo_>`_
379
380 Getting Jenkins Job Builder
381 ---------------------------
382
383 OpenDaylight uses Jenkins Job Builder to translate our in-repo YAML job
384 configuration into job descriptions suitable for consumption by Jenkins.
385 When testing new Jenkins Jobs in the `Jenkins Sandbox`_, you'll
386 need to use the `jenkins-jobs` executable to translate a set of jobs into
387 their XML descriptions and upload them to the sandbox Jenkins server.
388
389 We document `installing <Installing Jenkins Job Builder_>`_ `jenkins-jobs`
390 below. We also provide
391 a `pre-built Docker image <jjb-docker_>`_ with `jenkins-jobs` already installed.
392
393 Installing Jenkins Job Builder
394 ------------------------------
395
396 For users who aren't already experienced with Docker or otherwise don't want
397 to use our `pre-built JJB Docker image <jjb-docker_>`_, installing JJB into a
398 virtual environment is an equally good option.
399
400 We recommend using `pip <Installing JJB using pip_>`_ to assist with JJB
401 installs, but we
402 also document `installing from a git repository manually
403 <Installing JJB Manually_>`_.
404 For both, we recommend using Python `Virtual Environments`_
405 to isolate JJB and its dependencies.
406
407 The `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file contains the currently
408 recommended JJB version. Because JJB is fairly unstable, it may be necessary
409 to debug things by installing different versions. This is documented for both
410 `pip-assisted <Installing JJB using pip_>`_ and `manual
411 <Installing JJB Manually_>`_ installs.
412
413 Virtual Environments
414 --------------------
415
416 For both `pip-assisted <Installing JJB using pip_>`_ and `manual
417 <Installing JJB Manually_>`_ JJB
418 installs, we recommend using `Python Virtual Environments <python-virtualenv_>`_
419 to manage JJB and its
420 Python dependencies. The `python-virtualenvwrapper`_ tool can help you do so.
421
422 There are good docs for installing `python-virtualenvwrapper`_. On Linux systems
423 with pip (typical), they amount to:
424
425 .. code-block:: bash
426
427     sudo pip install virtualenvwrapper
428
429 A virtual environment is simply a directory that you install Python programs
430 into and then append to the front of your path, causing those copies to be
431 found before any system-wide versions.
432
433 Create a new virtual environment for JJB.
434
435 .. code-block:: bash
436
437     # Virtaulenvwrapper uses this dir for virtual environments
438     $ echo $WORKON_HOME
439     /home/daniel/.virtualenvs
440     # Make a new virtual environment
441     $ mkvirtualenv jjb
442     # A new venv dir was created
443     (jjb)$ ls -rc $WORKON_HOME | tail -n 1
444     jjb
445     # The new venv was added to the front of this shell's path
446     (jjb)$ echo $PATH
447     /home/daniel/.virtualenvs/jjb/bin:<my normal path>
448     # Software installed to venv, like pip, is found before system-wide copies
449     (jjb)$ command -v pip
450     /home/daniel/.virtualenvs/jjb/bin/pip
451
452 With your virtual environment active, you should install JJB. Your install will
453 be isolated to that virtual environment's directory and only visible when the
454 virtual environment is active.
455
456 You can easily leave and return to your venv. Make sure you activate it before
457 each use of JJB.
458
459 .. code-block:: bash
460
461     (jjb)$ deactivate
462     $ command -v jenkins-jobs
463     # No jenkins-jobs executable found
464     $ workon jjb
465     (jjb)$ command -v jenkins-jobs
466     $WORKON_HOME/jjb/bin/jenkins-jobs
467
468 Installing JJB using pip
469 ------------------------
470
471 The recommended way to install JJB is via pip.
472
473 First, clone the latest version of the `releng-builder-repo`_.
474
475 .. code-block:: bash
476
477     $ git clone https://git.opendaylight.org/gerrit/p/releng/builder.git
478
479 Before actually installing JJB and its dependencies, make sure you've `created
480 and activated <Virtual Environments_>`_ a virtual environment for JJB.
481
482 .. code-block:: bash
483
484     $ mkvirtualenv jjb
485
486 The recommended version of JJB to install is the version specified in the
487 `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file.
488
489 .. code-block:: bash
490
491     # From the root of the releng/builder repo
492     (jjb)$ pip install -r jjb/requirements.txt
493
494 To validate that JJB was successfully installed you can run this command:
495
496 .. code-block:: bash
497
498     (jjb)$ jenkins-jobs --version
499
500 To change the version of JJB specified by `builder/jjb/requirements.txt
501 <odl-jjb-requirements.txt_>`_
502 to install from the latest commit to the master branch of JJB's git repository:
503
504 .. code-block:: bash
505
506     $ cat jjb/requirements.txt
507     -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder#egg=jenkins-job-builder
508
509 To install from a tag, like 1.4.0:
510
511 .. code-block:: bash
512
513     $ cat jjb/requirements.txt
514     -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder@1.4.0#egg=jenkins-job-builder
515
516 Installing JJB Manually
517 -----------------------
518
519 This section documents installing JJB from its manually cloned repository.
520
521 Note that `installing via pip <Installing JJB using pip_>`_ is typically simpler.
522
523 Checkout the version of JJB's source you'd like to build.
524
525 For example, using master:
526
527 .. code-block:: bash
528
529     $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
530
531 Using a tag, like 1.4.0:
532
533 .. code-block:: bash
534
535     $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
536     $ cd jenkins-job-builder
537     $ git checkout tags/1.4.0
538
539 Before actually installing JJB and its dependencies, make sure you've `created
540 and activated <Virtual Environments_>`_ a virtual environment for JJB.
541
542 .. code-block:: bash
543
544     $ mkvirtualenv jjb
545
546 You can then use JJB's `requirements.txt <jjb-requirements.txt_>`_ file to
547 install its
548 dependencies. Note that we're not using `sudo` to install as root, since we want
549 to make use of the venv we've configured for our current user.
550
551 .. code-block:: bash
552
553     # In the cloned JJB repo, with the desired version of the code checked out
554     (jjb)$ pip install -r requirements.txt
555
556 Then install JJB from the repo with:
557
558 .. code-block:: bash
559
560     (jjb)$ pip install .
561
562 To validate that JJB was successfully installed you can run this command:
563
564 .. code-block:: bash
565
566     (jjb)$ jenkins-jobs --version
567
568 JJB Docker Image
569 ----------------
570
571 `Docker <docker-docs_>`_ is an open platform used to create virtualized Linux containers
572 for shipping self-contained applications. Docker leverages LinuX Containers
573 \(LXC\) running on the same operating system as the host machine, whereas a
574 traditional VM runs an operating system over the host.
575
576 .. code-block:: bash
577
578     docker pull zxiiro/jjb-docker
579     docker run --rm -v ${PWD}:/jjb jjb-docker
580
581 This `Dockerfile <jjb-dockerfile_>`_ created the
582 `zxiiro/jjb-docker image <jjb-docker_>`_.
583 By default it will run:
584
585 .. code-block:: bash
586
587     jenkins-jobs test .
588
589 You'll need to use the `-v/--volume=[]` parameter to mount a directory
590 containing your YAML files, as well as a configured `jenkins.ini` file if you
591 wish to upload your jobs to the `Jenkins Sandbox`_.
592
593 Jenkins Job Templates
594 ---------------------
595
596 The OpenDaylight `RelEng/Builder <releng-builder-wiki_>`_ project provides
597 `jjb-templates`_ that can be used to define basic jobs.
598
599 The *Gerrit Trigger* listed in the jobs are keywords that can be used to
600 trigger the job to run manually by simply leaving a comment in Gerrit for the
601 patch you wish to trigger against.
602
603 All jobs have a default build-timeout value of 360 minutes (6 hrs) but can be
604 overrided via the opendaylight-infra-wrappers' build-timeout property.
605
606 .. raw:: html
607
608     <table class="table table-bordered">
609       <tr class="warning">
610         <td><b>Job Template</b><br/>{project}-distribution-{stream}</td>
611         <td><b>Gerrit Trigger</b><br/>test-distribution</td>
612       </tr>
613       <tr>
614         <td colspan="2">
615           This job builds a distrbution against your patch, tiggers distribution sanity CSIT jobs
616           and reports back the results to Gerrit. Leave a comment with trigger keyword above
617           to activate it for a particular patch.
618
619           This job is maintained by the <a href="https://wiki.opendaylight.org/view/Integration/Test">Integration/Test</a>
620           project.
621
622           <div class="admonition note">
623             <p class="first admonition-title">Note</p>
624             <p>
625               Running the "test-distribution" trigger will cause Jenkins to
626               remove it's existing vote if it's already -1 or +1'd a comment.
627               You will need to re-run your verify jobs (recheck) after running
628               this to get Jenkins to put back the correct vote.
629             </p>
630           </div>
631         </td>
632       </tr>
633
634       <tr class="warning">
635         <td><b>Job Template</b><br/>{project}-distribution-check-{stream}</td>
636         <td><b>Gerrit Trigger</b><br/>recheck | redistcheck</td>
637       </tr>
638       <tr>
639         <td colspan="2">
640           This job runs the PROJECT-distribution-check-BRANCH job which is
641           building also integration/distribution project in order to run SingleFeatureTest.
642
643           The <b>redistcheck</b> trigger is useful in cases where a project's
644           other jobs passed, however this job failed due to infra problems or
645           intermittent issues. It will retrigger just this job to save time.
646
647           BEWARE: If there were other failed jobs, redistcheck could lead
648           to false Verified+1 vote, risking a merge which breaks other projetcs.
649           Redistcheck is only for committers who are familiar with the risks involved.
650           If in doubt, use the safe trigger word: recheck.
651           Recheck triggers every job involved in verifying latest patch set in the Change.
652         </td>
653       </tr>
654
655       <tr class="warning">
656         <td><b>Job Template</b><br/>{project}-integration-{stream}</td>
657         <td></td>
658       </tr>
659       <tr>
660         <td colspan="2">
661           The Integration Job Template creates a job which runs when a project that your
662           project depends on is successfully built. This job type is basically the same
663           as a verify job except that it triggers from other Jenkins jobs instead of via
664           Gerrit review updates. The dependencies that triger integration jobs are listed
665           in your project.cfg file under the <b>DEPENDENCIES</b> variable.
666
667           If no dependencies are listed then this job type is disabled by default.
668         </td>
669       </tr>
670
671       <tr class="warning">
672         <td><b>Job Template</b><br/>{project}-merge-{stream}</td>
673         <td><b>Gerrit Trigger</b><br/>remerge</td>
674       </tr>
675       <tr>
676         <td colspan="2">
677           This job will trigger once a Gerrit patch is merged into the repo.
678           It will build HEAD of the current project branch and also run the Maven goals
679           <b>source:jar</b> and <b>javadoc:jar</b>.
680           Artifacts are uploaded to OpenDaylight's
681           <a href="https://nexus.opendaylight.org">Nexus</a> on completion.
682
683           Running the "remerge" trigger is possible before a Change is merged,
684           in which case it will cause Jenkins to remove it's existing vote
685           if it's already -1 or +1'd a comment.
686           You will need to re-run your verify jobs (recheck) after running
687           this to get Jenkins to put back the correct vote.
688         </td>
689       </tr>
690
691       <tr class="warning">
692         <td><b>Job Template</b><br/>{project}-sonar</td>
693         <td><b>Gerrit Trigger</b><br/>run-sonar</td>
694       </tr>
695       <tr>
696         <td colspan="2">
697           This job runs Sonar analysis and reports the results to
698           OpenDaylight's <a href="https://sonar.opendaylight.org">Sonar</a>
699           dashboard.
700
701           The Sonar Job Template creates a job which will run against the
702           master branch, or if BRANCHES are specified in the CFG file it will
703           create a job for the <b>First</b> branch listed.
704
705           <div class="admonition note">
706             <p class="first admonition-title">Note</p>
707             <p>
708               Running the "run-sonar" trigger will cause Jenkins to remove
709               its existing vote if it's already -1'd or +1'd a comment. You
710               will need to re-run your verify job (recheck) after running
711               this to get Jenkins to re-vote.
712             </p>
713           </div>
714         </td>
715       </tr>
716
717       <tr class="warning">
718         <td><b>Job Template</b><br/>{project}-validate-autorelease-{stream}</td>
719         <td><b>Gerrit Trigger</b><br/>recheck | revalidate</td>
720       </tr>
721       <tr>
722         <td colspan="2">
723           This job runs the PROJECT-validate-autorelease-BRANCH job which is
724           used as a quick sanity test to ensure that a patch does not depend on
725           features that do not exist in the current release.
726
727           The <b>revalidate</b> trigger is useful in cases where a project's
728           other job passed, however this job failed due to infra problems or
729           intermittent issues. It will retrigger just this job to save time.
730
731           BEWARE: If there were other failed jobs, revalidate could lead
732           to false Verified+1 vote, risking a merge which breaks other projetcs.
733           Revalidate is only for committers who are familiar with the risks involved.
734           If in doubt, use the safe trigger word: recheck.
735         </td>
736       </tr>
737
738       <tr class="warning">
739         <td><b>Job Template</b><br/>{project}-verify-{stream}-{maven}-{jdks}</td>
740         <td><b>Gerrit Trigger</b><br/>recheck | reverify</td>
741       </tr>
742       <tr>
743         <td colspan="2">
744           The Verify job template creates a Gerrit Trigger job that will
745           trigger when a new patch is submitted to Gerrit.
746           The job only builds the project code (including unit and integration tests).
747
748           The <b>reverify</b> trigger is useful in cases where a project's
749           other jobs passed however this job failed due to infra problems or
750           intermittent issues. It will retrigger just this job to save time.
751
752           BEWARE: If there were other failed jobs, reverify could lead
753           to false Verified+1 vote, risking a merge which breaks other projetcs.
754           Reverify is only for committers who are familiar with the risks involved.
755           If in doubt, use the safe trigger word: recheck.
756           Recheck triggers every job involved in verifying latest patch set in the Change.
757         </td>
758       </tr>
759
760       <tr class="warning">
761         <td><b>Job Template</b><br/>{project}-verify-node-{stream}</td>
762         <td><b>Gerrit Trigger</b><br/>recheck | renode</td>
763       </tr>
764       <tr>
765         <td colspan="2">
766           This job template can be used by a project that is NodeJS based. It
767           simply installs a python virtualenv and uses that to install nodeenv
768           which is then used to install another virtualenv for nodejs. It then
769           calls <b>npm install</b> and <b>npm test</b> to run the unit tests.
770           When  using this template you need to provide a {nodedir} and
771           {nodever} containing the directory relative to the project root
772           containing the nodejs package.json and version of node you wish to
773           run tests with.
774
775           The <b>renode</b> trigger is useful in cases where a project's
776           other jobs passed, however this job failed due to infra problems or
777           intermittent issues. It will retrigger just this job to save time.
778
779           BEWARE: If there were other failed jobs, renode could lead
780           to false Verified+1 vote, risking a merge which breaks other projetcs.
781           Renode is only for committers who are familiar with the risks involved.
782           If in doubt, use the safe trigger word: recheck.
783           Recheck triggers every job involved in verifying latest patch set in the Change.
784         </td>
785       </tr>
786
787       <tr class="warning">
788         <td><b>Job Template</b><br/>{project}-verify-python-{stream} | {project}-verify-tox-{stream}</td>
789         <td><b>Gerrit Trigger</b><br/>recheck | retox</td>
790       </tr>
791       <tr>
792         <td colspan="2">
793           This job template can be used by a project that uses Tox to build. It
794           simply installs a Python virtualenv and uses tox to run the tests
795           defined in the project's tox.ini file. If the tox.ini is anywhere
796           other than the project's repo root, the path to its directory
797           relative to the project's repo root should be passed as {toxdir}.
798
799           The 2 template names verify-python & verify-tox are identical and are
800           aliases to each other. This allows the project to use the naming that
801           is most reasonable for them.
802
803           The <b>retox</b> trigger is useful in cases where a project's
804           other verify jobs passed, however this job failed due to infra problems or
805           intermittent issues. It will retrigger just this job to save time.
806
807           BEWARE: If there were other failed jobs, retox could lead
808           to false Verified+1 vote, risking a merge which breaks other projetcs.
809           Retox is only for committers who are familiar with the risks involved.
810           If in doubt, use the safe trigger word: recheck.
811           Recheck triggers every job involved in verifying latest patch set in the Change.
812         </td>
813       </tr>
814
815       <tr class="warning">
816         <td><b>Job Template</b><br/>integration-patch-test-{stream}</td>
817         <td><b>Gerrit Trigger</b><br/>test-integration</td>
818       </tr>
819       <tr>
820         <td colspan="2">
821           This job runs a full integration test suite against your patch and
822           reports back the results to Gerrit. Leave a comment with trigger
823           keyword above to activate it for a particular patch.
824
825           It then spawns the list of jobs in csit-list defined
826           <a href="https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jjb/integration/integration-test-jobs.yaml">here</a>.
827
828           This job is maintained by the <a href="https://wiki.opendaylight.org/view/Integration/Test">Integration/Test</a>
829           project.
830
831           <div class="admonition note">
832             <p class="first admonition-title">Note</p>
833             <p>
834               Running the "test-integration" trigger will cause Jenkins to remove
835               it's existing vote if it's already -1 or +1'd a comment. You will need
836               to re-run your verify job (recheck) after running this to get Jenkins
837               to put back the correct vote.
838             </p>
839           </div>
840
841           Some considerations when using this job:
842           <ul>
843             <li>
844               The patch test verification takes some time (~2 hours) + consumes a lot of
845               resources so it is not meant to be used for every patch.
846             </li>
847             <li>
848               The system tests for master patches will fail most of the times because both
849               code and test are unstable during the release cycle (should be good by the
850               end of the cycle).
851             </li>
852             <li>
853               Because of the above, patch test results typically have to be interpreted by
854               system test experts. The <a href="https://wiki.opendaylight.org/view/Integration/Test">Integration/Test</a>
855               project can help with that.
856             </li>
857         </td>
858       </tr>
859     </table>
860
861 Maven Properties
862 ----------------
863
864 We provide a properties which your job can take advantage of if you want to do
865 something different depending on the job type that is run. If you create a
866 profile that activates on a property listed blow. The JJB templated jobs will
867 be able to activate the profile during the build to run any custom code you
868 wish to run in your project.
869
870 .. code-block:: bash
871
872     -Dmerge   : This flag is passed in our Merge job and is equivalent to the
873                 Maven property
874                 <merge>true</merge>.
875     -Dsonar   : This flag is passed in our Sonar job and is equivalent to the
876                 Maven property
877                 <sonar>true</sonar>.
878
879 Jenkins Sandbox
880 ---------------
881
882 The `jenkins-sandbox`_ instance's purpose is to allow projects to test their JJB
883 setups before merging their code over to the RelEng master silo. It is
884 configured similarly to the master instance, although it cannot publish
885 artifacts or vote in Gerrit.
886
887 If your project requires access to the sandbox please open an OpenDaylight
888 Helpdesk ticket (<helpdesk@opendaylight.org>) and provide your ODL ID.
889
890 Notes Regarding the Sandbox
891 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
892
893 * Jobs are automatically deleted every Saturday at 08:00 UTC
894 * Committers can login and configure Jenkins jobs in the sandbox directly
895   (unlike with the master silo)
896 * Sandbox configuration mirrors the master silo when possible
897 * Sandbox jobs can NOT upload artifacts to Nexus
898 * Sandbox jobs can NOT vote on Gerrit
899
900 Configuration
901 ^^^^^^^^^^^^^
902
903 Make sure you have Jenkins Job Builder [properly installed](#jjb_install).
904
905 If you do not already have access, open an OpenDaylight Helpdesk ticket
906 (<helpdesk@opendaylight.org>) to request access to ODL's sandbox instance.
907 Integration/Test (`integration-test-wiki`_) committers have access by default.
908
909 JJB reads user-specific configuration from a `jenkins.ini`_. An
910 example is provided by releng/builder at `example-jenkins.ini`_.
911
912 .. code-block:: bash
913
914     # If you don't have RelEng/Builder's repo, clone it
915     $ git clone https://git.opendaylight.org/gerrit/p/releng/builder.git
916     # Make a copy of the example JJB config file (in the builder/ directory)
917     $ cp jenkins.ini.example jenkins.ini
918     # Edit jenkins.ini with your username, API token and ODL's sandbox URL
919     $ cat jenkins.ini
920     <snip>
921     [jenkins]
922     user=<your ODL username>
923     password=<your ODL Jenkins sandbox API token>
924     url=https://jenkins.opendaylight.org/sandbox
925     <snip>
926
927 To get your API token, `login to the Jenkins **sandbox** instance
928 <jenkins-sandbox-login_>`_ (*not
929 the main master Jenkins instance, different tokens*), go to your user page (by
930 clicking on your username, for example), click "Configure" and then "Show API
931 Token".
932
933 Manual Method
934 ^^^^^^^^^^^^^
935
936 If you `installed JJB locally into a virtual environment
937 <Installing Jenkins Job Builder_>`_,
938 you should now activate that virtual environment to access the `jenkins-jobs`
939 executable.
940
941 .. code-block:: bash
942
943     $ workon jjb
944     (jjb)$
945
946 You'll want to work from the root of the RelEng/Builder repo, and you should
947 have your `jenkins.ini` file [properly configured](#sandbox_config).
948
949 Testing Jobs
950 ^^^^^^^^^^^^
951
952 It's good practice to use the `test` command to validate your JJB files before
953 pushing them.
954
955 .. code-block:: bash
956
957     jenkins-jobs --conf jenkins.ini test jjb/ <job-name>
958
959 If the job you'd like to test is a template with variables in its name, it
960 must be manually expanded before use. For example, the commonly used template
961 `{project}-csit-verify-1node-{functionality}` might expand to
962 `ovsdb-csit-verify-1node-netvirt`.
963
964 .. code-block:: bash
965
966     jenkins-jobs --conf jenkins.ini test jjb/ ovsdb-csit-verify-1node-netvirt
967
968 Successful tests output the XML description of the Jenkins job described by
969 the specified JJB job name.
970
971 Pushing Jobs
972 ^^^^^^^^^^^^
973
974 Once you've `configured your \`jenkins.ini\` <Configuration_>`_ and `verified your
975 JJB jobs <Testing Jobs_>`_ produce valid XML descriptions of Jenkins jobs you
976 can push them to the Jenkins sandbox.
977
978 .. important::
979
980     When pushing with `jenkins-jobs`, a log message with the number
981     of jobs you're pushing will be issued, typically to stdout.
982     **If the number is greater than 1** (or the number of jobs you
983     passed to the command to push) then you are pushing too many
984     jobs and should **`ctrl+c` to cancel the upload**. Else you will
985     flood the system with jobs.
986
987     .. code-block:: bash
988
989         INFO:jenkins_jobs.builder:Number of jobs generated:  1
990
991     **Failing to provide the final `<job-name>` param will push all
992     jobs!**
993
994     .. code-block:: bash
995
996         # Don't push all jobs by omitting the final param! (ctrl+c to abort)
997         jenkins-jobs --conf jenkins.ini update jjb/ <job-name>
998
999 Running Jobs
1000 ^^^^^^^^^^^^
1001
1002 Once you have your Jenkins job configuration `pushed to the
1003 Sandbox <Pushing Jobs_>`_ you can trigger it to run.
1004
1005 Find your newly-pushed job on the `Sandbox's web UI <jenkins-sandbox_>`_. Click
1006 on its name to see the job's details.
1007
1008 Make sure you're `logged in <jenkins-sandbox-login_>`_ to the Sandbox.
1009
1010 Click "Build with Parameters" and then "Build".
1011
1012 Wait for your job to be scheduled and run. Click on the job number to see
1013 details, including console output.
1014
1015 Make changes to your JJB configuration, re-test, re-push and re-run until
1016 your job is ready.
1017
1018 Docker Method
1019 ^^^^^^^^^^^^^
1020
1021 If `using Docker <JJB Docker image_>`_:
1022
1023 .. code-block:: bash
1024
1025     # To test
1026     docker run --rm -v ${PWD}:/jjb zxiiro/jjb-docker
1027
1028 .. important::
1029
1030     When pushing with `jenkins-jobs`, a log message with
1031     the number of jobs you're pushing will be issued, typically to stdout.
1032     **If the number is greater than 1** (or the number of jobs you passed to
1033     the command to push) then you are pushing too many jobs and should **`ctrl+c`
1034     to cancel the upload**. Else you will flood the system with jobs.
1035
1036     .. code-block:: bash
1037
1038           INFO:jenkins_jobs.builder:Number of jobs generated:  1
1039
1040     **Failing to provide the final `<job-name>` param will push all jobs!**
1041
1042     .. code-block:: bash
1043
1044         # To upload jobs to the sandbox
1045         # Please ensure that you include a configured jenkins.ini in your volume mount
1046         # Making sure not to push more jobs than expected, ctrl+c to abort
1047         docker run --rm -v ${PWD}:/jjb zxiiro/jjb-docker jenkins-jobs --conf jenkins.ini update . openflowplugin-csit-periodic-1node-cds-longevity-only-master
1048
1049 .. _docker-docs: https://www.docker.com/whatisdocker/
1050 .. _example-jenkins.ini: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins.ini.example
1051 .. _integration-test-wiki: https://wiki.opendaylight.org/view/Integration/Test
1052 .. _jenkins-master: https://jenkins.opendaylight.org/releng
1053 .. _jenkins-sandbox: https://jenkins.opendaylight.org/sandbox
1054 .. _jenkins-sandbox-login: https://jenkins.opendaylight.org/sandbox/login
1055 .. _jenkins.ini: http://docs.openstack.org/infra/jenkins-job-builder/execution.html#configuration-file
1056 .. _jjb-autoupdate-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-autoupdate-project.py
1057 .. _jjb-docker: https://hub.docker.com/r/zxiiro/jjb-docker/
1058 .. _jjb-dockerfile: https://github.com/zxiiro/jjb-docker/blob/master/Dockerfile
1059 .. _jjb-docs: http://ci.openstack.org/jenkins-job-builder/
1060 .. _jjb-init-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-init-project.py
1061 .. _jjb-repo: https://github.com/openstack-infra/jenkins-job-builder
1062 .. _jjb-requirements.txt: https://github.com/openstack-infra/jenkins-job-builder/blob/master/requirements.txt
1063 .. _jjb-templates: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jjb
1064 .. _odl-jjb-requirements.txt: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jjb/requirements.txt
1065 .. _odl-nexus: https://nexus.opendaylight.org
1066 .. _odl-sonar: https://sonar.opendaylight.org
1067 .. _python-virtualenv: https://virtualenv.readthedocs.org/en/latest/
1068 .. _python-virtualenvwrapper: https://virtualenvwrapper.readthedocs.org/en/latest/
1069 .. _releng-wiki: https://wiki.opendaylight.org/view/RelEng:Main
1070 .. _releng-builder-gerrit: https://git.opendaylight.org/gerrit/#/admin/projects/releng/builder
1071 .. _releng-builder-repo: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=summary
1072 .. _releng-builder-wiki: https://wiki.opendaylight.org/view/RelEng/Builder
1073 .. _streams-design-background: https://lists.opendaylight.org/pipermail/release/2015-July/003139.html
1074 .. _spinup-scripts: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jenkins-scripts
1075 .. _spinup-scripts-basic_settings.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/basic_settings.sh
1076 .. _spinup-scripts-controller.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/controller.sh
1077 .. _vagrant-basic-java-node: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=vagrant/basic-java-node
1078 .. _vagrant-definitions: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=vagrant