Jenkins homepage

What is Jenkins?

Jenkins is an open source continuous integration tool written in Java. The project was forked from Hudson after a dispute with Oracle, which claims the right to trademark the Hudson name and has applied for such a trademark as of December 2010.

Jenkins provides continuous integration services for software development, primarily in the Java programming language. It is a server-based system running in a servlet container such as Apache Tomcat. It supports SCM tools including CVS, Subversion, Git, Mercurial, Perforce and Clearcase, and can execute Apache Ant and Apache Maven based projects as well as arbitrary shell scripts and Windows batch commands.

Builds can be started by various means, including being triggered by commit in a version control system, scheduling via a cron-like mechanism, building when other builds have completed, and by requesting a specific build URL.

Plugins have been released for Jenkins, extending it beyond purely being a build tool for Java projects.[13] Plugins are available for integrating Jenkins with most version control systems and bug databases. Many build tools are supported via their respective plugins. Plugins can also change the way Jenkins looks or add new functionality.

Builds can generate test reports in various formats (JUnit is supported out-of-the-box, others via plugins) and Jenkins can display the reports and generate trends and render them in the GUI.

Jenkins is an award-winning application that monitors executions of repeated jobs, such as building a software project or jobs run by cron. Among those things, current Jenkins focuses on the following two jobs:

  • Building/testing software projects continuously, just like CruiseControl or DamageControl. In a nutshell, Jenkins provides an easy-to-use so-called continuous integration system, making it easier for developers to integrate changes to the project, and making it easier for users to obtain a fresh build. The automated, continuous build increases the productivity.
  • Monitoring executions of externally-run jobs, such as cron jobs and procmail jobs, even those that are run on a remote machine. For example, with cron, all you receive is regular e-mails that capture the output, and it is up to you to look at them diligently and notice when it broke. Jenkins keeps those outputs and makes it easy for you to notice when something is wrong.

What features does Jenkins offers?

  1. Easy installation: Just java -jar jenkins.war, or deploy it in a servlet container. No additional install, no database.
  2. Easy configuration: Jenkins can be configured entirely from its friendly web GUI with extensive on-the-fly error checks and inline help. There's no need to tweak XML manually anymore, although if you'd like to do so, you can do that, too.
  3. Change set support: Jenkins can generate a list of changes made into the build from Subversion/CVS. This is also done in a fairly efficient fashion, to reduce the load on the repository.
  4. Permanent links: Jenkins gives you clean readable URLs for most of its pages, including some permalinks like "latest build"/"latest successful build", so that they can be easily linked from elsewhere.
  5. RSS/E-mail/IM Integration: Monitor build results by RSS or e-mail to get real-time notifications on failures.
  6. After-the-fact tagging: Builds can be tagged long after builds are completed
  7. JUnit/TestNG test reporting: JUnit test reports can be tabulated, summarized, and displayed with history information, such as when it started breaking, etc. History trend is plotted into a graph.
  8. Distributed builds: Jenkins can distribute build/test loads to multiple computers. This lets you get the most out of those idle workstations sitting beneath developers' desks.
  9. File fingerprinting: Jenkins can keep track of which build produced which jars, and which build is using which version of jars, and so on. This works even for jars that are produced outside Jenkins, and is ideal for projects to track dependency.
  10. Plugin Support: Jenkins can be extended via 3rd party plugins. You can write plugins to make Jenkins support tools/processes that your team uses.

How can we install Jenkins?

Jenkins is developed using Java. Download jenkins.war and deploy it to your favorite container. For testing purpose, we can also run Jenkins from the command line:

java -jar jenkins.war

To run Jenkins, minimally you need to have JRE 1.5 or later. After you download, you can launch it by executing java -jar jenkins.war. This is basically the same set up as the test drive, except that the output will go to console, not to a window. Alternatively, if you have a servlet container that supports Servlet 2.4/JSP 2.0 or later, such as Glassfish, Tomcat 5, JBoss, Jetty 6, etc., then you can deploy jenkins.war as you would any WAR file. See this document for more about container-specific installation instruction.

Once the war file is exploded, run chmod 755 jenkins in the exploded jenkins/WEB-INF directory so that you can execute this shell script.

If you're running on Windows you might want to run Jenkins as a service so it starts up automatically without requiring a user to log in. The easiest way to achieve this is to simply download and install Jenkins via the native Windows installer, which can be found on the Jenkins main page. Just download the .zip file, unpack it, and click through the install wizard. The wizard both installs Jenkins and sets up the Jenkins Windows service for you.

Where does Jenkins store the password when we install Jenkins?*


What happens when we install Jenkins by deploying the war file to Tomcat?

  1. Jenkins prompt us to enter the password that it stored at /var/root/.jenkins/secrets/initialAdminPassword
  2. Jenkins prompt us to select additional plugins to install or install recommended plugins
  3. Jenkins prompt us to create the default admininistrator account

How can we manually trigger a build / job?

  1. Log into Jenkins
  2. Click on the build that you want to run
  3. Click on the Build Now link in the top left area of the screen. It will display "Build scheduled" using DOM element that automatically fade away. Shortly after that, or immediately after that, you will see a new entry under the Build History section.

How can we add a new build / job from an existing job?

  1. Log into Jenkins
  2. Click on the New Item link in the top left area of the screen
  3. Provide a name for the job
  4. Select the Copy existing Item radio button
  5. In the Copy from field, type the name of an existing job
  6. Click OK
  7. Customize the settings as much as you wish. If you want Jenkins to get the latest code from your code repository, you have to specify the URL for your code repository.

How can we add a new build / job from scratch?

  1. Log into Jenkins
  2. Click on the New Item link in the top left area of the screen
  3. Provide a name for the job
  4. Choose appropriate type of source code repository (Subversion or Git)
  5. Specify the URL for the source code repository
  6. Specify the appropriate build step (shell command, run Ant, run Maven, etc)

How can we edit an existing job?

  1. Log into Jenkins
  2. Click on the job that you want to edit
  3. Click on the Configure link in the top left area of the screen

How can we disable an existing job?

  1. Log into Jenkins
  2. Click on the job that you want to disable
  3. Click on the Disable Project button on the right hand side.

How can we add a new View?

Jenkins allows us to have multiple Views so that we can group related jobs / builds together. When we log into Jenkins, by default, it will displays all jobs under the All view / tab. Click on the "plus icon" tab. Provide a name for the View. Select the List View radio button and click the OK button.

Where can we find the build artifact?


How can we schedule a job?

Jenkins use cron. It also support @yearly, @annually, @monthly, @weekly, @daily, @midnight, and @hourly as convenient aliases. These use the hash system for automatic balancing. For example, @hourly is the same as H * * * * and could mean at any time during the hour. @midnight actually means some time between 12:00 AM and 2:59 AM.

// Minutes (0-59), Hours (0-23), Day of month (1-31), Month (1-12), Day of week(0-6 or SUN-SAT)
*/5 * * * * OR H/5 * * * * // every 5 minutes
5 * * * * // 5 minute past the hour
0 8 * * * // 8 oclock everyday
0 16,18,20,22 * * * // 4, 6, 8, and 10 o'clock PM every day
00 12 * * 1-5 // noon, every weekday
21 30 3 5 * // runs at 21:30 on the 3rd of May
*/15 * * * * // every 15 minute
H/15 * * * * // every 15 minute
H(0-29)/10 * * * * // every 10 minutes in the first half of the hour
H 9-16/2 * * 1-5 // every 2 hours between 9 and 16, week day
H 1,15 1-11 * // once a day on the 1st and 15th of every month except December


What is stored in the .jenkins folder?

A lot of things are stored in the .jenkins folder.

Where can we find the .jenkins folder?

By default, when we install Jenkins, it will create the .jenkins folder inside the home directory of the user that is running Tomcat. If we do not want this behavior, we need to set the JENKINS_HOME environment variable to point to the folder where we want the .jenkins directory to be created. We can setup this JENKINS_HOME environment variable, either at the operating system level, or we can put it in the script that we use to start Tomcat.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License