1. Home
  2. Training Library
  3. Jenkins CICD - Advanced

Build Agent - Configure Free Swap Space

Start course
Overview
DifficultyBeginner
Duration1h 12m
Students52
Ratings
5/5

Description

Introduction

This training 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

Learning Objectives

What you'll learn:

  • The basic principles of build automation as implemented within Jenkins and how should be a 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

Demonstration

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 front end application which has been developed using the React Javascript framework, using technologies such as Webpack and Yarn
  • 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

Prerequisites

  • 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

Intended Audience

  • Software Build and Release Engineers
  • Software Developers
  • DevOps Practitioners

Transcript

- [Instructor] Okay, welcome back! In this demonstration, we're going to revisit the previous demonstration, where we set up a build agent but we didn't address the free swap space on that particular build agent. 

So, if we click on "Manage Jenkins," and we go down to "Manage Notes," here we can see "agent1" which we set up in the previous demonstration. And it's currently reporting that it's got zero bytes for free swap space. So in this demonstration, we'll update the "build agent1" and give it some swap space. Now, why does Jenkins actually require swap space in the first instance? Well, if you've got lots of concurrent build jobs, then occasionally Jenkins may need to free up some space in memory, and it does so by flushing out to the swap space on the disk system. 

Okay, we'll now swap over into the terminal, and we'll SSH back into our build agent. First thing we'll do is we'll run the "Free" command, and here we can see that indeed, we've got no swap space or that the swap is zeroed out. We can also see that we have got 2 gig of memory for our T3.small instance type that our build agent is set up on. So we'll do a "DF-H" to see the available space on our disk system, followed by a "sudo fallocate-L" and we'll allocate 2 gig to the location "swapfile." We'll now do a directory listing on that. So it's set up. 

Now we'll run the command "sudo mkswap" and specify the swap location. Okay, that is done. Now we'll enable by using "swapon" the swap file. Run "sudo swapon --show" and indeed we've got a swap file that's been registered. We'll run "free-H" again and now we can see that indeed the swap has registered and available. Next we'll run "sudo copy" and we'll take back up the fstab file to fstab.bak. We'll echo into the fstab file the following seeding which will mount the swap file at boot time. Okay; everything is in place. We'll jump back into Jenkins. What we need to do is disconnect the agent. Click "Yes" and then relaunch the agent. 

The agent is back online. We go back to the list. This time our free space has been registered and we've got 2 gig available. So in summary, we've edited in a swap space that the build agent can now use. So that if there are many component build jobs the range can be flushed out to the swap space on the disk system.

About the Author

Students10941
Labs28
Courses65
Learning paths15

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.