See also OpenNMS Continuous Integration.
-
Install and configure a Maven proxy (Nexus or Artifactory)
Each CI job that runs will clean out running users maven repository (~/.m2/repository) as part of the cleanup at the start of the job. Also, the jobs are configured to have the maven repository inside the workspace, and those will be removed as part of a 'git clean -fdx' as part of the shell command. Having a local proxy will also help save network traffic, and speed up the builds.
-
Setup a local git repository clone of OpenNMS.
Each CI job that runs will have its own checked out copy of the source repository. Having a local copy of the repository will help save netowrk traffic and speed up the builds.
-
The OPENNMS-MASTER-CODEREVIEW job will run checkstyle, findbugs, pmd, and SonarQube analysis' against the workspace. If you are going to be running the SonarQube analysis long term, setup a local postgresql/mysql database to store its data in.
-
Install Jenkins from http://jenkins-ci.org/, or Hudson from http://hudson-ci.org/
-
Click 'Manage Jenkins'
-
Click 'Manage Plugins'
-
Select all plugins with updates, and click 'Install without restart' button.
-
After all plugins have downloaded, click the checkbox to 'Restart Jenkins when installation is complete and no jobs are running'.
-
Manage Plugins | Setup Security
- Click 'Enable Security'
- Under 'Security Realm', check 'Jenkins’s own user database'.
- Under 'Authorization', check 'Logged-in users can do anything'.
- Click the 'Save' button.
-
Click on the 'Create an Account' link
- If you have an ssh public/private key:
- After creating your account, login, and click on your username link in the upper right corner.
- Click on 'Configure'
- Paste your public key under the 'SSH Public Keys', and click the 'Save' button.
- If you have an ssh public/private key:
-
Configure JDK: Manage Jenkins | Configure System
- Global Properties
- Check 'Environment variables'
- key: PATH
- value: /sbin:/usr/sbin:/bin:/usr/bin
- Check 'Prepare jobs environment', check 'Unset System Environment Variables'
- Check 'Environment variables'
- JDK
- click 'Add JDK'
- Name: Oracle JDK 7
- uncheck install automatically
- JAVA_HOME: /path/to/oracle7jdk
- Setup any other additinal JDKs you wish to compile and/or test with.
- click 'Add JDK'
- Global Properties
-
Download the jenkins-cli.jar
-
Install plugins (script: setup.sh)
-
CLI="java -jar jenkins-cli.jar -s http://localhost:8080/"
-
$CLI login
-
$CLI install-plugin analysis-core
-
$CLI install-plugin analysis-collector
-
$CLI install-plugin build-failure-analyzer
-
$CLI install-plugin checkstyle
-
$CLI install-plugin envinject
-
$CLI install-plugin findbugs
-
$CLI install-plugin pmd
-
$CLI install-plugin git-client
-
$CLI install-plugin git
-
$CLI install-plugin parameterized-trigger
-
$CLI install-plugin shared-objects
-
$CLI install-plugin violations
-
$CLI install-plugin warnings
-
$CLI restart
-
Setup Jobs (script: setup_jobs.sh)
-
$CLI create-job OpenNMS < jobs/OpenNMS.xml
-
$CLI create-job OPENNMS-MASTER-COMPILE < jobs/OPENNMS-MASTER-COMPILE.xml
-
$CLI create-job OPENNMS-MASTER-CODEREVIEW < jobs/OPENNMS-MASTER-CODEREVIEW.xml
-
$CLI create-job OPENNMS-MASTER-TEST < jobs/OPENNMS-MASTER-TEST.xml
-
$CLI create-job OPENNMS-MASTER-JAVADOC < jobs/OPENNMS-MASTER-JAVADOC.xml
-
Configure the 'OpenNMS' job
-
Under Configuration Matrix
- Choose the 'JDK' option under the 'Add axis', and enable the JDKs you have added on the system.
-
If you don't want to run any code review jobs, then edit the OpenNMS job and delete the triggered job.