Merge "Update cloud image Ubuntu18.04 mininet ovs"
[releng/builder.git] / docs / jenkins.rst
1 .. _odl-jenkins:
2
3 Jenkins
4 =======
5
6 The `Release Engineering Project <releng-wiki_>`_ consolidates the Jenkins jobs from
7 project-specific VMs to a single Jenkins server. Each OpenDaylight project
8 has a tab for their jobs on the `jenkins-master`_. The system utilizes
9 `Jenkins Job Builder <jjb-docs_>`_ for the creation and management of the
10 Jenkins jobs.
11
12 Sections:
13
14 .. contents::
15    :depth: 3
16    :local:
17
18 New Project Quick Start
19 -----------------------
20
21 This section attempts to provide details on how to get going as a new project
22 quickly with minimal steps. The rest of the guide should be read and understood
23 by those who need to create and contribute new job types that is not already
24 covered by the existing job templates provided by OpenDaylight's JJB repo.
25
26 As a new project you will be mainly interested in getting your jobs to appear
27 in the jenkins-master_ silo and this can be achieved by simply creating a
28 <project>.yaml in the releng/builder project's jjb directory.
29
30 .. code-block:: bash
31
32     git clone --recursive https://git.opendaylight.org/gerrit/releng/builder
33     cd builder
34     mkdir jjb/<new-project>
35
36 .. note:
37
38     releng/global-jjb is a submodule of releng/builder repository which
39     requires a git submodule update --init or using --recursive with git clone.
40     `releng-global-jjb`_
41
42 Where <new-project> should be the same name as your project's git repo in
43 Gerrit. If your project is called "aaa" then create a new jjb/aaa directory.
44
45 Next we will create <new-project>.yaml as follows:
46
47 .. code-block:: yaml
48
49     ---
50     - project:
51         name: <NEW_PROJECT>-carbon
52         jobs:
53           - '{project-name}-clm-{stream}'
54           - '{project-name}-integration-{stream}'
55           - '{project-name}-merge-{stream}'
56           - '{project-name}-verify-{stream}-{maven}-{jdks}'
57
58         project: '<NEW_PROJECT>'
59         project-name: '<NEW_PROJECT>'
60         stream: carbon
61         branch: 'master'
62         jdk: openjdk8
63         jdks:
64           - openjdk8
65         maven:
66           - mvn33:
67               mvn-version: 'mvn33'
68         mvn-settings: '<NEW_PROJECT>-settings'
69         mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
70         mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
71         dependencies: 'odlparent-merge-{stream},yangtools-merge-{stream},controller-merge-{stream}'
72         email-upstream: '[<NEW_PROJECT>] [odlparent] [yangtools] [controller]'
73         archive-artifacts: ''
74
75     - project:
76         name: <NEW_PROJECT>-sonar
77         jobs:
78           - '{project-name}-sonar'
79
80         project: '<NEW_PROJECT>'
81         project-name: '<NEW_PROJECT>'
82         branch: 'master'
83         mvn-settings: '<NEW_PROJECT>-settings'
84         mvn-goals: 'clean install -Dmaven.repo.local=/tmp/r -Dorg.ops4j.pax.url.mvn.localRepository=/tmp/r'
85         mvn-opts: '-Xmx1024m -XX:MaxPermSize=256m'
86
87 Replace all instances of <new-project> with the name of your project. This will
88 create the jobs with the default job types we recommend for Java projects. If
89 your project is participating in the simultanious-release and ultimately will
90 be included in the final distribution, it is required to add the following job
91 types into the job list for the release you are participating.
92
93
94 .. code-block:: yaml
95
96     - '{project-name}-distribution-check-{stream}'
97     - '{project-name}-validate-autorelease-{stream}'
98
99 If you'd like to explore the additional tweaking options available
100 please refer to the `Jenkins Job Templates`_ section.
101
102 Finally we need to push these files to Gerrit for review by the releng/builder
103 team to push your jobs to Jenkins.
104
105 .. code-block:: bash
106
107     git add jjb/<new-project>
108     git commit -sm "Add <new-project> jobs to Jenkins"
109     git review
110
111 This will push the jobs to Gerrit and your jobs will appear in Jenkins once the
112 releng/builder team has reviewed and merged your patch.
113
114 Jenkins Master
115 --------------
116
117 The `jenkins-master`_ is the home for all project's Jenkins jobs. All
118 maintenance and configuration of these jobs must be done via JJB through the
119 `releng-builder-repo`_. Project contributors can no longer edit the Jenkins jobs
120 directly on the server.
121
122 Build Minions
123 -------------
124
125 The Jenkins jobs are run on build minions (executors) which are created on an
126 as-needed basis. If no idle build minions are available a new VM is brought
127 up. This process can take up to 2 minutes. Once the build minion has finished a
128 job, it will be destroyed.
129
130 Our Jenkins master supports many types of dynamic build minions. If you are
131 creating custom jobs then you will need to have an idea of what type of minions
132 are available. The following are the current minion types and descriptions.
133 Minion Template Names are needed for jobs that take advantage of multiple
134 minions as they must be specifically called out by template name instead of
135 label.
136
137 Adding New Components to the Minions
138 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
139
140 If your project needs something added to one of the minions, you can help us
141 get things added faster by doing one of the following:
142
143 * Submit a patch to RelEng/Builder for the appropriate `jenkins-scripts`
144   definition which configure software during minion boot up.
145 * Submit a patch to RelEng/Builder for the `packer/provision` scripts that
146   configures software during minion instance imaging.
147 * Submit a patch to RelEng/Builder for the Packer's templates  in
148   the `packer/templates` directory that configures a new instance definition
149   along with changes in `packer/provision`.
150
151 Going the first route will be faster in the short term as we can inspect the
152 changes and make test modifications in the sandbox to verify that it works.
153
154 .. note::
155
156    The first route may add additional setup time considering this is run every
157    time the minion is booted.
158
159 The second and third routes, however, is better for the community as a whole as
160 it will allow others to utilize our Packer setups to replicate our systems more
161 closely. It is, however, more time consuming as an image snapshot needs to be
162 created based on the updated Packer definitions before it can be attached to the
163 Jenkins configuration on sandbox for validation testing.
164
165 In either case, the changes must be validated in the sandbox with tests to
166 make sure that we don't break current jobs and that the new software features
167 are operating as intended. Once this is done the changes will be merged and
168 the updates applied to the RelEng Jenkins production silo. Any changes to
169 files under `releng/builder/packer` will be validated and images would be built
170 triggered by verify-packer and merge-packer jobs.
171
172 Please note that the combination of a Packer definitions from `vars`, `templates`
173 and the `provision` scripts is what defines a given minion. For instance, a minion
174 may be defined as `centos7-builder` which is a combination of Packer OS image
175 definitions from `vars/centos.json`, Packer template definitions from
176 `templates/builder.json` and spinup scripts from `provision/builder.sh`.
177 This combination provides the full definition of the realized minion.
178
179 Jenkins starts a minion using the latest image which is built and linked into the
180 Jenkins configuration. Once the base instance is online Jenkins checks out the
181 RelEng/Builder repo on it and executes two scripts. The first is
182 `provision/baseline.sh`, which is a baseline for all of the minions.
183
184 The second is the specialized script, which handles any system updates,
185 new software installs or extra environment tweaks that don't make sense in a
186 snapshot. Examples could include installing new package or setting up a virtual
187 environment. Its imperative to ensure modifications to these spinup scripts have
188 considered time taken to install the packages, as this could increase the build
189 time for every job which runs on the image. After all of these scripts have
190 executed Jenkins will finally attach the minion as an actual minion and start
191 handling jobs on it.
192
193 Flavors
194 ^^^^^^^
195
196 Performance flavors come with dedicated CPUs and are not shared with other
197 accounts in the cloud so should ensure consistent performance.
198
199 .. list-table:: Flavors
200    :widths: auto
201    :header-rows: 1
202
203    * - Instance Type
204      - CPUs
205      - Memory
206
207    * - v3-standard-2
208      - 2
209      - 8
210
211    * - v3-standard-4
212      - 4
213      - 16
214
215    * - v3-standard-8
216      - 8
217      - 32
218
219    * - v3-standard-16
220      - 16
221      - 64
222
223    * - odl-highcpu-2
224      - 2
225      - 2
226
227    * - odl-highcpu-4
228      - 4
229      - 4
230
231    * - odl-highcpu-8
232      - 8
233      - 8
234
235 Pool: ODLVEX
236 ^^^^^^^^^^^^
237
238 .. raw:: html
239
240     <table class="table table-bordered">
241       <tr class="warning">
242         <td><b>Jenkins Labels</b><br/>
243           centos7-builder-2c-1g,<br/>
244           centos7-builder-2c-2g,<br/>
245           centos7-builder-2c-8g,<br/>
246           centos7-builder-4c-4g,<br/>
247           centos7-builder-8c-8g,<br/>
248           centos7-autorelease-4c-16g
249         </td>
250         <td><b>Minion Template names</b><br/>
251           prd-centos7-builder-2c-1g,<br/>
252           prd-centos7-builder-2c-2g,<br/>
253           prd-centos7-builder-2c-8g,<br/>
254           prd-centos7-builder-4c-4g,<br/>
255           prd-centos7-builder-8c-8g,<br/>
256           prd-centos7-autorelease-4c-16g
257         <td><b>Packer Template</b><br/>
258         releng/builder/packer/templates/builder.json</td>
259         <td><b>Playbook</b><br/>
260         releng/builder/packer/common-packer/provision/baseline.yaml</td>
261       </tr>
262       <tr>
263         <td colspan="4">
264           CentOS 7 build minion configured with OpenJDK 1.7 (Java7) and OpenJDK
265           1.8 (Java8) along with all the other components and libraries needed
266           for building any current OpenDaylight project. This is the label that
267           is used for all basic verify, merge and daily builds for
268           projects.
269         </td>
270       </tr>
271
272       <tr class="warning">
273         <td><b>Jenkins Labels</b><br/> centos7-robot-2c-2g</td>
274         <td><b>Minion Template names</b><br/> centos7-robot-2c-2g</td>
275         <td><b>Packer Template</b><br/>
276         releng/builder/packer/templates/robot.json</td>
277         <td><b>Playbook</b><br/> releng/builder/packer/provision/robot.yaml</td>
278       </tr>
279       <tr>
280         <td colspan="4">
281           CentOS 7 minion configured with OpenJDK 1.7 (Java7), OpenJDK
282           1.8 (Java8) and all the current packages used by the integration
283           project for doing robot driven jobs. If you are executing robot
284           framework jobs then your job should be using this as the minion that
285           you are tied to. This image does not contain the needed libraries for
286           building components of OpenDaylight, only for executing robot tests.
287         </td>
288       </tr>
289
290       <tr class="warning">
291         <td><b>Jenkins Labels</b><br/> ubuntu1804-mininet-ovs-28-2c-2g</td>
292         <td><b>Minion Template names</b><br/> ubuntu1804-mininet-ovs-28-2c-2g</td>
293         <td><b>Packer Template</b><br/> releng/builder/packer/templates/mininet-ovs-2.8.json</td>
294         <td><b>Playbook</b><br/> releng/builder/packer/provision//mininet-ovs-2.8.yaml</td>
295       </tr>
296       <tr>
297         <td colspan="4">
298           Ubuntu 18.04 (Bionic Beaver) system with ovs 2.8
299         </td>
300       </tr>
301
302       <tr class="warning">
303         <td><b>Jenkins Labels</b><br/> centos7-devstack-2c-4g</td>
304         <td><b>Minion Template names</b><br/> centos7-devstack-2c-4g</td>
305         <td><b>Packer Template</b><br/> releng/builder/packer/templates/devstack.json</td>
306         <td><b>Playbook</b><br/> releng/builder/packer/provision/devstack.yaml</td>
307       </tr>
308       <tr>
309         <td colspan="4">
310           CentOS 7 system purpose built for doing OpenStack testing using
311           DevStack. This minion is primarily targeted at the needs of the OVSDB
312           project. It has OpenJDK 1.7 (aka Java7) and OpenJDK 1.8 (Java8) and
313           other basic DevStack related bits installed.
314         </td>
315       </tr>
316
317       <tr class="warning">
318         <td><b>Jenkins Labels</b><br/> centos7-docker-2c-4g</td>
319         <td><b>Minion Template names</b><br/> centos7-docker-2c-4g</td>
320         <td><b>Packer Template</b><br/> releng/builder/packer/templates/docker.json</td>
321         <td><b>Playbook</b><br/> releng/builder/packer/common-packer/provision/docker.yaml</td>
322       </tr>
323       <tr>
324         <td colspan="4">
325           CentOS 7 system configured with OpenJDK 1.7 (aka Java7),
326           OpenJDK 1.8 (Java8) and Docker. This system was originally custom
327           built for the test needs of the OVSDB project but other projects have
328           expressed interest in using it.
329         </td>
330       </tr>
331
332     </table>
333
334 Pool: ODLVEX - HOT (Heat Orchestration Templates)
335 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
336
337 HOT integration enables to spin up integration labs servers for CSIT jobs
338 using heat, rathar than using jclouds (deprecated). Image names are updated
339 on the project specific job templates using the variable
340 `{odl,docker,openstack,tools}_system_image` followed by image name in the
341 format `<platform> - <template> - <date-stamp>`.
342
343 .. include:: cloud-images.rst
344
345 Creating Jenkins Jobs
346 ---------------------
347
348 Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML format
349 and uses them to configure Jenkins.
350
351 * `Jenkins Job Builder (JJB) documentation <jjb-docs_>`_
352 * `RelEng/Builder Gerrit <releng-builder-gerrit_>`_
353 * `RelEng/Builder Git repository <releng-builder-repo_>`_
354
355 Getting Jenkins Job Builder
356 ---------------------------
357
358 OpenDaylight uses Jenkins Job Builder to translate our in-repo YAML job
359 configuration into job descriptions suitable for consumption by Jenkins.
360 When testing new Jenkins Jobs in the `Jenkins Sandbox`_, you'll
361 need to use the `jenkins-jobs` executable to translate a set of jobs into
362 their XML descriptions and upload them to the sandbox Jenkins server.
363
364 We document `installing <Installing Jenkins Job Builder_>`_ `jenkins-jobs`
365 below.
366
367 Installing Jenkins Job Builder
368 ------------------------------
369
370 We recommend using `pip <Installing JJB using pip_>`_ to assist with JJB
371 installs, but we
372 also document `installing from a git repository manually
373 <Installing JJB Manually_>`_.
374 For both, we recommend using Python `Virtual Environments`_
375 to isolate JJB and its dependencies.
376
377 The `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file contains the currently
378 recommended JJB version. Because JJB is fairly unstable, it may be necessary
379 to debug things by installing different versions. This is documented for both
380 `pip-assisted <Installing JJB using pip_>`_ and `manual
381 <Installing JJB Manually_>`_ installs.
382
383 Virtual Environments
384 --------------------
385
386 For both `pip-assisted <Installing JJB using pip_>`_ and `manual
387 <Installing JJB Manually_>`_ JJB
388 installs, we recommend using `Python Virtual Environments <python-virtualenv_>`_
389 to manage JJB and its
390 Python dependencies. The `python-virtualenvwrapper`_ tool can help you do so.
391
392 Documentation is available for installing `python-virtualenvwrapper`_. On Linux
393 systems with pip (typical), they amount to:
394
395 .. code-block:: bash
396
397     sudo pip install virtualenvwrapper
398
399 A virtual environment is simply a directory that you install Python programs
400 into and then append to the front of your path, causing those copies to be
401 found before any system-wide versions.
402
403 Create a new virtual environment for JJB.
404
405 .. code-block:: bash
406
407     # Virtaulenvwrapper uses this dir for virtual environments
408     $ echo $WORKON_HOME
409     /home/daniel/.virtualenvs
410     # Make a new virtual environment
411     $ mkvirtualenv jjb
412     # A new venv dir was created
413     (jjb)$ ls -rc $WORKON_HOME | tail -n 1
414     jjb
415     # The new venv was added to the front of this shell's path
416     (jjb)$ echo $PATH
417     /home/daniel/.virtualenvs/jjb/bin:<my normal path>
418     # Software installed to venv, like pip, is found before system-wide copies
419     (jjb)$ command -v pip
420     /home/daniel/.virtualenvs/jjb/bin/pip
421
422 With your virtual environment active, you should install JJB. Your install will
423 be isolated to that virtual environment's directory and only visible when the
424 virtual environment is active.
425
426 You can easily leave and return to your venv. Make sure you activate it before
427 each use of JJB.
428
429 .. code-block:: bash
430
431     (jjb)$ deactivate
432     $ command -v jenkins-jobs
433     # No jenkins-jobs executable found
434     $ workon jjb
435     (jjb)$ command -v jenkins-jobs
436     $WORKON_HOME/jjb/bin/jenkins-jobs
437
438 Installing JJB using pip
439 ------------------------
440
441 The recommended way to install JJB is via pip.
442
443 First, clone the latest version of the `releng-builder-repo`_.
444
445 .. code-block:: bash
446
447     $ git clone --recursive https://git.opendaylight.org/gerrit/p/releng/builder.git
448
449 Before actually installing JJB and its dependencies, make sure you've `created
450 and activated <Virtual Environments_>`_ a virtual environment for JJB.
451
452 .. code-block:: bash
453
454     $ mkvirtualenv jjb
455
456 The recommended version of JJB to install is the version specified in the
457 `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file.
458
459 .. code-block:: bash
460
461     # From the root of the releng/builder repo
462     (jjb)$ pip install -r jjb/requirements.txt
463
464 To validate that JJB was successfully installed you can run this command:
465
466 .. code-block:: bash
467
468     (jjb)$ jenkins-jobs --version
469
470 TODO: Explain that only the currently merged jjb/requirements.txt is supported,
471 other options described below are for troubleshooting only.
472
473 To change the version of JJB specified by `builder/jjb/requirements.txt
474 <odl-jjb-requirements.txt_>`_
475 to install from the latest commit to the master branch of JJB's git repository:
476
477 .. code-block:: bash
478
479     $ cat jjb/requirements.txt
480     -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder#egg=jenkins-job-builder
481
482 To install from a tag, like 1.4.0:
483
484 .. code-block:: bash
485
486     $ cat jjb/requirements.txt
487     -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder@1.4.0#egg=jenkins-job-builder
488
489 Updating releng/builder repo or global-jjb
490 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
491
492 Follow these steps to update the releng/builder repo. The repo uses a submodule from
493 a global-jjb repo so that common source can be shared across different projects. This
494 requires updating the releng/builder repo periodically to pick up the changes. New
495 versions of jjb could also require updating the releng/builder repo. Follow the
496 previous steps earlier for updating jenkins-jobs using the
497 `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file. Ensure that the
498 version listed in the file is the currently supported version, otherwise install a
499 different version or simply upgrade using `pip install --upgrade jenkins-job-builder`.
500
501 The example below assumes the user has cloned releng/builder to `~/git/releng/builder`.
502 Update the repo, update the submodules and then submit a test to verify it works.
503
504 .. code-block:: bash
505
506     cd ~/git/releng/builder
507     git checkout master
508     git pull
509     git submodule update --init --recursive
510     jenkins-jobs --conf jenkins.ini test jjb/ netvirt-csit-1node-openstack-queens-upstream-stateful-fluorine
511
512 Installing JJB Manually
513 -----------------------
514
515 This section documents installing JJB from its manually cloned repository.
516
517 Note that `installing via pip <Installing JJB using pip_>`_ is typically simpler.
518
519 Checkout the version of JJB's source you'd like to build.
520
521 For example, using master:
522
523 .. code-block:: bash
524
525     $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
526
527 Using a tag, like 1.4.0:
528
529 .. code-block:: bash
530
531     $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
532     $ cd jenkins-job-builder
533     $ git checkout tags/1.4.0
534
535 Before actually installing JJB and its dependencies, make sure you've `created
536 and activated <Virtual Environments_>`_ a virtual environment for JJB.
537
538 .. code-block:: bash
539
540     $ mkvirtualenv jjb
541
542 You can then use JJB's `requirements.txt <jjb-requirements.txt_>`_ file to
543 install its
544 dependencies. Note that we're not using `sudo` to install as root, since we want
545 to make use of the venv we've configured for our current user.
546
547 .. code-block:: bash
548
549     # In the cloned JJB repo, with the desired version of the code checked out
550     (jjb)$ pip install -r requirements.txt
551
552 Then install JJB from the repo with:
553
554 .. code-block:: bash
555
556     (jjb)$ pip install .
557
558 To validate that JJB was successfully installed you can run this command:
559
560 .. code-block:: bash
561
562     (jjb)$ jenkins-jobs --version
563
564
565 Jenkins Job Templates
566 ---------------------
567
568 The OpenDaylight `RelEng/Builder <releng-builder-wiki_>`_ project provides
569 `jjb-templates`_ that can be used to define basic jobs.
570
571 The *Gerrit Trigger* listed in the jobs are keywords that can be used to
572 trigger the job to run manually by simply leaving a comment in Gerrit for the
573 patch you wish to trigger against.
574
575 All jobs have a default build-timeout value of 360 minutes (6 hrs) but can be
576 overrided via the opendaylight-infra-wrappers' build-timeout property.
577
578 TODO: Group jobs into categories: every-patch, after-merge, on-demand, etc.
579 TODO: Reiterate that "remerge" triggers all every-patch jobs at once,
580 because when only a subset of jobs is triggered, Gerrit forgets valid -1 from jobs outside the subset.
581 TODO: Document that only drafts and commit-message-only edits do not trigger every-patch jobs.
582 TODO: Document test-{project}-{feature} and test-{project}-all.
583
584 .. raw:: html
585
586     <table class="table table-bordered">
587       <tr class="warning">
588         <td><b>Job Template</b><br/>{project}-distribution-check-{stream}</td>
589         <td><b>Gerrit Trigger</b><br/>recheck</td>
590       </tr>
591       <tr>
592         <td colspan="2">
593           This job runs the PROJECT-distribution-check-BRANCH job which is
594           building also integration/distribution project in order to run SingleFeatureTest.
595           It also performs various other checks in order to prevent the change to break autorelease.
596         </td>
597       </tr>
598
599       <tr class="warning">
600         <td><b>Job Template</b><br/>{project}-integration-{stream}</td>
601         <td></td>
602       </tr>
603       <tr>
604         <td colspan="2">
605           The Integration Job Template creates a job which runs when a project that your
606           project depends on is successfully built. This job type is basically the same
607           as a verify job except that it triggers from other Jenkins jobs instead of via
608           Gerrit review updates. The dependencies that triger integration jobs are listed
609           in your project.cfg file under the <b>DEPENDENCIES</b> variable.
610
611           If no dependencies are listed then this job type is disabled by default.
612         </td>
613       </tr>
614
615       <tr class="warning">
616         <td><b>Job Template</b><br/>{project}-merge-{stream}</td>
617         <td><b>Gerrit Trigger</b><br/>remerge</td>
618       </tr>
619       <tr>
620         <td colspan="2">
621           This job will trigger once a Gerrit patch is merged into the repo.
622           It will build HEAD of the current project branch and also run the Maven goals
623           <b>source:jar</b> and <b>javadoc:jar</b>.
624           Artifacts are uploaded to OpenDaylight's
625           <a href="https://nexus.opendaylight.org">Nexus</a> on completion.
626
627           A distribution-merge-{stream} job is triggered to add the new artifacts to the
628           integration distribution.
629
630           Running the "remerge" trigger is possible before a Change is merged,
631           it would still build the actual HEAD. This job does not alter Gerrit votes.
632         </td>
633       </tr>
634
635       <tr class="warning">
636         <td><b>Job Template</b><br/>{project}-sonar</td>
637         <td><b>Gerrit Trigger</b><br/>run-sonar</td>
638       </tr>
639       <tr>
640         <td colspan="2">
641           This job runs Sonar analysis and reports the results to
642           OpenDaylight's <a href="https://sonar.opendaylight.org">Sonar</a>
643           dashboard.
644
645           The Sonar Job Template creates a job which will run against the
646           master branch, or if BRANCHES are specified in the CFG file it will
647           create a job for the <b>First</b> branch listed.
648
649           <div class="admonition note">
650             <p class="first admonition-title">Note</p>
651             <p>
652               Running the "run-sonar" trigger will cause Jenkins to remove
653               its existing vote if it's already -1'd or +1'd a comment. You
654               will need to re-run your verify job (recheck) after running
655               this to get Jenkins to re-vote.
656             </p>
657           </div>
658         </td>
659       </tr>
660
661       <tr class="warning">
662         <td><b>Job Template</b><br/>{project}-validate-autorelease-{stream}</td>
663         <td><b>Gerrit Trigger</b><br/>recheck</td>
664       </tr>
665       <tr>
666         <td colspan="2">
667           This job runs the PROJECT-validate-autorelease-BRANCH job which is
668           used as a quick sanity test to ensure that a patch does not depend on
669           features that do not exist in the current release.
670         </td>
671       </tr>
672
673       <tr class="warning">
674         <td><b>Job Template</b><br/>{project}-verify-{stream}-{maven}-{jdks}</td>
675         <td><b>Gerrit Trigger</b><br/>recheck</td>
676       </tr>
677       <tr>
678         <td colspan="2">
679           The Verify job template creates a Gerrit Trigger job that will
680           trigger when a new patch is submitted to Gerrit.
681           The job only builds the project code (including unit and integration tests).
682         </td>
683       </tr>
684
685       <tr class="warning">
686         <td><b>Job Template</b><br/>{project}-verify-node-{stream}</td>
687         <td><b>Gerrit Trigger</b><br/>recheck</td>
688       </tr>
689       <tr>
690         <td colspan="2">
691           This job template can be used by a project that is NodeJS based. It
692           simply installs a python virtualenv and uses that to install nodeenv
693           which is then used to install another virtualenv for nodejs. It then
694           calls <b>npm install</b> and <b>npm test</b> to run the unit tests.
695           When  using this template you need to provide a {nodedir} and
696           {nodever} containing the directory relative to the project root
697           containing the nodejs package.json and version of node you wish to
698           run tests with.
699         </td>
700       </tr>
701
702       <tr class="warning">
703         <td><b>Job Template</b><br/>{project}-verify-python-{stream} | {project}-verify-tox-{stream}</td>
704         <td><b>Gerrit Trigger</b><br/>recheck</td>
705       </tr>
706       <tr>
707         <td colspan="2">
708           This job template can be used by a project that uses Tox to build. It
709           simply installs a Python virtualenv and uses tox to run the tests
710           defined in the project's tox.ini file. If the tox.ini is anywhere
711           other than the project's repo root, the path to its directory
712           relative to the project's repo root should be passed as {toxdir}.
713
714           The 2 template names verify-python & verify-tox are identical and are
715           aliases to each other. This allows the project to use the naming that
716           is most reasonable for them.
717         </td>
718       </tr>
719
720       <tr class="warning">
721         <td><b>Job Template</b><br/>integration-patch-test-{stream}</td>
722         <td><b>Gerrit Trigger</b><br/>test-integration</td>
723       </tr>
724       <tr>
725         <td colspan="2">
726           This job builds a distribution against your Java patch and triggers distribution sanity CSIT jobs.
727           Leave a comment with trigger keyword above to activate it for a particular patch.
728           This job should not alter Gerrit votes for a given patch.
729
730           The list of CSIT jobs to trigger is defined in csit-list
731           <a href="https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jjb/integration/integration-test-jobs.yaml">here</a>.
732
733           Some considerations when using this job:
734           <ul>
735             <li>
736               The patch test verification takes some time (~2 hours) + consumes a lot of
737               resources so it is not meant to be used for every patch.
738             </li>
739             <li>
740               The system tests for master patches will fail most of the times because both
741               code and test are unstable during the release cycle (should be good by the
742               end of the cycle).
743             </li>
744             <li>
745               Because of the above, patch test results typically have to be interpreted by
746               system test experts. The <a href="https://wiki.opendaylight.org/view/Integration/Test">Integration/Test</a>
747               project can help with that.
748             </li>
749         </td>
750       </tr>
751
752       <tr class="warning">
753         <td><b>Job Template</b><br/>integration-multipatch-test-{stream}</td>
754         <td><b>Gerrit Trigger</b><br/>multipatch-build</td>
755       </tr>
756       <tr>
757         <td colspan="2">
758           This job builds a list of patches provided in an specific order, and finally builds
759           a distribution from either provided patch or latest code in branch.
760           For example if someone leaves the following comment in a patch:
761           multipatch-build:controller=61/29761/5:45/29645/6,neutron=51/65551/4,netvirt:59/60259/17
762           the job will checkout controller patch 61/29761/5, cherry-pick 45/29645/6 and build controller,
763           checkout neutron patch 51/65551/4 and build neutron, checkout latest netvirt code,
764           cherry-pick 59/60259/17 and build netvirt, finally it will checkout latest distribution
765           code and build a distribution. The resulting distribution is stored in Nexus and the URL
766           is stored in a variable called BUNDLE_URL visible in the job console.
767           This job also accepts a gerrit topic, for example: multipatch-build:topic=binding-tlc-rpc,
768           in this case the job will find all patches in the topic binding-tlc-rpc for the projects
769           specified in the BUILD_ORDER parameter and will build all projects from the first a patch
770           has been found, for successive projects the branch HEAD is used if no patch is found.
771           The job uses patch numbers to sort patches in the same project.
772           Use multipatch-build-fast (vs multipatch-build) for building projects fast (-Pq).
773           This job should not alter Gerrit votes for a given patch, nor will do anything with the
774           given patch unless the patch is added to the build list.
775         </td>
776       </tr>
777
778     </table>
779
780 Maven Properties
781 ----------------
782
783 We provide a properties which your job can take advantage of if you want to do
784 trigger a different configuration depending on job type. You can create a
785 profile that activates on a property listed below. The JJB templated jobs will
786 activate the profile during the build to run any custom code configuration you
787 wish to run for this job type.
788
789 .. code-block:: bash
790
791     -Dmerge   : The Merge job sets this flag and is the same as setting the
792                 Maven property <merge>true</merge>.
793     -Dsonar   : The Sonar job sets this flag and is the same as setting the
794                 Maven property <sonar>true</sonar>.
795
796 .. _odl-jenkins-sandbox:
797
798 Jenkins Sandbox
799 ---------------
800
801 URL: https://jenkins.opendaylight.org/sandbox
802
803 Jenkins Sandbox documentation is available in the
804 :doc:`LF Jenkins Sandbox Guide <lfdocs:jenkins-sandbox>`.
805
806 .. _example-jenkins.ini: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins.ini.example
807 .. _integration-test-wiki: https://wiki.opendaylight.org/view/Integration/Test
808 .. _jenkins-master: https://jenkins.opendaylight.org/releng
809 .. _jenkins.ini: http://docs.openstack.org/infra/jenkins-job-builder/execution.html#configuration-file
810 .. _jjb-autoupdate-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-autoupdate-project.py
811 .. _jjb-docs: http://ci.openstack.org/jenkins-job-builder/
812 .. _jjb-init-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-init-project.py
813 .. _jjb-repo: https://github.com/openstack-infra/jenkins-job-builder
814 .. _jjb-requirements.txt: https://opendev.org/jjb/jenkins-job-builder/raw/branch/master/requirements.txt
815 .. _jjb-templates: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jjb
816 .. _odl-jjb-requirements.txt: https://gerrit.linuxfoundation.org/infra/gitweb?p=releng/global-jjb.git;a=blob;f=requirements.txt;
817 .. _odl-nexus: https://nexus.opendaylight.org
818 .. _odl-sonar: https://sonar.opendaylight.org
819 .. _python-virtualenv: https://virtualenv.readthedocs.org/en/latest/
820 .. _python-virtualenvwrapper: https://virtualenvwrapper.readthedocs.org/en/latest/
821 .. _releng-wiki: https://docs.releng.linuxfoundation.org/en/latest/
822 .. _releng-builder-gerrit: https://git.opendaylight.org/gerrit/admin/repos/releng%2Fbuilder
823 .. _releng-builder-repo: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=summary
824 .. _releng-global-jjb: https://gerrit.linuxfoundation.org/infra/#/q/project:releng/global-jjb
825 .. _releng-builder-wiki: https://wiki.opendaylight.org/pages/viewpage.action?pageId=329336
826 .. _streams-design-background: https://lists.opendaylight.org/pipermail/release/2015-July/003139.html
827 .. _spinup-scripts: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jenkins-scripts
828 .. _spinup-scripts-basic_settings.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/basic_settings.sh
829 .. _spinup-scripts-controller.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/controller.sh