The course is part of this learning path
This course introduces you to Jenkins, a popular open-source tool used to perform Continuous Integration and Continuous Delivery.
We spend time early on reviewing the key Jenkins features and associated terminology. We then take you through a deep dive in configuring Jenkins to perform automated builds using the Jenkins web administration console in hands-on demonstrations, ensuring that you become familiarised with Jenkins and how to administer it. We’ll demonstrate features such as:
- Installing and setting up Jenkins
- Creating and configuring pipelines manually
- Creating and configuring pipelines using a Jenkinsfile
- Configuring Jenkins pipelines using the Blue Ocean interface
- Defining build execution environments using docker containers
- Triggering build pipelines, manually and automatically
- Navigating downstream and upstream build projects
- Connecting to version control repositories such as GitHub
- Setting up build pipelines for Java-based projects using Gradle
- Recording artifacts and test results
- Setting up and scaling out Jenkins with multiple build agents and executors using SSH
What you'll learn:
- The basic principles of build automation as implemented within Jenkins and how should be applied to manage and maintain building, testing, and deploying your own enterprise software projects
- How to install, setup, and configure Jenkins pipelines
- The key differences between Jenkins declarative and scripted pipelines
- How to manage build artifacts and test results
- How to scale out Jenkins using Master and Build Agent setups using SSH
- The benefits of codifying pipeline build instructions using a Jenkinsfile
- How to leverage Docker containers within a Jenkins pipeline to provide additional build isolation and flexibility
- How to install and use the newer more modern pipeline centric BlueOcean user interface
- How to integrate and leverage 3rd party build tools like Gradle, Maven, Yarn, Webpack, and many more within a Jenkins pipeline
This training course provides many hands-on demonstrations where you will observe first hand how to use Jenkins to build and release different types of software projects, for example:
- Building a back end application developed using Java, Gradle, and Docker, requiring Jenkins to compile the source code, packaging it into a WebArchive file, and then finally releasing it into a Tomcat based Docker image complete with Splunk based instrumentation for logging and monitoring
- A basic understanding of CICD, or Continuous Integration and Continuous Delivery
- A basic understanding of software development and the software development life cycle
- A basic understanding of version control and associated workflows
- Software Build and Release Engineers
- Software Developers
- DevOps Practitioners
- [Instructor] Welcome back! In this lecture, we'll now review the Jenkins installation requirements and the installation process itself. We'll also discuss the software and hardware prerequisites.
Okay, let's begin. Installing Jenkins is both simple and quick. Jenkins is primarily developed in Java and, therefore, a Java runtime, which JRE is the core requirement. More specifically, the current LTS, long term support, version of Jenkins requires Java 8, either the 32-bit version or 64-bit version. Newer versions of Java are yet to be fully supported. Jenkins can be installed on many operating systems, with the only prerequisite being that the operating system in question has a JRE or JDK version eight available and installed.
Jenkins by default can be setup and executed as a standalone application, running in its own process space. It does so by leveraging Jetty, an internally hosted Java servlet container. However, Jenkins can be configured to run within more enterprise-grade Java servlet containers, such as Apache Tomcat or IBM WebSphere. The current minimum hardware requirements documented for running Jenkins are 256 megabytes of RAM and one gigabyte of disk space. However, the recommended hardware configuration for Jenkins is at least one gigabyte of RAM and at least 50 gigabytes of disk space.
The build characteristics of your CICD environment will, to a degree, dictate the specification of the Jenkins master and build agent server configuration. Some things to consider when design your infrastructure are the number of build jobs and pipelines, the execution frequency for each build job or pipeline, the compile and test complexity of each build job or pipeline, and the time taken to perform an end-to-end build or pipeline execution. Answering these questions will help you to decide on not just the hardware specifications, but also, on the master and build agent configuration.
The Jenkins project is located at jenkins.io and here, native installable packages are provided for all popular operating systems. Navigating specifically to the jenkins.io/download URL, native installable packages are provided for macOS, Ubuntu, Windows, Red Hat, and many other operating systems. Regardless, if a native installer does not exist for the operating system that you are using, you can always fallback to downloading the latest generic Jenkins Java web archive package. With this option, you will need to take responsibility of configuring the startup scripts and Java classpaths, etc. For example, in the following screenshot, I have downloaded the latest generic Jenkins Java web archive package, run a quick MD5 checksum on it, confirmed the version of the JRE installed locally, and then, finally, started it up using the java -jar jenkins.war command.
Additionally, the Jenkins project provides a Docker image, which can be pulled from the public Docker Hub repository, allowing you to spin up a containerized version of the Jenkins application. This particular option is incredibly useful for running up localized versions of Jenkins from which you can quickly prototype CICD setups. To start up the Jenkins application as a Docker container, you would simply run the following commands, assuming Docker is currently installed on your system and you've perform a Docker pull of the Jenkins Docker image. Having successfully installed Jenkins, the Jenkins web administration console will by default serve over port 8080. Navigating to port 8080 using HTTP, the first thing that you will be presented with is the Unlock Jenkins screen. To unlock Jenkins, you will need to capture the initial admin password and enter it into the Unlock Jenkins screen. In doing so, you are granted administrator access, allowing you to complete the installation.
When starting up the Jenkins system within the terminal, Jenkins will render out the initial admin password to standard out, as seen here. Additionally, the initial admin password is stored in the initialAdminPassword file, which itself is located in the jenkins home directory/secrets folder. Having entered the initial admin password, Jenkins becomes unlocked, presenting you with the Customize Jenkins screen. Here, you have the option either installing the default set of plugins, which, for most CICD environments, will be more than suitable, or be able to cherry-pick the specific plugins you want to work with. Assuming you've gone with the Install suggested plugins option of the previous screen, Jenkins will proceed by installing a list of pre-configured default plugins as seen here.
Jenkins will download and install each one of these plugins. Internet access is required by the Jenkins service to pull down and install the plugin software. Depending the internet connection involved, this part of the installation can take between one to five minutes to complete. With the installation of the Jenkins plugins complete, you are then presented with the Create First Admin User screen. You will typically want to create a dedicated admin user by providing credentials, but if not needed, you can continue using the default admin credentials.
Continuing on, the installation prompts you with the Instance Configuration screen. This allows you to configure the default URL for the current installation. This URL is used not only by users to navigate directly to the Jenkins web console, but is often used by plugins when integrating with other third party systems for redirection back into Jenkins. For example, if you were to setup and integrate Jenkins with SonarQube for static code analysis, any SonarQube project triggered as part of a Jenkins build will contain a URL pointer back to the specific Jenkins build that triggered it. The Jenkins installation completes with the presentation of the Jenkins is ready! screen. At this stage, you're now ready to begin configuring your build jobs and pipelines.
Upon reentering the Jenkins application for the first time post the installation sequence, you will be prompted with the login page. Here, you simple reenter the administrator credentials that you previously configured. Doing so will take you into the Jenkins default home page.
Okay, that completes this lecture on the hardware and software setup requirements and the Jenkins installation process.
Go ahead and close this lecture and we'll see you shortly in the next one, where you're provided with a number of hands-on demonstrations showing you different ways to install Jenkins and where we also set up some basic freestyle build jobs.
About the Author
Jeremy is the DevOps Content Lead at Cloud Academy where he specializes in developing technical training documentation for DevOps.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 20+ years. In recent times, Jeremy has been focused on DevOps, Cloud, Security, and Machine Learning.
Jeremy holds professional certifications for both the AWS and GCP cloud platforms.