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

Build Agent - Configure Free Swap Space

Start course
1h 12m

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

Learning Objectives

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


  • 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


The following GitHub repo contains sample Jenkins configurations used within the provided demonstrations:

Supporting Documentation

The following supporting Jenkins documentation is available online:


- [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
Learning Paths

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, Terraform, Kubernetes (CKA, CKAD, CKS).