<img alt="" src="https://secure.bomb5mild.com/193737.png" style="display:none;">

Turbonomic Blog

Introduction to Jenkins

Posted by Steven Haines on Oct 21, 2016 8:55:05 AM
Find me on:

Jenkins is one of the most popular open-source continuous integration and continuous delivery servers available today. It began as a product called Hudson, developed at Sun Microsystems in 2004-2005, before it was forked from Hudson and renamed Jenkins in 2011, as the result of a dispute between the Hudson community and Oracle. Kohsuke Kawaguchi, the creator of Hudson/Jenkins became the Chief Technical Officer for Cloudbees in 2014 and Cloudbees now commercially offers Jenkins as a cloud solution.

The most important thing about Jenkins is not necessarily the software, but rather the community that has rallied around Jenkins and built out hundreds of plugins to accomplish almost anything that you would want to do. Jenkins provides support for all popular source code management (SCM) systems, including Git, Subversion, Mercurial, and CVS, popular build tools like Maven, Ant, Gulp, and Grunt, as well as testing frameworks and report generators. Jenkins plugins provide strong support for technologies like Docker and ECS, which enable the creation and deployment of cloud-based microservice environments, both for testing as well as production deployments. And, in 2016, Jenkins released powerful delivery pipeline support using a Groovy Domain Specific Language (DSL) in what they refer to as “Pipeline as Code”.

In short, Jenkins provides all of the features and functionality that you need to build a robust continuous integration and continuous delivery pipeline. Throughout this series of articles we will explore different facets of Jenkins and configure it to run our builds, setup test environments, and even push applications from the SCM to production.

Setting up Jenkins

Jenkins can run in several different ways:

  • It can run as a WAR file deployed to a Servlet container, such as Apache Tomcat
  • It can run in a Docker container, either locally or on a public or private cloud
  • It can run as a Software as a Service, hosted by a company like CloudBees

For the examples in this series we’re going to setup Jenkins locally by downloading a WAR file and deploying it to Apache Tomcat.

First, download Jenkins from jenkins.io, click on “Download Jenkins”, select the LTS (long term support) WAR file, and save the file to your local hard drive.

Next, download Tomcat from apache.tomcat.org. For this example I am going to download Tomcat 8.5, which, at the time of this writing, is the latest production (non-alpha) version. You should be fine using any recent version of Tomcat. Download the zip or tar.gz file and decompress it to your local hard drive.

If you do not already have Java installed, you will need to install Java before you can run Tomcat. You can download Java from Oracle’s website. You will need to set the JAVA_HOME environment variable to point to your Java installation directory and ensure that Java’s bin directory is in your PATH.

Finally, copy jenkins.war to your Tomcat’s webapps directory. You can start Tomcat by executing the startup.sh or startup.bat file from the Tomcat bin directory. Tomcat writes its logs to the logs/catalina.out file, which you will need to access in order to retrieve the administrator password:

*************************************************************

*************************************************************

*************************************************************

Jenkins initial setup is required. An admin user has been created and a password generated.

Please use the following password to proceed to installation:

205be6fe69c447dd933a3c9ce7420496

This may also be found at: /var/jenkins_home/secrets/initialAdminPassword

*************************************************************

*************************************************************

*************************************************************

You can access Jenkins by opening a browser to the following URL:

http://localhost:8080/jenkins

Note that if you already have something running on port 8080, you can change the configuration by modifying the conf/server.xml file; the XML file is pretty self explanatory, but you can search and replace all 8080 references with the port that you want Tomcat to listen on. Finally, note that you will need to restart Tomcat for the configuration changes to take effect.

The Jenkins application will create a new directory named .jenkins in your home directory where it will download your source code, run builds, install plugins, and so forth. We’ll look deeper at Jenkins’ internals in the next article.

Conclusion

Continuous integration, through automation of both builds and tests, dramatically improved application release cycles by rendering integration as a non-issue. As continuous integration evolved, the industry created the notion of continuous delivery and continuous deployment to render production deployments a non-issue. These automated tools allow us to go from checking in code to deploying a new version of our application to production.

This series introduced continuous integration, continuous delivery, and continuous deployment  and presented Jenkins as an open source tool that enables all of this. In the next article we will setup an application for continuous integration, including executing unit tests and static code analysis, and subsequent articles will review how to implement a deployment pipeline and realize continuous delivery and deployment.

Topics: Applications, DevOps

Subscribe Here!

Recent Posts

Posts by Tag

See all