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 -----------------------
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.
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.
30 git clone https://git.opendaylight.org/gerrit/releng/builder
32 mkdir jjb/<new-project>
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.
37 Next we will create <new-project>.yaml as follows:
42 name: <NEW_PROJECT>-carbon
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}'
51 project: '<NEW_PROJECT>'
52 project-name: '<NEW_PROJECT>'
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]'
69 name: <NEW_PROJECT>-sonar
71 - '{project-name}-sonar'
73 project: '<NEW_PROJECT>'
74 project-name: '<NEW_PROJECT>'
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'
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, it is required to add the following job
84 types into the job list for the release you are participating.
89 - '{project-name}-distribution-check-{stream}'
90 - '{project-name}-validate-autorelease-{stream}'
92 If you'd like to explore the additional tweaking options available
93 please refer to the `Jenkins Job Templates`_ section.
95 Finally we need to push these files to Gerrit for review by the releng/builder
96 team to push your jobs to Jenkins.
100 git add jjb/<new-project>
101 git commit -sm "Add <new-project> jobs to Jenkins"
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.
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.
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 be destroyed.
123 Our Jenkins master supports many types of dynamic build minions. If you are
124 creating custom jobs then you will need to have an idea of what type of minions
125 are available. The following are the current minion types and descriptions.
126 Minion Template Names are needed for jobs that take advantage of multiple
127 minions as they must be specifically called out by template name instead of
130 Adding New Components to the Minions
131 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
133 If your project needs something added to one of the minions, you can help us
134 get things added faster by doing one of the following:
136 * Submit a patch to RelEng/Builder for the appropriate `jenkins-scripts`
137 definition which configure software during minion boot up.
138 * Submit a patch to RelEng/Builder for the `packer/provision` scripts that
139 configures software during minion instance imaging.
140 * Submit a patch to RelEng/Builder for the Packer's templates in
141 the `packer/templates` directory that configures a new instance definition
142 along with changes in `packer/provision`.
144 Going the first route will be faster in the short term as we can inspect the
145 changes and make test modifications in the sandbox to verify that it works.
149 The first route may add additional setup time considering this is run every
150 time the minion is booted.
152 The second and third routes, however, is better for the community as a whole as
153 it will allow others to utilize our Packer setups to replicate our systems more
154 closely. It is, however, more time consuming as an image snapshot needs to be
155 created based on the updated Packer definitions before it can be attached to the
156 Jenkins configuration on sandbox for validation testing.
158 In either case, the changes must be validated in the sandbox with tests to
159 make sure that we don't break current jobs and that the new software features
160 are operating as intended. Once this is done the changes will be merged and
161 the updates applied to the RelEng Jenkins production silo. Any changes to
162 files under `releng/builder/packer` will be validated and images would be built
163 triggered by verify-packer and merge-packer jobs.
165 Please note that the combination of a Packer definitions from `vars`, `templates`
166 and the `provision` scripts is what defines a given minion. For instance, a minion
167 may be defined as `centos7-java-builder` which is a combination of Packer OS image
168 definitions from `vars/centos.json`, Packer template definitions from
169 `templates/java-buidler.json` and spinup scripts from `provision/java-builder.sh`.
170 This combination provides the full definition of the realized minion.
172 Jenkins starts a minion using the latest image which is built and linked into the
173 Jenkins configuration. Once the base instance is online Jenkins checks out the
174 RelEng/Builder repo on it and executes two scripts. The first is
175 `provision/baseline.sh`, which is a baseline for all of the minions.
177 The second is the specialized script, which handles any system updates,
178 new software installs or extra environment tweaks that don't make sense in a
179 snapshot. Examples could include installing new package or setting up a virtual
180 environment. Its imperative to ensure modifications to these spinup scripts have
181 considered time taken to install the packages, as this could increase the build
182 time for every job which runs on the image. After all of these scripts have
183 executed Jenkins will finally attach the minion as an actual minion and start
191 <table class="table table-bordered">
193 <td><b>Jenkins Labels</b><br/> dynamic_controller, dynamic_verify,
194 dynamic_merge, centos7-java-builder-2c-4g, centos7-java-builder-2c-8g,
195 centos7-java-builder-4c-8g</td>
196 <td><b>Minion Template names</b><br/> centos7-java-builder-2c-4g,
197 centos7-java-builder-2c-8g, centos7-java-builder-2c-8g,
198 centos7-java-builder-4c-8g, centos7-java-builder-8c-8g</td>
199 <td><b>Packer Template</b><br/>
200 releng/builder/packer/templates/java-builder.json</td>
201 <td><b>Spinup Script</b><br/>
202 releng/builder/jenkins-scripts/builder.sh</td>
206 A CentOS 7 huild minion. This system has OpenJDK 1.7 (Java7) and OpenJDK
207 1.8 (Java8) installed on it along with all the other components and
208 libraries needed for building any current OpenDaylight project. This is
209 the label that is used for all basic verify, merge and daily builds for
215 <td><b>Jenkins Labels</b><br/> dynamic_robot, centos7-robot-2c-2g</td>
216 <td><b>Minion Template names</b><br/> centos7-robot-2c-2g</td>
217 <td><b>Packer Template</b><br/>
218 releng/builder/packer/templates/robot.json</td>
219 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/robot.sh</td>
223 A CentOS 7 minion that is configured with OpenJDK 1.7 (Java7), OpenJDK
224 1.8 (Java8) and all the current packages used by the integration
225 project for doing robot driven jobs. If you are executing robot
226 framework jobs then your job should be using this as the minion that
227 you are tied to. This image does not contain the needed libraries for
228 building components of OpenDaylight, only for executing robot tests.
233 <td><b>Jenkins Labels</b><br/> ubuntu_mininet, ubuntu-trusty-mininet-2c-2g</td>
234 <td><b>Minion Template names</b><br/> ubuntu-trusty-mininet-2c-2g</td>
235 <td><b>Packer Template</b><br/>
236 releng/builder/packer/teamplates/mininet.json</td>
237 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
241 Basic Ubuntu system with ovs 2.0.2 and mininet 2.1.0
246 <td><b>Jenkins Labels</b><br/> ubuntu_mininet_ovs_23,
247 ubuntu-trusty-mininet-ovs-23-2c-2g</td>
248 <td><b>Minion Template names</b><br/> ubuntu-trusty-mininet-ovs-23-2c-2g</td>
249 <td><b>Packer Template</b><br/> releng/builder/packer/templates/mininet-ovs-2.3.json</td>
250 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
254 Basic Ubuntu system with ovs 2.3 and mininet 2.2.1
259 <td><b>Jenkins Labels</b><br/> ubuntu_mininet_ovs_25,
260 ubuntu-trusty-mininet-ovs-25-2c-2g</td>
261 <td><b>Minion Template names</b><br/> ubuntu-trusty-mininet-ovs-25-2c-2g</td>
262 <td><b>Packer Template</b><br/> releng/builder/packer/templates/mininet-ovs-2.5.json</td>
263 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/mininet-ubuntu.sh</td>
267 Basic Ubuntu system with ovs 2.5 and mininet 2.2.2
272 <td><b>Jenkins Labels</b><br/> dynamic_devstack, centos7-devstack-2c-4g</td>
273 <td><b>Minion Template names</b><br/> centos7-devstack-2c-4g</td>
274 <td><b>Packer Template</b><br/> releng/builder/packer/templates/devstack.json</td>
275 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/devstack.sh</td>
279 A CentOS 7 system purpose built for doing OpenStack testing using
280 DevStack. This minion is primarily targeted at the needs of the OVSDB
281 project. It has OpenJDK 1.7 (aka Java7) and OpenJDK 1.8 (Java8) and
282 other basic DevStack related bits installed.
287 <td><b>Jenkins Labels</b><br/> dynamic_docker, centos7-docker-2c-4g</td>
288 <td><b>Minion Template names</b><br/> centos7-docker-2c-4g</td>
289 <td><b>Packer Template</b><br/> releng/builder/packer/templates/docker.json</td>
290 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/docker.sh</td>
294 A CentOS 7 system that is configured with OpenJDK 1.7 (aka Java7),
295 OpenJDK 1.8 (Java8) and Docker. This system was originally custom
296 built for the test needs of the OVSDB project but other projects have
297 expressed interest in using it.
302 <td><b>Jenkins Labels</b><br/> gbp_trusty, ubuntu-trusty-gbp-2c-2g</td>
303 <td><b>Minion Template names</b><br/> ubuntu-trusty-gbp-2c-2g</td>
304 <td><b>Packer Template</b><br/> releng/builder/packer/templates/gbp.json</td>
305 <td><b>Spinup Script</b><br/> releng/builder/jenkins-scripts/ubuntu-docker-ovs.sh</td>
309 A basic Ubuntu node with latest OVS and docker installed. Used by Group Based Policy.
314 Creating Jenkins Jobs
315 ---------------------
317 Jenkins Job Builder takes simple descriptions of Jenkins jobs in YAML format
318 and uses them to configure Jenkins.
320 * `Jenkins Job Builder (JJB) documentation <jjb-docs_>`_
321 * `RelEng/Builder Gerrit <releng-builder-gerrit_>`_
322 * `RelEng/Builder Git repository <releng-builder-repo_>`_
324 Getting Jenkins Job Builder
325 ---------------------------
327 OpenDaylight uses Jenkins Job Builder to translate our in-repo YAML job
328 configuration into job descriptions suitable for consumption by Jenkins.
329 When testing new Jenkins Jobs in the `Jenkins Sandbox`_, you'll
330 need to use the `jenkins-jobs` executable to translate a set of jobs into
331 their XML descriptions and upload them to the sandbox Jenkins server.
333 We document `installing <Installing Jenkins Job Builder_>`_ `jenkins-jobs`
334 below. We also provide
335 a `pre-built Docker image <jjb-docker_>`_ with `jenkins-jobs` already installed.
337 Installing Jenkins Job Builder
338 ------------------------------
340 For users who aren't already experienced with Docker or otherwise don't want
341 to use our `pre-built JJB Docker image <jjb-docker_>`_, installing JJB into a
342 virtual environment is an equally good option.
344 We recommend using `pip <Installing JJB using pip_>`_ to assist with JJB
346 also document `installing from a git repository manually
347 <Installing JJB Manually_>`_.
348 For both, we recommend using Python `Virtual Environments`_
349 to isolate JJB and its dependencies.
351 The `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file contains the currently
352 recommended JJB version. Because JJB is fairly unstable, it may be necessary
353 to debug things by installing different versions. This is documented for both
354 `pip-assisted <Installing JJB using pip_>`_ and `manual
355 <Installing JJB Manually_>`_ installs.
360 For both `pip-assisted <Installing JJB using pip_>`_ and `manual
361 <Installing JJB Manually_>`_ JJB
362 installs, we recommend using `Python Virtual Environments <python-virtualenv_>`_
363 to manage JJB and its
364 Python dependencies. The `python-virtualenvwrapper`_ tool can help you do so.
366 There are good docs for installing `python-virtualenvwrapper`_. On Linux systems
367 with pip (typical), they amount to:
371 sudo pip install virtualenvwrapper
373 A virtual environment is simply a directory that you install Python programs
374 into and then append to the front of your path, causing those copies to be
375 found before any system-wide versions.
377 Create a new virtual environment for JJB.
381 # Virtaulenvwrapper uses this dir for virtual environments
383 /home/daniel/.virtualenvs
384 # Make a new virtual environment
386 # A new venv dir was created
387 (jjb)$ ls -rc $WORKON_HOME | tail -n 1
389 # The new venv was added to the front of this shell's path
391 /home/daniel/.virtualenvs/jjb/bin:<my normal path>
392 # Software installed to venv, like pip, is found before system-wide copies
393 (jjb)$ command -v pip
394 /home/daniel/.virtualenvs/jjb/bin/pip
396 With your virtual environment active, you should install JJB. Your install will
397 be isolated to that virtual environment's directory and only visible when the
398 virtual environment is active.
400 You can easily leave and return to your venv. Make sure you activate it before
406 $ command -v jenkins-jobs
407 # No jenkins-jobs executable found
409 (jjb)$ command -v jenkins-jobs
410 $WORKON_HOME/jjb/bin/jenkins-jobs
412 Installing JJB using pip
413 ------------------------
415 The recommended way to install JJB is via pip.
417 First, clone the latest version of the `releng-builder-repo`_.
421 $ git clone https://git.opendaylight.org/gerrit/p/releng/builder.git
423 Before actually installing JJB and its dependencies, make sure you've `created
424 and activated <Virtual Environments_>`_ a virtual environment for JJB.
430 The recommended version of JJB to install is the version specified in the
431 `builder/jjb/requirements.txt <odl-jjb-requirements.txt_>`_ file.
435 # From the root of the releng/builder repo
436 (jjb)$ pip install -r jjb/requirements.txt
438 To validate that JJB was successfully installed you can run this command:
442 (jjb)$ jenkins-jobs --version
444 TODO: Explain that only the currently merged jjb/requirements.txt is supported,
445 other options described below are for troubleshooting only.
447 To change the version of JJB specified by `builder/jjb/requirements.txt
448 <odl-jjb-requirements.txt_>`_
449 to install from the latest commit to the master branch of JJB's git repository:
453 $ cat jjb/requirements.txt
454 -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder#egg=jenkins-job-builder
456 To install from a tag, like 1.4.0:
460 $ cat jjb/requirements.txt
461 -e git+https://git.openstack.org/openstack-infra/jenkins-job-builder@1.4.0#egg=jenkins-job-builder
463 Installing JJB Manually
464 -----------------------
466 This section documents installing JJB from its manually cloned repository.
468 Note that `installing via pip <Installing JJB using pip_>`_ is typically simpler.
470 Checkout the version of JJB's source you'd like to build.
472 For example, using master:
476 $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
478 Using a tag, like 1.4.0:
482 $ git clone https://git.openstack.org/openstack-infra/jenkins-job-builder
483 $ cd jenkins-job-builder
484 $ git checkout tags/1.4.0
486 Before actually installing JJB and its dependencies, make sure you've `created
487 and activated <Virtual Environments_>`_ a virtual environment for JJB.
493 You can then use JJB's `requirements.txt <jjb-requirements.txt_>`_ file to
495 dependencies. Note that we're not using `sudo` to install as root, since we want
496 to make use of the venv we've configured for our current user.
500 # In the cloned JJB repo, with the desired version of the code checked out
501 (jjb)$ pip install -r requirements.txt
503 Then install JJB from the repo with:
509 To validate that JJB was successfully installed you can run this command:
513 (jjb)$ jenkins-jobs --version
518 `Docker <docker-docs_>`_ is an open platform used to create virtualized Linux containers
519 for shipping self-contained applications. Docker leverages LinuX Containers
520 \(LXC\) running on the same operating system as the host machine, whereas a
521 traditional VM runs an operating system over the host.
525 docker pull zxiiro/jjb-docker
526 docker run --rm -v ${PWD}:/jjb jjb-docker
528 This `Dockerfile <jjb-dockerfile_>`_ created the
529 `zxiiro/jjb-docker image <jjb-docker_>`_.
530 By default it will run:
536 You'll need to use the `-v/--volume=[]` parameter to mount a directory
537 containing your YAML files, as well as a configured `jenkins.ini` file if you
538 wish to upload your jobs to the `Jenkins Sandbox`_.
540 Jenkins Job Templates
541 ---------------------
543 The OpenDaylight `RelEng/Builder <releng-builder-wiki_>`_ project provides
544 `jjb-templates`_ that can be used to define basic jobs.
546 The *Gerrit Trigger* listed in the jobs are keywords that can be used to
547 trigger the job to run manually by simply leaving a comment in Gerrit for the
548 patch you wish to trigger against.
550 All jobs have a default build-timeout value of 360 minutes (6 hrs) but can be
551 overrided via the opendaylight-infra-wrappers' build-timeout property.
553 TODO: Group jobs into categories: every-patch, after-merge, on-demand, etc.
554 TODO: Reiterate that "remerge" triggers all every-patch jobs at once,
555 because when only a subset of jobs is triggered, Gerrit forgets valid -1 from jobs outside the subset.
556 TODO: Document that only drafts and commit-message-only edits do not trigger every-patch jobs.
557 TODO: Document test-{project}-{feature} and test-{project}-all.
561 <table class="table table-bordered">
563 <td><b>Job Template</b><br/>{project}-distribution-{stream}</td>
567 This job builds a snapshot distribution. This is triggered by successful merge job,
568 so the distribution contains newest project artifacts.
569 This job then triggers subset of sanity CSIT jobs relevant for the project.
574 <td><b>Job Template</b><br/>{project}-distribution-check-{stream}</td>
575 <td><b>Gerrit Trigger</b><br/>recheck</td>
579 This job runs the PROJECT-distribution-check-BRANCH job which is
580 building also integration/distribution project in order to run SingleFeatureTest.
581 It also performs other check in order to prevent the change to break autorelease.
586 <td><b>Job Template</b><br/>{project}-integration-{stream}</td>
591 The Integration Job Template creates a job which runs when a project that your
592 project depends on is successfully built. This job type is basically the same
593 as a verify job except that it triggers from other Jenkins jobs instead of via
594 Gerrit review updates. The dependencies that triger integration jobs are listed
595 in your project.cfg file under the <b>DEPENDENCIES</b> variable.
597 If no dependencies are listed then this job type is disabled by default.
602 <td><b>Job Template</b><br/>{project}-merge-{stream}</td>
603 <td><b>Gerrit Trigger</b><br/>remerge</td>
607 This job will trigger once a Gerrit patch is merged into the repo.
608 It will build HEAD of the current project branch and also run the Maven goals
609 <b>source:jar</b> and <b>javadoc:jar</b>.
610 Artifacts are uploaded to OpenDaylight's
611 <a href="https://nexus.opendaylight.org">Nexus</a> on completion.
613 Running the "remerge" trigger is possible before a Change is merged,
614 it would still build the actual HEAD. This job does not alter Gerrit votes.
619 <td><b>Job Template</b><br/>{project}-sonar</td>
620 <td><b>Gerrit Trigger</b><br/>run-sonar</td>
624 This job runs Sonar analysis and reports the results to
625 OpenDaylight's <a href="https://sonar.opendaylight.org">Sonar</a>
628 The Sonar Job Template creates a job which will run against the
629 master branch, or if BRANCHES are specified in the CFG file it will
630 create a job for the <b>First</b> branch listed.
632 <div class="admonition note">
633 <p class="first admonition-title">Note</p>
635 Running the "run-sonar" trigger will cause Jenkins to remove
636 its existing vote if it's already -1'd or +1'd a comment. You
637 will need to re-run your verify job (recheck) after running
638 this to get Jenkins to re-vote.
645 <td><b>Job Template</b><br/>{project}-validate-autorelease-{stream}</td>
646 <td><b>Gerrit Trigger</b><br/>recheck</td>
650 This job runs the PROJECT-validate-autorelease-BRANCH job which is
651 used as a quick sanity test to ensure that a patch does not depend on
652 features that do not exist in the current release.
657 <td><b>Job Template</b><br/>{project}-verify-{stream}-{maven}-{jdks}</td>
658 <td><b>Gerrit Trigger</b><br/>recheck</td>
662 The Verify job template creates a Gerrit Trigger job that will
663 trigger when a new patch is submitted to Gerrit.
664 The job only builds the project code (including unit and integration tests).
669 <td><b>Job Template</b><br/>{project}-verify-node-{stream}</td>
670 <td><b>Gerrit Trigger</b><br/>recheck</td>
674 This job template can be used by a project that is NodeJS based. It
675 simply installs a python virtualenv and uses that to install nodeenv
676 which is then used to install another virtualenv for nodejs. It then
677 calls <b>npm install</b> and <b>npm test</b> to run the unit tests.
678 When using this template you need to provide a {nodedir} and
679 {nodever} containing the directory relative to the project root
680 containing the nodejs package.json and version of node you wish to
686 <td><b>Job Template</b><br/>{project}-verify-python-{stream} | {project}-verify-tox-{stream}</td>
687 <td><b>Gerrit Trigger</b><br/>recheck</td>
691 This job template can be used by a project that uses Tox to build. It
692 simply installs a Python virtualenv and uses tox to run the tests
693 defined in the project's tox.ini file. If the tox.ini is anywhere
694 other than the project's repo root, the path to its directory
695 relative to the project's repo root should be passed as {toxdir}.
697 The 2 template names verify-python & verify-tox are identical and are
698 aliases to each other. This allows the project to use the naming that
699 is most reasonable for them.
704 <td><b>Job Template</b><br/>integration-patch-test-{stream}</td>
705 <td><b>Gerrit Trigger</b><br/>test-integration</td>
713 <td><b>Job Template</b><br/>integration-patch-test-{stream}</td>
714 <td><b>Gerrit Trigger</b><br/>test-integration</td>
718 This job builds a distribution against your Java patch and triggers distribution sanity CSIT jobs.
719 Leave a comment with trigger keyword above to activate it for a particular patch.
720 This job should not alter Gerrit votes for a given patch.
722 The list of CSIT jobs to trigger is defined in csit-list
723 <a href="https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jjb/integration/integration-test-jobs.yaml">here</a>.
725 Some considerations when using this job:
728 The patch test verification takes some time (~2 hours) + consumes a lot of
729 resources so it is not meant to be used for every patch.
732 The system tests for master patches will fail most of the times because both
733 code and test are unstable during the release cycle (should be good by the
737 Because of the above, patch test results typically have to be interpreted by
738 system test experts. The <a href="https://wiki.opendaylight.org/view/Integration/Test">Integration/Test</a>
739 project can help with that.
748 We provide a properties which your job can take advantage of if you want to do
749 something different depending on the job type that is run. If you create a
750 profile that activates on a property listed blow. The JJB templated jobs will
751 be able to activate the profile during the build to run any custom code you
752 wish to run in your project.
756 -Dmerge : This flag is passed in our Merge job and is equivalent to the
759 -Dsonar : This flag is passed in our Sonar job and is equivalent to the
766 The `jenkins-sandbox`_ instance's purpose is to allow projects to test their JJB
767 setups before merging their code over to the RelEng master silo. It is
768 configured similarly to the master instance, although it cannot publish
769 artifacts or vote in Gerrit.
771 If your project requires access to the sandbox please open an OpenDaylight
772 Helpdesk ticket (<helpdesk@opendaylight.org>) and provide your ODL ID.
774 Notes Regarding the Sandbox
775 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
777 * Jobs are automatically deleted every Saturday at 08:00 UTC
778 * Committers can login and configure Jenkins jobs in the sandbox directly
779 (unlike with the master silo)
780 * Sandbox configuration mirrors the master silo when possible
781 * Sandbox jobs can NOT upload artifacts to Nexus
782 * Sandbox jobs can NOT vote on Gerrit
787 Make sure you have Jenkins Job Builder [properly installed](#jjb_install).
789 If you do not already have access, open an OpenDaylight Helpdesk ticket
790 (<helpdesk@opendaylight.org>) to request access to ODL's sandbox instance.
791 Integration/Test (`integration-test-wiki`_) committers have access by default.
793 JJB reads user-specific configuration from a `jenkins.ini`_. An
794 example is provided by releng/builder at `example-jenkins.ini`_.
798 # If you don't have RelEng/Builder's repo, clone it
799 $ git clone https://git.opendaylight.org/gerrit/p/releng/builder.git
800 # Make a copy of the example JJB config file (in the builder/ directory)
801 $ cp jenkins.ini.example jenkins.ini
802 # Edit jenkins.ini with your username, API token and ODL's sandbox URL
806 user=<your ODL username>
807 password=<your ODL Jenkins sandbox API token>
808 url=https://jenkins.opendaylight.org/sandbox
811 To get your API token, `login to the Jenkins **sandbox** instance
812 <jenkins-sandbox-login_>`_ (*not
813 the main master Jenkins instance, different tokens*), go to your user page (by
814 clicking on your username, for example), click "Configure" and then "Show API
820 If you `installed JJB locally into a virtual environment
821 <Installing Jenkins Job Builder_>`_,
822 you should now activate that virtual environment to access the `jenkins-jobs`
830 You'll want to work from the root of the RelEng/Builder repo, and you should
831 have your `jenkins.ini` file [properly configured](#sandbox_config).
836 It's good practice to use the `test` command to validate your JJB files before
841 jenkins-jobs --conf jenkins.ini test jjb/ <job-name>
843 If the job you'd like to test is a template with variables in its name, it
844 must be manually expanded before use. For example, the commonly used template
845 `{project}-csit-verify-1node-{functionality}` might expand to
846 `ovsdb-csit-verify-1node-netvirt`.
850 jenkins-jobs --conf jenkins.ini test jjb/ ovsdb-csit-verify-1node-netvirt
852 Successful tests output the XML description of the Jenkins job described by
853 the specified JJB job name.
858 Once you've `configured your \`jenkins.ini\` <Configuration_>`_ and `verified your
859 JJB jobs <Testing Jobs_>`_ produce valid XML descriptions of Jenkins jobs you
860 can push them to the Jenkins sandbox.
864 When pushing with `jenkins-jobs`, a log message with the number
865 of jobs you're pushing will be issued, typically to stdout.
866 **If the number is greater than 1** (or the number of jobs you
867 passed to the command to push) then you are pushing too many
868 jobs and should **`ctrl+c` to cancel the upload**. Else you will
869 flood the system with jobs.
873 INFO:jenkins_jobs.builder:Number of jobs generated: 1
875 **Failing to provide the final `<job-name>` param will push all
880 # Don't push all jobs by omitting the final param! (ctrl+c to abort)
881 jenkins-jobs --conf jenkins.ini update jjb/ <job-name>
886 Once you have your Jenkins job configuration `pushed to the
887 Sandbox <Pushing Jobs_>`_ you can trigger it to run.
889 Find your newly-pushed job on the `Sandbox's web UI <jenkins-sandbox_>`_. Click
890 on its name to see the job's details.
892 Make sure you're `logged in <jenkins-sandbox-login_>`_ to the Sandbox.
894 Click "Build with Parameters" and then "Build".
896 Wait for your job to be scheduled and run. Click on the job number to see
897 details, including console output.
899 Make changes to your JJB configuration, re-test, re-push and re-run until
905 If `using Docker <JJB Docker image_>`_:
910 docker run --rm -v ${PWD}:/jjb zxiiro/jjb-docker
914 When pushing with `jenkins-jobs`, a log message with
915 the number of jobs you're pushing will be issued, typically to stdout.
916 **If the number is greater than 1** (or the number of jobs you passed to
917 the command to push) then you are pushing too many jobs and should **`ctrl+c`
918 to cancel the upload**. Else you will flood the system with jobs.
922 INFO:jenkins_jobs.builder:Number of jobs generated: 1
924 **Failing to provide the final `<job-name>` param will push all jobs!**
928 # To upload jobs to the sandbox
929 # Please ensure that you include a configured jenkins.ini in your volume mount
930 # Making sure not to push more jobs than expected, ctrl+c to abort
931 docker run --rm -v ${PWD}:/jjb zxiiro/jjb-docker jenkins-jobs --conf jenkins.ini update . openflowplugin-csit-periodic-1node-cds-longevity-only-master
933 .. _docker-docs: https://www.docker.com/whatisdocker/
934 .. _example-jenkins.ini: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins.ini.example
935 .. _integration-test-wiki: https://wiki.opendaylight.org/view/Integration/Test
936 .. _jenkins-master: https://jenkins.opendaylight.org/releng
937 .. _jenkins-sandbox: https://jenkins.opendaylight.org/sandbox
938 .. _jenkins-sandbox-login: https://jenkins.opendaylight.org/sandbox/login
939 .. _jenkins.ini: http://docs.openstack.org/infra/jenkins-job-builder/execution.html#configuration-file
940 .. _jjb-autoupdate-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-autoupdate-project.py
941 .. _jjb-docker: https://hub.docker.com/r/zxiiro/jjb-docker/
942 .. _jjb-dockerfile: https://github.com/zxiiro/jjb-docker/blob/master/Dockerfile
943 .. _jjb-docs: http://ci.openstack.org/jenkins-job-builder/
944 .. _jjb-init-project.py: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=scripts/jjb-init-project.py
945 .. _jjb-repo: https://github.com/openstack-infra/jenkins-job-builder
946 .. _jjb-requirements.txt: https://github.com/openstack-infra/jenkins-job-builder/blob/master/requirements.txt
947 .. _jjb-templates: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jjb
948 .. _odl-jjb-requirements.txt: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jjb/requirements.txt
949 .. _odl-nexus: https://nexus.opendaylight.org
950 .. _odl-sonar: https://sonar.opendaylight.org
951 .. _python-virtualenv: https://virtualenv.readthedocs.org/en/latest/
952 .. _python-virtualenvwrapper: https://virtualenvwrapper.readthedocs.org/en/latest/
953 .. _releng-wiki: https://wiki.opendaylight.org/view/RelEng:Main
954 .. _releng-builder-gerrit: https://git.opendaylight.org/gerrit/#/admin/projects/releng/builder
955 .. _releng-builder-repo: https://git.opendaylight.org/gerrit/gitweb?p=releng%2Fbuilder.git;a=summary
956 .. _releng-builder-wiki: https://wiki.opendaylight.org/view/RelEng/Builder
957 .. _streams-design-background: https://lists.opendaylight.org/pipermail/release/2015-July/003139.html
958 .. _spinup-scripts: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=tree;f=jenkins-scripts
959 .. _spinup-scripts-basic_settings.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/basic_settings.sh
960 .. _spinup-scripts-controller.sh: https://git.opendaylight.org/gerrit/gitweb?p=releng/builder.git;a=blob;f=jenkins-scripts/controller.sh