The importance of automation – Continuous Integration with GitHub Actions and Jenkins-1

In the previous chapters, we looked at individual tools that will help us implement several aspects of modern DevOps. Now, it’s time to look at how we can combine all the tools and concepts we’ve learned about and use them to create a continuous integration (CI) pipeline. First, we will introduce a sample microservices-based blogging application, Blog App, and then look at some popular open source and SaaS-based tools that can get us started quickly with CI. We will begin with GitHub Actions and then move on to Jenkins with Kaniko. For every tool, we will implement CI for Blog App. We will try to keep the implementations cloud-agnostic. Since we’ve used the GitOps approach from the beginning, we will also use the same here. Finally, we will cover some best practices related to build performance.

In this chapter, we’re going to cover the following main topics:

  • The importance of automation
  • Introduction to the sample microservices-based blogging application – Blog App
  • Building a CI pipeline with GitHub Actions
  • Scalable Jenkins on Kubernetes with Kaniko
  • Automating a build with triggers
  • Build performance best practices

Technical requirements

For this chapter, you will need to clone the following GitHub repository for some of the exercises: https://github.com/PacktPublishing/Modern-DevOps-Practices-2e.

Run the following command to clone the repository into your home directory, and cd into the ch11 directory to access the required resources:

$ git clone https://github.com/PacktPublishing/Modern-DevOps-Practices-2e.git \ modern-devops

$ cd modern-devops/ch11

So, let’s get started!

The importance of automation

Automation is akin to having an efficient team of robots at your disposal, tirelessly handling repetitive, time-consuming, and error-prone tasks. Let’s simplify the significance of automation:

  • Efficiency: Think of it as having a magical helper who completes tasks in a fraction of the time you would take. Automation accelerates repetitive tasks, executing actions, processing data, and running commands far more swiftly than humans.
  • Consistency: Humans can tire or become distracted, leading to inconsistencies in task execution. Automation guarantees that tasks are consistently carried out according to predefined rules, every single time.
  • Accuracy: Automation operates without the fatigue or lapses that humans may experience. It adheres to instructions with precision, minimizing the likelihood of errors that could result in costly repercussions.
  • Scale: Whether managing one system or a thousand, automation effortlessly scales operations without additional human resources.
  • Cost savings: By reducing the reliance on manual labor, automation yields significant cost savings in terms of time and human resources.
  • Risk reduction: Certain tasks, such as making data backups and performing security checks, are crucial but can be overlooked or skipped by humans. Automation ensures these tasks are consistently performed, mitigating risks.
  • Faster response: Automation detects and responds to issues in real time. For instance, it can automatically restart a crashed server or adjust resource allocation during high traffic, ensuring uninterrupted user experiences.
  • Resource allocation: Automating routine tasks liberates human resources to concentrate on more strategic and creative endeavors that require critical thinking and decision-making.
  • Compliance: Automation enforces and monitors compliance with policies and regulations, reducing the potential for legal and regulatory complications.
  • Data analysis: Automation processes and analyzes vast data volumes rapidly, enabling data-driven decision-making and insights.
  • 24/7 operations: Automation operates tirelessly, 24/7, guaranteeing continuous operations and availability.
  • Adaptability: Automation can be reprogrammed to adapt to evolving requirements and environments, making it versatile and future-proof.