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:
- Creating and configuring pipelines using a Jenkinsfile
- Configuring Jenkins pipelines using the Blue Ocean interface
- Defining build execution environments using docker containers
- Setting up and scaling out Jenkins with multiple build agents and executors using SSH
- Setting up build pipelines for Java-based projects using Gradle
What you'll learn:
- 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
The following GitHub repo contains sample Jenkins configurations used within the provided demonstrations:
The following supporting Jenkins documentation is available online:
- [Instructor] Okay, welcome back! In the previous demonstration we introduced you to the Jenkins Blue Ocean interface.
Blue Ocean is a new user experience. Very much a pipelines centric user experience. It's very modern and it's very clean. In the previous demonstration we built the devops-webapp1 project and that project had a Jenkins file. The point here is that when Blue Ocean was instructed to set up this pipeline it discovered that Jenkins file and was able to build the pipeline automatically. In this particular demonstration I want to show you the user experience within Blue Ocean of building a project on GitHub when it doesn't have a Jenkins file. So we're going to build devops-webapp2. This is an identical copy of the previous project except it doesn't have a Jenkins file.
Okay, let's begin. Again we're in the Blue Ocean interface. Click on new pipeline. We select GitHub. Select our organization. And this time we're going to select webapp2 which doesn't have Jenkins file. You can see here that Blue Ocean is going to inform us that there is no Jenkins file and that it then takes us into the interface allowing us to create the pipeline. The first thing we'll do is we'll update the pipeline settings and we'll indicate that we want this bill pipeline to operate or be executed on a particular build agent. In this case Agent1. We'll then add our first stage. And here our first stage will be called Clone. And the steps, we need to add a step. And here we select Git. We need to give it the URL. Paste it here, we'll indicate that we're going to operate on the master branch. And that completes the setup for the Clone stage.
Back within our visual editor we click the plus button to add a second stage and this time we'll call it Build. And now we'll click on the add step. And this time we'll select a Shell Script. And then for the Shell Script we'll run the following commands. We call whoami to discover the user that is actually running the build job, we'll print out the date, we'll echo out the path environment variable, we'll take a look at the current path, we'll list out the contents of the current path, and then we'll call the gradle wrapper which will set up gradle and call build on it. And we'll add on info to get extra information about the build process.
Okay, that's completed. Again, within our visual editor we click the plus icon and we add a third stage. This one we'll call Publish. We click the add step button and this time we select archived artifacts. For artifacts we're going to search the build/loops directory, capture any web archive file that's been created as part of our Build stage. We'll also enable fingerprint to actually fingerprint the file. And we'll only do this if everything is successful. Okay, we're now at a stage where we can save the pipeline. And what this will do is this will generate a Jenkins file and commit back to our repository. We'll give it a description, setup pipeline, and we commit back to master. We select it. We simply rerun it. So now we can see the pipeline executing. The clone has completed already. We're into the build phase.
Okay the build phase is finished and the publishing is finished. So now again if we look at artifacts we will see our web archive file that has been created for us. And also the pipeline log has been captured. Okay, from here we'll return to our project on GitHub. So you can see here that Blue Ocean has generated a Jenkins file based on the visual editing that we performed within the Blue Ocean interface. If we open it up this contains all of the instructions that we edited within the pipeline editor.
So let's return to the pipeline editor for this particular project. And we'll quickly update it. So this time we'll add a parallel stage. We'll call it P1 and we'll add a step. It will just be a simple Shell Script. And we'll enter the following commands to print out the date and echo statement to say that it was executed in parallel. We'll return and add a second one. We'll call it P2. Again we'll add a Shell Script. And the same commands. We'll click save and we'll give it a message updated with new stages. Click the save and run button. It's created a new commit so the Jenkins file within our repository will have been updated. So if we reload it we can see here that our parallel stages are committed into our Jenkins file. And that the build pipeline has already completed successfully.
So let's quickly summarize what we performed in this demonstration. We built a GitHub project that started without a Jenkins file. When Blue Ocean determined this it presented a pipeline editor where we were visually able to create the build pipeline. When we saved the pipeline Blue Ocean generated a Jenkins file and committed it back to our source repository. It then kicked off a build and the pipeline completed successfully.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, GCP, Azure), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, GCP, and Kubernetes (CKA, CKAD, CKS).