Installing and Configuring Jenkins

Last modified by Bastian Triller on 2012/08/24 19:38

Jenkins is an "extensible continuous integration server". It monitors repeated executions of jobs, such as building software projects, and can be used to build WebObjects applications and frameworks. Jenkins is an open source project and can be used at no cost. It is hosted on Github.com.

An introductory presentation on building WebObjects projects with Hudson (the predecessor to Jenkins) was given by Mike Schrag at WOWODC-West in 2009. You can also have a look at a recording from WOWODC 2009 East.

Pre-requirements

Before you install Jenkins, you will need to install

  • a Java SDK (a JRE won't work because of Ant)
  • a Git client. Make sure that the 'git' command is in the regular PATH (in /usr/bin or /usr/sbin). If it's elsewhere, like /opt/local/bin/git or /usr/local/bin/git, make a symlink in /usr/bin (example: sudo ln -s /opt/local/bin/git /usr/bin/git).
  • a Subversion client if you are going to use Subversion

Upgrading from Hudson

Switching from Hudson to Jenkins is straight-forward since Hudson was the foundation that Jenkins was forked from. jenkins-ci.org has a wiki entry to help with the change.

Stand-Alone Mac OS X Setup

  1. Download the Jenkins Binary Installer from the Jenkins Website.
     The direct link to get the latest installer is: http://mirrors.jenkins-ci.org/osx/latest. This will download a standard OS X Installer Package named jenkins-n.nnn.pkg.
  2. Run the installer
    JenkinsInstaller.png
  3. Restart your computer
     This is required because the current version of Jenkins does not create the its directory until it launches after you restart you computer.
  4. Point your browser to: http://localhost:8080/
  5. Start setting up jobs!

Stand-Alone CentOS/RedHat/Amazon Linux

The easiest way to install Jenkins on a Fedora/RedHat/CentOS/Amazon Linux is by using Yum. The Jenkins project have a Yum repository and complete instructions on how to add the repository + install Jenkins the first time. You can also manually install Jenkins from a RPM available on jenkins-ci.org.

Please note that on CentOS 5.x (I don't know for CentOS 6), the list of root certificates is old, and you will get error when trying to clone a Git repository coming from GitHub. To update the list of root certificates, do:


sudo cp /etc/pki/tls/certs/ca-bundle.crt /etc/pki/tls/certs/ca-bundle.crt.original
sudo curl http://curl.haxx.se/ca/cacert.pem -o /etc/pki/tls/certs/ca-bundle.crt

Stand-Alone Ubuntu/Debian

Follow the following instructions to get Jenkins running on a Ubuntu or Debian system. If you didn't install a Sun JVM before installing Jenkins from their repository, it will install OpenJDK 1.6. Check the Ubuntu documentation for details on how to install a JDK on Ubuntu.

Post installation

After Jenkins is installed and running, go into Jenkins configuration and make sure that you install the "Multiple SCMs" and "Git plugin". If you are using another SCM like Mercurial or Perforce, install the plugins and the clients for your SCM.

Using SSL

Setting up SSL for Jenkins is surprisingly easy. The following is originally from the SSL Setup Options page on nabble.com:

  1. Create a selfsigned test SSL certificate. 
     keytool -genkey -keyalg RSA -alias selfsigned -keystore keystore.jks -storepass ToPSecRet321 -dname "cn=localhost"
  2. Launch Jenkins. 
  3. Unknown macro: noformat. Click on this message for details.
    Launch browser 
     Open "https://localhost:8080" in browser. You might get a browser warning, because the certificate is not signed by a known certificate authority. Communication is SSL-encrypted nevertheless.
Warning

Please Note

The port has changed from the original instructions. That was required on Mac OS X because of permissions. Also, it's worth noting that the keytool asks for a second password for the private key of the ssl certificate. We are using the same password as the keystore password and everything works. It is unclear if that makes a difference.

Servlet Container Installation on Mac OS X (10.5, 10.6)

  1. Install Tomcat from http://www.macports.org with the command 
  2. Unknown macro: noformat. Click on this message for details.
    Create an administrative user in /opt/local/share/java/tomcat6/conf/tomcat-users.xml. <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="manager"/>
    <role rolename="admin"/>
    <user username="tomcat" password="tomcat" roles="admin,manager"/>
    </tomcat-users>
     
  3. The [panel] macro is a standalone macro and it cannot be used inline. Click on this message for details.
    Start Tomcat. 
  4. Unknown macro: noformat. Click on this message for details.
    Download Jenkins, saving jenkins.war somewhere for later.
  5. Create a folder for Jenkins to work in: /opt/local/var/db/jenkins
  6. Change ownership of that folder: chown _www:_www /opt/local/var/db/jenkins
  7. Add the following to /opt/local/share/java/tomcat6/conf/setenv.local
  8. Unknown macro: noformat. Click on this message for details.
    Install Jenkins in Tomcat: go to http://localhost:8080, login with the user and password that you have created in tomcat-users.xml, and upload jenkins.war to the Tomcat server.
  9. Goto http://localhost:8080/jenkins and you can start configuring your Jenkins build server.

Servlet Container Installation on Mac OS X Server (10.6)

  1. Tomcat is by default installed on Mac OS X Server.
  2. Create an administrative user in /Library/Tomcat/conf/tomcat-users.xml. <?xml version='1.0' encoding='utf-8'?>
    <tomcat-users>
    <role rolename="manager"/>
    <role rolename="admin"/>
    <user username="tomcat" password="tomcat" roles="admin,manager"/>
    </tomcat-users> 
     
  3. The [panel] macro is a standalone macro and it cannot be used inline. Click on this message for details.
    The way to start it depends on the version. The current way is to go to the Web Settings in Server Admin, Settings, General, check the Tomcat checkbox. Restart the WebServer. 
  4. Download Jenkins, saving jenkins.war somewhere for later.
  5. Create a folder for Jenkins to work in: /Library/Jenkins
  6. Change ownership of that folder: chown _appserver:sys /Library/Jenkins
  7. Add the following to /Library/Tomcat/bin/setenv.sh
  8. export JENKINS_HOME=/Library/Jenkins
    export JAVA_OPTS=-Djava.awt.headless=true
    Make sure that you are using UTF-8 in the Connector, by adding URIEncoding="UTF-8" to the Connector in /Library/tomcat/conf/server.xml as shown here: 
  9. <Connector port="8080" protocol="HTTP/1.1"
                   connectionTimeout="20000"
                   redirectPort="8443" URIEncoding="UTF-8"/>
    Install Jenkins in Tomcat: go to http://localhost:8080, login with the user and password that you have created in tomcat-users.xml, and upload jenkins.war to the Tomcat server.
  10. Goto http://localhost:8080/jenkins and you can start configuring your Jenkins build server.

Building WO Apps

Jenkins plugins

After Jenkins is installed and started, you will need to install at the very minimum two plugins: Multiple SCMs and Git. They are required if you need to build projects by using the WOJenkins templates. If your projects are under another SCM like Subversion or CVS, you also need to install Jenkins for it.

Information

Don't forget to set Global Config user.name Value and Global Config user.email Value in the Jenkins settings, or else doing a Git clone will return an error.

Building projects

See Installing WebObjects and Wonder for Jenkins using WOJenkins