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
16 New Project Quick Start
17 -----------------------
21 We will be revamping releng/builder in the near future to simplify
24 This section attempts to provide details on how to get going as a new project
25 quickly with minimal steps. The rest of the guide should be read and understood
26 by those who need to create and contribute new job types that is not already
27 covered by the existing job templates provided by OpenDaylight's JJB repo.
29 As a new project you will be mainly interested in getting your jobs to appear
30 in the jenkins-master_ silo and this can be achieved by simply creating 2 files
31 project.cfg and project.yaml in the releng/builder project's jjb directory.
35 git clone https://git.opendaylight.org/gerrit/releng/builder
37 mkdir jjb/<new-project>
39 Where <new-project> should be the same name as your project's git repo in
40 Gerrit. So if your project is called "aaa" then create a new jjb/aaa directory.
42 Next we will create <new-project>.yaml as follows:
44 # REMOVE THIS LINE IF YOU WANT TO CUSTOMIZE ANYTHING BELOW
46 That's right all you need is the above comment in this file. Jenkins will
47 automatically regenerate this file when your patch is merged so we do not need
48 to do anything special here.
50 Next we will create <new-project>.cfg as follows:
58 DEPENDENCIES: odlparent,controller,yangtools
60 This is the minimal required CFG file contents and is used to auto-generate the
61 YAML file. If you'd like to explore the additional tweaking options available
62 please refer to the `Tuning Templates`_ section.
64 Finally we need to push these files to Gerrit for review by the releng/builder
65 team to push your jobs to Jenkins.
69 git add jjb/<new-project>
70 git commit -sm "Add <new-project> jobs to Jenkins"
73 This will push the jobs to Gerrit and your jobs will appear in Jenkins once the
74 releng/builder team has reviewed and merged your patch.
79 The `jenkins-master`_ is the home for all project's Jenkins jobs. All
80 maintenance and configuration of these jobs must be done via JJB through the
81 `releng-builder-repo`_. Project contributors can no longer edit the Jenkins jobs
82 directly on the server.
87 The Jenkins jobs are run on build slaves (executors) which are created on an
88 as-needed basis. If no idle build slaves are available a new VM is brought
89 up. This process can take up to 2 minutes. Once the build slave has finished a
90 job, it will remain online for 45 minutes before shutting down. Subsequent
91 jobs will use an idle build slave if available.
93 Our Jenkins master supports many types of dynamic build slaves. If you are
94 creating custom jobs then you will need to have an idea of what type of slaves
95 are available. The following are the current slave types and descriptions.
96 Slave Template Names are needed for jobs that take advantage of multiple
97 slaves as they must be specifically called out by template name instead of
100 Adding New Components to the Slaves
101 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
103 If your project needs something added to one of the slaves used during build
104 and test you can help us get things added faster by doing one of the following:
106 * Submit a patch to RelEng/Builder for the `spinup-scripts`_ that
107 configures your new piece of software.
108 * Submit a patch to RelEng/Builder for the Vagrant template's bootstrap.sh in
109 the `vagrant-definitions`_ directory that configures your new piece of
112 Going the first route will be faster in the short term as we can inspect the
113 changes and make test modifications in the sandbox to verify that it works.
115 The second route, however, is better for the community as a whole as it will
116 allow others that utilize our Vagrant setups to replicate our systems more
117 closely. It is, however, more time consuming as an image snapshot needs to be
118 created based on the updated Vagrant definition before it can be attached to
119 the sandbox for validation testing.
121 In either case, the changes must be validated in the sandbox with tests to
122 make sure that we don't break current jobs and that the new software features
123 are operating as intended. Once this is done the changes will be merged and
124 the updates applied to the RelEng Jenkins production silo.
126 Please note that the combination of a Vagrant slave snapshot and a Jenkins
127 spinup script is what defines a given slave. For instance, a slave may be
128 defined by the `vagrant-basic-java-node`_ Vagrant definition
129 and the `spinup-scripts-controller.sh`_ Jenkins spinup script
130 (as the dynamic\_controller slave is). The pair provides the full definition of
131 the realized slave. Jenkins starts a slave using the last-spun Vagrant snapshot
132 for the specified definition. Once the base Vagrant instance is online Jenkins
133 checks out the RelEng/Builder repo on it and executes two scripts. The first is
134 `spinup-scripts-basic_settings.sh`_, which is a baseline for all of the slaves.
136 the specialized spinup script, which handles any system updates, new software
137 installs or extra environment tweaks that don't make sense in a snapshot. After
138 all of these scripts have executed Jenkins will finally attach the slave as an
139 actual slave and start handling jobs on it.
141 Pool: Rackspace - Docker
142 ^^^^^^^^^^^^^^^^^^^^^^^^
148 <td><b>Jenkins Label</b><br/> dynamic_docker</td>
149 <td><b>Slave Template name</b><br/> rk-f20-docker</td>
150 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ovsdb-docker</td>
151 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/docker.sh</td>
155 A Fedora 20 system that is configured with OpenJDK 1.7 (aka Java7) and
156 Docker. This system was originally custom built for the test needs of
157 the OVSDB project but other projects have expressed interest in using
170 <td><b>Jenkins Label</b><br/> dynamic_verify</td>
171 <td><b>Slave Template name</b><br/> rk-c-el65-build</td>
172 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-builder</td>
173 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/builder.sh</td>
177 A CentOS 6 build slave. This system has OpenJDK 1.7 (Java7) and OpenJDK
178 1.8 (Java8) installed on it along with all the other components and
179 libraries needed for building any current OpenDaylight project. This is
180 the label that is used for all basic -verify and -daily- builds for
188 <td><b>Jenkins Label</b><br/> dynamic_merge</td>
189 <td><b>Slave Template name</b><br/> rk-c-el65-build</td>
190 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-builder</td>
191 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/builder.sh</td>
195 See dynamic_verify (same image on the back side). This is the label that
196 is used for all basic -merge and -integration- builds for projects.
201 Pool: Rackspace DFW - Devstack
202 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
208 <td><b>Jenkins Label</b><br/> dynamic_devstack</td>
209 <td><b>Slave Template name</b><br/> rk-c7-devstack</td>
210 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ovsdb-devstack</td>
211 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/devstack.sh</td>
215 A CentOS 7 system purpose built for doing OpenStack testing using
216 DevStack. This slave is primarily targeted at the needs of the OVSDB
217 project. It has OpenJDK 1.7 (aka Java7) and other basic DevStack related
223 Pool: Rackspace DFW - Integration
224 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
230 <td><b>Jenkins Label</b><br/> dynamic_robot</td>
231 <td><b>Slave Template name</b><br/> rk-c-el6-robot</td>
232 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/integration-robotframework</td>
233 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/robot.sh</td>
237 A CentOS 6 slave that is configured with OpenJDK 1.7 (Java7) and all the
238 current packages used by the integration project for doing robot driven
239 jobs. If you are executing robot framework jobs then your job should be
240 using this as the slave that you are tied to. This image does not
241 contain the needed libraries for building components of OpenDaylight,
242 only for executing robot tests.
247 Pool: Rackspace DFW - Integration Dynamic Lab
248 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
254 <td><b>Jenkins Label</b><br/> dynamic_controller</td>
255 <td><b>Slave Template name</b><br/> rk-c-el6-java</td>
256 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
257 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/controller.sh</td>
261 A CentOS 6 slave that has the basic OpenJDK 1.7 (Java7) installed and is
262 capable of running the controller, not building.
269 <td><b>Jenkins Label</b><br/> dynamic_java</td>
270 <td><b>Slave Template name</b><br/> rk-c-el6-java</td>
271 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
272 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/controller.sh</td>
276 See dynamic_controller as it is currently the same image.
283 <td><b>Jenkins Label</b><br/> dynamic_mininet</td>
284 <td><b>Slave Template name</b><br/> rk-c-el6-mininet</td>
285 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-mininet-node</td>
286 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet.sh</td>
290 A CentOS 6 image that has mininet, openvswitch v2.0.x, netopeer and
291 PostgreSQL 9.3 installed. This system is targeted at playing the role of
292 a mininet system for integration tests. Netopeer is installed as it is
293 needed for various tests by Integration. PostgreSQL 9.3 is installed as
294 the system is also capable of being used as a VTN project controller and
295 VTN requires PostgreSQL 9.3.
302 <td><b>Jenkins Label</b><br/> dynamic_mininet_fedora</td>
303 <td><b>Slave Template name</b><br/> rk-f21-mininet</td>
304 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-mininet-fedora-node</td>
305 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-fedora.sh</td>
309 Basic Fedora 21 system with ovs v2.3.x and mininet 2.2.1
316 <td><b>Jenkins Label</b><br/> ubuntu_mininet</td>
317 <td><b>Slave Template name</b><br/> ubuntu-trusty-mininet</td>
318 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ubuntu-mininet</td>
319 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
323 Basic Ubuntu system with ovs 2.0.2 and mininet 2.1.0
330 <td><b>Jenkins Label</b><br/> ubuntu_mininet_ovs_23</td>
331 <td><b>Slave Template name</b><br/> ubuntu-trusty-mininet-ovs-23</td>
332 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/ubuntu-mininet-ovs-23</td>
333 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
337 Basic Ubuntu system with ovs 2.3 and mininet 2.2.1
342 Pool: Rackspace DFW - Matrix
343 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
349 <td><b>Jenkins Label</b><br/> matrix_master</td>
350 <td><b>Slave Template name</b><br/> rk-c-el6-matrix</td>
351 <td><b>Vagrant Definition</b><br/> releng/builder/vagrant/basic-java-node</td>
352 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/matrix.sh</td>
356 This is a very minimal system that is designed to spin up with 2 build
357 instances on it. The purpose is to have a location that is not the
358 Jenkins master itself for jobs that are executing matrix operations
359 since they need a director location. This image should not be used for
360 anything but tying matrix jobs before the matrx defined label ties.
365 Creating Jenkins Jobs
366 ---------------------
368 Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML format
369 and uses them to configure Jenkins.
371 * `Jenkins Job Builder (JJB) documentation <jjb-docs_>`_
372 * `RelEng/Builder Gerrit <releng-builder-gerrit_>`_
373 * `RelEng/Builder Git repository <releng-builder-repo_>`_
375 Getting Jenkins Job Builder
376 ---------------------------
378 OpenDaylight uses Jenkins Job Builder to translate our in-repo YAML job
379 configuration into job descriptions suitable for consumption by Jenkins.
380 When testing new Jenkins Jobs in the `Jenkins Sandbox`_, you'll
381 need to use the `jenkins-jobs` executable to translate a set of jobs into
382 their XML descriptions and upload them to the sandbox Jenkins server.
384 We document `installing <Installing Jenkins Job Builder_>`_ `jenkins-jobs`
385 below. We also provide
386 a `pre-built Docker image <jjb-docker_>`_ with `jenkins-jobs` already installed.
388 Installing Jenkins Job Builder
389 ------------------------------
391 For users who aren't already experienced with Docker or otherwise don't want
392 to use our `pre-built JJB Docker image <jjb-docker_>`_, installing JJB into a
393 virtual environment is an equally good option.
395 We recommend using `pip <Installing JJB using pip_>`_ to assist with JJB
397 also document `installing from a git repository manually
398 <Installing JJB Manually_>`_.
399 For both, we recommend using Python `Virtual Environments`_
400 to isolate JJB and its dependencies.
402 The `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file contains the currently
403 recommended JJB version. Because JJB is fairly unstable, it may be necessary
404 to debug things by installing different versions. This is documented for both
405 `pip-assisted <Installing JJB using pip_>`_ and `manual
406 <Installing JJB Manually_>`_ installs.
411 For both `pip-assisted <Installing JJB using pip_>`_ and `manual
412 <Installing JJB Manually_>`_ JJB
413 installs, we recommend using `Python Virtual Environments <python-virtualenv_>`_
414 to manage JJB and its
415 Python dependencies. The `python-virtualenvwrapper`_ tool can help you do so.
417 There are good docs for installing `python-virtualenvwrapper`_. On Linux systems
418 with pip (typical), they amount to:
422 sudo pip install virtualenvwrapper
424 A virtual environment is simply a directory that you install Python programs
425 into and then append to the front of your path, causing those copies to be
426 found before any system-wide versions.
428 Create a new virtual environment for JJB.
432 # Virtaulenvwrapper uses this dir for virtual environments
434 /home/daniel/.virtualenvs
435 # Make a new virtual environment
437 # A new venv dir was created
438 (jjb)$ ls -rc $WORKON_HOME | tail -n 1
440 # The new venv was added to the front of this shell's path
442 /home/daniel/.virtualenvs/jjb/bin:<my normal path>
443 # Software installed to venv, like pip, is found before system-wide copies
444 (jjb)$ command -v pip
445 /home/daniel/.virtualenvs/jjb/bin/pip
447 With your virtual environment active, you should install JJB. Your install will
448 be isolated to that virtual environment's directory and only visible when the
449 virtual environment is active.
451 You can easily leave and return to your venv. Make sure you activate it before
457 $ command -v jenkins-jobs
458 # No jenkins-jobs executable found
460 (jjb)$ command -v jenkins-jobs
461 $WORKON_HOME/jjb/bin/jenkins-jobs
463 Installing JJB using pip
464 ------------------------
466 The recommended way to install JJB is via pip.
468 First, clone the latest version of the `releng-builder-repo`_.
472 $ git clone https://git.opendaylight.org/gerrit/p/releng/builder.git
474 Before actually installing JJB and its dependencies, make sure you've `created
475 and activated <Virtual Environments_>`_ a virtual environment for JJB.
481 The recommended version of JJB to install is the version specified in the
482 `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file.
486 # From the root of the releng/builder repo
487 (jjb)$ pip install -r jjb/requirements.txt
489 To validate that JJB was successfully installed you can run this command:
493 (jjb)$ jenkins-jobs --version
495 To change the version of JJB specified by `builder/jjb/requirements.txt
496 <odl-jjb-requirements.txt_>`_
497 to install from the latest commit to the master branch of JJB's git repository:
501 $ cat jjb/requirements.txt
502 -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder#egg=jenkins-job-builder
504 To install from a tag, like 1.4.0:
508 $ cat jjb/requirements.txt
509 -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder@1.4.0#egg=jenkins-job-builder
511 Installing JJB Manually
512 -----------------------
514 This section documents installing JJB from its manually cloned repository.
516 Note that `installing via pip <Installing JJB using pip_>`_ is typically simpler.
518 Checkout the version of JJB's source you'd like to build.
520 For example, using master:
524 $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
526 Using a tag, like 1.4.0:
530 $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
531 $ cd jenkins-job-builder
532 $ git checkout tags/1.4.0
534 Before actually installing JJB and its dependencies, make sure you've `created
535 and activated <Virtual Environments_>`_ a virtual environment for JJB.
541 You can then use JJB's `requirements.txt <jjb-requirements.txt_>`_ file to
543 dependencies. Note that we're not using `sudo` to install as root, since we want
544 to make use of the venv we've configured for our current user.
548 # In the cloned JJB repo, with the desired version of the code checked out
549 (jjb)$ pip install -r requirements.txt
551 Then install JJB from the repo with:
557 To validate that JJB was successfully installed you can run this command:
561 (jjb)$ jenkins-jobs --version
566 `Docker <docker-docs_>`_ is an open platform used to create virtualized Linux containers
567 for shipping self-contained applications. Docker leverages LinuX Containers
568 \(LXC\) running on the same operating system as the host machine, whereas a
569 traditional VM runs an operating system over the host.
573 docker pull zxiiro/jjb-docker
574 docker run --rm -v ${PWD}:/jjb jjb-docker
576 This `Dockerfile <jjb-dockerfile_>`_ created the
577 `zxiiro/jjb-docker image <jjb-docker_>`_.
578 By default it will run:
584 You'll need to use the `-v/--volume=[]` parameter to mount a directory
585 containing your YAML files, as well as a configured `jenkins.ini` file if you
586 wish to upload your jobs to the `Jenkins Sandbox`_.
588 Jenkins Job Templates
589 ---------------------
591 The OpenDaylight `RelEng/Builder <releng-builder-wiki_>`_ project provides
592 `jjb-templates`_ that can be used to define basic jobs.
599 The Verify job template creates a Gerrit Trigger job that will trigger when a
600 new patch is submitted to Gerrit.
602 Verify jobs can be retriggered in Gerrit by leaving a comment that says
610 The Merge job template is similar to the Verify Job Template except it will
611 trigger once a Gerrit patch is merged into the repo. It also automatically
612 runs the Maven goals **source:jar** and **javadoc:jar**.
614 This job will upload artifacts to `OpenDaylight's Nexus <odl-nexus_>`_ on completion.
616 Merge jobs can be retriggered in Gerrit by leaving a comment that says
622 The Daily (or Nightly) Job Template creates a job which will run on a build on
623 a Daily basis as a sanity check to ensure the build is still working day to
629 Trigger: **run-sonar**
631 This job runs Sonar analysis and reports the results to `OpenDaylight's Sonar
632 dashboard <odl-sonar_>`_.
634 The Sonar Job Template creates a job which will run against the master branch,
635 or if BRANCHES are specified in the CFG file it will create a job for the
636 **First** branch listed.
638 .. note:: Running the "run-sonar" trigger will cause Jenkins to remove its
639 existing vote if it's already -1'd or +1'd a comment. You will need to
640 re-run your verify job (recheck) after running this to get Jenkins to
643 Integration Job Template
644 ^^^^^^^^^^^^^^^^^^^^^^^^
646 The Integration Job Template creates a job which runs when a project that your
647 project depends on is successfully built. This job type is basically the same
648 as a verify job except that it triggers from other Jenkins jobs instead of via
649 Gerrit review updates. The dependencies that triger integration jobs are listed
650 in your project.cfg file under the **DEPENDENCIES** variable.
652 If no dependencies are listed then this job type is disabled by default.
654 Distribution Test Job
655 ^^^^^^^^^^^^^^^^^^^^^
657 Trigger: **test-distribution**
659 This job builds a distrbution against your patch, passes distribution sanity test
660 and reports back the results to Gerrit. Leave a comment with trigger keyword above
661 to activate it for a particular patch.
663 This job is maintained by the Integration/Test (`integration-test-wiki`_) project.
665 .. note:: Running the "test-distribution" trigger will cause Jenkins to remove
666 it's existing vote if it's already -1 or +1'd a comment. You will need
667 to re-run your verify job (recheck) after running this to get Jenkins
668 to put back the correct vote.
673 Trigger: **test-integration**
675 This job runs a full integration test suite against your patch and reports
676 back the results to Gerrit. Leave a comment with trigger keyword above to activate it
677 for a particular patch.
679 This job is maintained by the Integration/Test (`integration-test-wiki`_) project.
681 .. note:: Running the "test-integration" trigger will cause Jenkins to remove
682 it's existing vote if it's already -1 or +1'd a comment. You will need
683 to re-run your verify job (recheck) after running this to get Jenkins
684 to put back the correct vote.
686 Some considerations when using this job:
688 * The patch test verification takes some time (~2 hours) + consumes a lot of
689 resources so it is not meant to be used for every patch.
690 * The system tests for master patches will fail most of the times because both
691 code and test are unstable during the release cycle (should be good by the
693 * Because of the above, patch test results typically have to be interpreted by
694 system test experts. The Integration/Test (`integration-test-wiki`_) project
698 Autorelease Validate Job
699 ^^^^^^^^^^^^^^^^^^^^^^^^
701 Trigger: **revalidate**
703 This job runs the PROJECT-validate-autorelease-BRANCH job which is used as a
704 quick sanity test to ensure that a patch does not depend on features that do
705 not exist in the current release.
707 The **revalidate** trigger is useful in cases where a project's verify job
708 passed however validate failed due to infra problems or intermittent issues.
709 It will retrigger just the validate-autorelease job.
714 Trigger: **recheck** | **revalidate**
716 This job template can be used by a project that is Python based. It simply
717 installs a python virtualenv and uses tox to run tests. When using the template
718 you need to provide a {toxdir} which is the path relative to the root of the
719 project repo containing the tox.ini file.
724 Trigger: **recheck** | **revalidate**
726 This job template can be used by a project that is NodeJS based. It simply
727 installs a python virtualenv and uses that to install nodeenv which is then
728 used to install another virtualenv for nodejs. It then calls **npm install**
729 and **npm test** to run the unit tests. When using this template you need to
730 provide a {nodedir} and {nodever} containing the directory relative to the
731 project root containing the nodejs package.json and version of node you wish to
734 Basic Job Configuration
735 -----------------------
737 To create jobs based on existing `templates <Jenkins Job Templates_>`_, use the
738 `jjb-init-project.py`_ helper script. When run from the root of
739 `RelEng/Builder's repo <releng-builder-repo_>`_, it will produce a file in
740 `jjb/<project>/<project>.yaml` containing your project's base template.
744 $ python scripts/jjb-init-project.py --help
745 usage: jjb-init-project.py [-h] [-c CONF] [-d DEPENDENCIES] [-t TEMPLATES]
746 [-s STREAMS] [-p POM] [-g MVN_GOALS] [-o MVN_OPTS]
747 [-a ARCHIVE_ARTIFACTS]
750 positional arguments:
754 -h, --help show this help message and exit
755 -c CONF, --conf CONF Config file
756 -d DEPENDENCIES, --dependencies DEPENDENCIES
757 Project dependencies A comma-seperated (no spaces)
758 list of projects your project depends on. This is used
759 to create an integration job that will trigger when a
760 dependent project-merge job is built successfully.
761 Example: aaa,controller,yangtools
762 -t TEMPLATES, --templates TEMPLATES
764 -s STREAMS, --streams STREAMS
765 Release streams to fill with default options
766 -p POM, --pom POM Path to pom.xml to use in Maven build (Default:
768 -g MVN_GOALS, --mvn-goals MVN_GOALS
770 -o MVN_OPTS, --mvn-opts MVN_OPTS
772 -a ARCHIVE_ARTIFACTS, --archive-artifacts ARCHIVE_ARTIFACTS
773 Comma-seperated list of patterns of artifacts to
774 archive on build completion. See:
775 http://ant.apache.org/manual/Types/fileset.html
777 If all your project requires is the basic verify, merge, and daily jobs then
778 using the job template should be all you need to configure for your jobs.
780 Auto-Update Job Templates
781 ^^^^^^^^^^^^^^^^^^^^^^^^^
783 The first line of the job YAML file produced by the `jjb-init-project.py`_ script will
784 contain the words `# REMOVE THIS LINE IF...`. Leaving this line will allow the
785 RelEng/Builder `jjb-autoupdate-project.py`_ script to maintain this file for your project,
786 should the base templates ever change. It is a good idea to leave this line if
787 you do not plan to create any complex jobs outside of the provided template.
789 However, if your project needs more control over your jobs or if you have any
790 additional configuration outside of the standard configuration provided by the
791 template, then this line should be removed.
796 Allowing the auto-updated to manage your templates doesn't prevent you from
797 doing some configuration changes. Parameters can be passed to templates via
798 a `<project>.cfg` in your `builder/jjb/<project>` directory. An example is
799 provided below, others can be found in the repos of other projects. Tune as
800 necessary. Unnecessary paramaters can be removed or commented out with a "#"
805 JOB_TEMPLATES: verify,merge,sonar
809 jdks: openjdk7,openjdk8
812 branch: stable/lithium
815 MVN_GOALS: clean install javadoc:aggregate -DrepoBuild -Dmaven.repo.local=$WORKSPACE/.m2repo -Dorg.ops4j.pax.url.mvn.localRepository=$WORKSPACE/.m2repo
816 MVN_OPTS: -Xmx1024m -XX:MaxPermSize=256m
817 DEPENDENCIES: aaa,controller,yangtools
818 ARCHIVE_ARTIFACTS: *.logs, *.patches
820 .. note:: `STREAMS <streams-design-background_>`_ is a list of branches you want
821 JJB to generate jobs for.
822 The first branch will be the branch that reports Sonar analysis. Each
823 branch must define a "jdks:" section listing the JDKs the verify jobs
824 should run tests against for the branch. The first JDK listed will be
825 used as the default JDK for non-verify type jobs.
827 .. note:: Projects that are participating in the simultanious release should set
828 "autorelease: true" under the streams they are participating in
829 autorelease for. This enables a new job type validate-autorelease
830 which is used to help identify if Gerrit patches might break
836 It is also possible to take advantage of both the auto-updater and creating
837 your own jobs. To do this, create a YAML file in your project's sub-directory
838 with any name other than \<project\>.yaml. The auto-update script will only
839 search for files with the name \<project\>.yaml. The normal \<project\>.yaml
840 file can then be left in tact with the "# REMOVE THIS LINE IF..." comment so
841 it will be automatically updated.
846 We provide a properties which your job can take advantage of if you want to do
847 something different depending on the job type that is run. If you create a
848 profile that activates on a property listed blow. The JJB templated jobs will
849 be able to activate the profile during the build to run any custom code you
850 wish to run in your project.
854 -Dmerge : This flag is passed in our Merge job and is equivalent to the
857 -Dsonar : This flag is passed in our Sonar job and is equivalent to the
864 The `jenkins-sandbox`_ instance's purpose is to allow projects to test their JJB
865 setups before merging their code over to the RelEng master silo. It is
866 configured similarly to the master instance, although it cannot publish
867 artifacts or vote in Gerrit.
869 If your project requires access to the sandbox please open an OpenDaylight
870 Helpdesk ticket (<helpdesk@opendaylight.org>) and provide your ODL ID.
872 Notes Regarding the Sandbox
873 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
875 * Jobs are automatically deleted every Saturday at 08:00 UTC
876 * Committers can login and configure Jenkins jobs in the sandbox directly
877 (unlike with the master silo)
878 * Sandbox configuration mirrors the master silo when possible
879 * Sandbox jobs can NOT upload artifacts to Nexus
880 * Sandbox jobs can NOT vote on Gerrit
885 Make sure you have Jenkins Job Builder [properly installed](#jjb_install).
887 If you do not already have access, open an OpenDaylight Helpdesk ticket
888 (<helpdesk@opendaylight.org>) to request access to ODL's sandbox instance.
889 Integration/Test (`integration-test-wiki`_) committers have access by default.
891 JJB reads user-specific configuration from a `jenkins.ini`_. An
892 example is provided by releng/builder at `example-jenkins.ini`_.
896 # If you don't have RelEng/Builder's repo, clone it
897 $ git clone https://git.opendaylight.org/gerrit/p/releng/builder.git
898 # Make a copy of the example JJB config file (in the builder/ directory)
899 $ cp jenkins.ini.example jenkins.ini
900 # Edit jenkins.ini with your username, API token and ODL's sandbox URL
904 user=<your ODL username>
905 password=<your ODL Jenkins sandbox API token>
906 url=https://jenkins.opendaylight.org/sandbox
909 To get your API token, `login to the Jenkins **sandbox** instance
910 <jenkins-sandbox-login_>`_ (_not
911 the main master Jenkins instance, different tokens_), go to your user page (by
912 clicking on your username, for example), click "Configure" and then "Show API
918 If you `installed JJB locally into a virtual environment
919 <Installing Jenkins Job Builder_>`_,
920 you should now activate that virtual environment to access the `jenkins-jobs`
928 You'll want to work from the root of the RelEng/Builder repo, and you should
929 have your `jenkins.ini` file [properly configured](#sandbox_config).
934 It's good practice to use the `test` command to validate your JJB files before
939 jenkins-jobs --conf jenkins.ini test jjb/ <job-name>
941 If the job you'd like to test is a template with variables in its name, it
942 must be manually expanded before use. For example, the commonly used template
943 `{project}-csit-verify-1node-{functionality}` might expand to
944 `ovsdb-csit-verify-1node-netvirt`.
948 jenkins-jobs --conf jenkins.ini test jjb/ ovsdb-csit-verify-1node-netvirt
950 Successful tests output the XML description of the Jenkins job described by
951 the specified JJB job name.
956 Once you've `configured your \`jenkins.ini\` <Configuration_>`_ and `verified your
957 JJB jobs <Testing Jobs_>`_ produce valid XML descriptions of Jenkins jobs you
958 can push them to the Jenkins sandbox.
962 When pushing with `jenkins-jobs`, a log message with the number
963 of jobs you're pushing will be issued, typically to stdout.
964 **If the number is greater than 1** (or the number of jobs you
965 passed to the command to push) then you are pushing too many
966 jobs and should **`ctrl+c` to cancel the upload**. Else you will
967 flood the system with jobs.
971 INFO:jenkins_jobs.builder:Number of jobs generated: 1
973 **Failing to provide the final `<job-name>` param will push all
978 # Don't push all jobs by omitting the final param! (ctrl+c to abort)
979 jenkins-jobs --conf jenkins.ini update jjb/ <job-name>
984 Once you have your Jenkins job configuration `pushed to the
985 Sandbox <Pushing Jobs_>`_ you can trigger it to run.
987 Find your newly-pushed job on the `Sandbox's web UI <jenkins-sandbox_>`_. Click
988 on its name to see the job's details.
990 Make sure you're `logged in <jenkins-sandbox-login_>`_ to the Sandbox.
992 Click "Build with Parameters" and then "Build".
994 Wait for your job to be scheduled and run. Click on the job number to see
995 details, including console output.
997 Make changes to your JJB configuration, re-test, re-push and re-run until
1003 If `using Docker <JJB Docker image_>`_:
1005 .. code-block:: bash
1008 docker run --rm -v ${PWD}:/jjb zxiiro/jjb-docker
1012 When pushing with `jenkins-jobs`, a log message with
1013 the number of jobs you're pushing will be issued, typically to stdout.
1014 **If the number is greater than 1** (or the number of jobs you passed to
1015 the command to push) then you are pushing too many jobs and should **`ctrl+c`
1016 to cancel the upload**. Else you will flood the system with jobs.
1018 .. code-block:: bash
1020 INFO:jenkins_jobs.builder:Number of jobs generated: 1
1022 **Failing to provide the final `<job-name>` param will push all jobs!**
1024 .. code-block:: bash
1026 # To upload jobs to the sandbox
1027 # Please ensure that you include a configured jenkins.ini in your volume mount
1028 # Making sure not to push more jobs than expected, ctrl+c to abort
1029 docker run --rm -v ${PWD}:/jjb zxiiro/jjb-docker jenkins-jobs --conf jenkins.ini update . openflowplugin-csit-periodic-1node-cds-longevity-only-master
1031 .. _docker-docs: https://www.docker.com/whatisdocker/
1032 .. _example-jenkins.ini: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins.ini.example
1033 .. _integration-test-wiki: https://wiki.opendaylight.org/view/Integration/Test
1034 .. _jenkins-master: https://jenkins.opendaylight.org/releng
1035 .. _jenkins-sandbox: https://jenkins.opendaylight.org/sandbox
1036 .. _jenkins-sandbox-login: https://jenkins.opendaylight.org/sandbox/login
1037 .. _jenkins.ini: http://docs.openstack.org/infra/jenkins-job-builder/execution.html#configuration-file
1038 .. _jjb-autoupdate-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-autoupdate-project.py
1039 .. _jjb-docker: https://hub.docker.com/r/zxiiro/jjb-docker/
1040 .. _jjb-dockerfile: https://github.com/zxiiro/jjb-docker/blob/master/Dockerfile
1041 .. _jjb-docs: http://ci.openstack.org/jenkins-job-builder/
1042 .. _jjb-init-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-init-project.py
1043 .. _jjb-repo: https://github.com/openstack-infra/jenkins-job-builder
1044 .. _jjb-requirements.txt: https://github.com/openstack-infra/jenkins-job-builder/blob/master/requirements.txt
1045 .. _jjb-templates: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jjb
1046 .. _odl-jjb-requirements.txt: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jjb/requirements.txt
1047 .. _odl-nexus: https://nexus.opendaylight.org
1048 .. _odl-sonar: https://sonar.opendaylight.org
1049 .. _python-virtualenv: https://virtualenv.readthedocs.org/en/latest/
1050 .. _python-virtualenvwrapper: https://virtualenvwrapper.readthedocs.org/en/latest/
1051 .. _releng-wiki: https://wiki.opendaylight.org/view/RelEng:Main
1052 .. _releng-builder-gerrit: https://git.opendaylight.org/gerrit/#/admin/projects/releng/builder
1053 .. _releng-builder-repo: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=summary
1054 .. _releng-builder-wiki: https://wiki.opendaylight.org/view/RelEng/Builder
1055 .. _streams-design-background: https://lists.opendaylight.org/pipermail/release/2015-July/003139.html
1056 .. _spinup-scripts: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jenkins-scripts
1057 .. _spinup-scripts-basic_settings.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/basic_settings.sh
1058 .. _spinup-scripts-controller.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/controller.sh
1059 .. _vagrant-basic-java-node: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=vagrant/basic-java-node
1060 .. _vagrant-definitions: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=vagrant