Skip to content
dlhartveld edited this page Feb 2, 2013 · 8 revisions

Setting up Jenkins

This page describes the installation and configuration of Jenkins, the continuous integration server that backs DevHub.

Installation of packages

Add the jenkins stable repo:

wget -q -O - http://pkg.jenkins-ci.org/debian-stable/jenkins-ci.org.key | sudo apt-key add -
echo "deb http://pkg.jenkins-ci.org/debian-stable binary/" >> /etc/apt/sources.list
apt-get update
apt-get install jenkins git maven

Modify the /etc/default/jenkins to add the Jenkins prefix to the JENKINS_ARGS so it looks like this:

JENKINS_ARGS="--webroot=/var/cache/jenkins/war --httpPort=$HTTP_PORT --ajp13Port=$AJP_PORT --prefix=$PREFIX"

Jenkins should now run on port 8080. Run curl localhost:8080/jenkins to verify you get HTML from Jenkins. If that works you should also (via nginx) see Jenkins on devhub.nl/jenkins

Configure Jenkins

Go to the Jenkins system configuration page: http://devhub.nl/jenkins/manage

Plugins

Under "Manage Plugins", update, disable and install plugins:

  • Update all current plugins
  • Disable unwanted CVS and subversion plugin
  • Install the following plugins:
    • Green Balls plugin
    • Git plugin
    • Locale plugin
    • Static code analysis plug-ins
    • Analysis collector plugin
    • Checkstyle plugin
    • Findbugs plugin
    • PMD plugin

Global system configuration

Under "Manage Jenkins", "Configure System", set the following properties:

  • Locale - Check the ""Ignore browser preference and force this language to all users" box to force English on all users.
  • JDK - JDK Installations - Add JDK
    • Fill in some recognizable name, i.e. "Default JDK"
    • Unmark "Install automatically".
    • Fill in JAVA_HOME: /usr/java/jdk1.7.0_10
  • Maven: Click "Maven installations..."
    • Unmark "Install automatically".
    • Fil in MAVEN_HOME: /usr/share/maven
  • Git plugin:
    • Set git name to: Default (nothing else - else jenkins-ws-client will break).
    • Set git path to executable to /usr/bin/git
    • Global Config user.name Value: Jenkins
    • Global Config user.email Value: [email protected]
  • Jenkins URL:
  • E-mail Notification:
    • SMTP server: localhost
    • Default user e-mail suffix: @devhub.nl
    • Sender E-mail Address: Jenkins [email protected]
  • SSH server -> disable

Set up security

Note: you have to follow the following directives in the exact order as presented, otherwise, you can lock yourself out of the system.

First, an administrator user must be added.

  • "Manage Jenkins" -> "Configure System"
  • Mark "Enable security"
  • Security Realm:
    • Mark "Jenkins's own user database".
    • Mark "Allow users to sign up".
  • Authorization:
    • Mark "Anyone can do anything."
  • Click apply.
  • Go to the Jenkins top page (i.e., click the Jenkins title at the top left).
  • Click 'sign up' at the top right.
  • Fill in your credentials, and remember them.
  • Click 'Sign up'. You should be presented with a 'Success' page.

Next, don't allow new users to be signed up, and only authorized users should be allowed access:

  • "Manage Jenkins" -> "Configure System"
  • Under "Security Realm", unmark "Allow users to sign up".
  • Under "Authorization", change to "Project-based Matrix Authorization Strategy".
    • Fill in the "User/group to add": the username of the administrator that you just added.
    • Select all permissions for the administrator (use the invert button on the right, the one with the 'x').
    • "Apply".
    • Add the pseudo-group 'authenticated' and give it the 'Overall-Read' permission only.
  • Go to the Jenkins top page.

Make sure permissions are set correctly, and remove any unnecessary accounts that might be configured:

  • Click 'log out', to check that anonymous users don't have access.
  • Log back in.
  • "Manage Jenkins" / "Manage users".
    • Remove any users that you don't want to have in there.