What this book covers
Chapter 1, The What, How, and Why of Continuous Integration, delves into a comprehensive introduction to CI, guided by the Golden Circle theory. This approach helps us to unravel the "what,” "how,” and "why” of CI. Our primary focus is to define the practice of CI, understand its key principles, and learn the essential elements required to achieve it. We will also explore the reasons behind the practice of CI.
Chapter 2, Planning, Deploying, and Maintaining Jenkins, guides you through planning, deploying, and maintaining a Jenkins server. The aim is to design and deploy a Jenkins setup that is resilient, cost-effective, secure, high-performing, and operational. The chapter starts by examining the Jenkins server architecture, and then it evaluates various deployment scenarios against the Well-Architected Framework. It focuses on the two most popular deployment methods for Jenkins, guiding you through their implementation step by step. This process will integrate crucial DevOps practices, including IaC and JCasC. The chapter also covers the essential aspects of Jenkins server maintenance.
Chapter 3, Securing Jenkins, examines the key aspects of securing Jenkins. Here, the vital measures to enhance the security around who gets to do what on your Jenkins instance are explored. Firstly, the chapter delves into user authentication and permissions by integrating Jenkins with Azure Active Directory (AD). After that, it goes through Cross-Site Request Forgery (CSRF) protection settings inside Jenkins. Lastly, it explores the powerful Jenkins Credentials feature, which allows for secure storage and usage of sensitive information, such as passwords, API keys, and certificates.
Chapter 4, Extending Jenkins, explores the expansive world of Jenkins enhancements, enabling you to tailor its functionalities for specific needs such as CI. Enhancing Jenkins for CI demands the integration of additional tools and services, such as SonarQube, Artifactory, and a VCS, which is what the chapter is all about.
Chapter 5, Scaling Jenkins, teaches you how to scale Jenkins horizontally on the cloud with dynamically produced build agents, using both Virtual Machines (VMs) and containers on an AKS cluster. Both solutions allow organizations to leverage the strengths of each approach. VMs provide flexibility and compatibility with existing infrastructure, while containers offer efficient resource utilization and faster deployment times.
Chapter 6, Enhancing Jenkins Pipeline Vocabulary, explores learning Jenkins pipeline code syntax. The chapter’s aim is to prepare you for the use of AI to write a Jenkins pipeline. To achieve this, the chapter begins with an introduction to the Jenkins pipeline syntax. Next, you will learn about the core and add-on building blocks of pipeline code. The focus is mainly on the structure and skeleton of a pipeline. It also teaches you some internal Jenkins tools to construct pipeline code.
Chapter 7, Crafting AI-Powered Pipeline Code, delves into using ChatGPT to write pipeline code. In this chapter, we embark on an enlightening journey into the world of Artificial Intelligence (AI), with a special focus on ChatGPT, a renowned AI model. As we navigate the evolving landscape of AI, you’ll be equipped with the knowledge to harness ChatGPT to aid in the construction of pipeline code.
Chapter 8, Setting the Stage for Writing Your First CI Pipeline, focuses on planning for CI and understanding the high-level CI design. The chapter begins by explaining the software projects that will be used for CI. Next, we will learn to configure tools such as SonarQube for code quality and Artifactory for Docker image storage. These platforms are vital in our CI pipeline. By the end of the chapter, you’ll have grasped how to analyze a software project for CI, comprehend its architecture, and develop a CI design. We’ll also touch on setting real-time CI triggers through webhooks.
Chapter 9, Writing Your First CI Pipeline, logically rounds up everything you learned in the previous chapters. It’s a step-by-step, hands-on guide that will teach you to create a CI pipeline in Jenkins. You will start by writing CI pipeline code stage by stage. At the end of the chapter, we will take a walkthrough of the CI pipeline run, using the Jenkins Blue Ocean interface.
Chapter 10, Planning for Continuous Deployment, delves into understanding CD. You will be introduced to the concepts of CD and its elements, including GitOps. Subsequently, you will be acquainted with a high-level CD design. This is followed by setting up the Argo CD tool, establishing staging and production environments on Azure Kubernetes Service (AKS), and undertaking other essential steps to run a CD pipeline with Jenkins.
Chapter 11, Writing Your First CD Pipeline, methodically steers through the process of developing a full-fledged CD pipeline. Through the automated CD pipeline, you will master the act of updating an application’s Helm chart on GitHub, consequently triggering a deployment in the staging environment. Post-deployment, the pipeline autonomously monitors the application’s status in staging, runs performance tests, and, upon validation, facilitates further Helm chart modifications on GitHub to initiate deployment in the production environment.
Chapter 12, Enhancing Your CI/CD Pipelines, explores techniques to enhance your CI and CD pipelines. It introduces GitHub Copilot, an AI tool that refines Jenkins pipeline code development, aiming for smarter coding, fewer errors, and faster development. It also discusses Jenkins Shared Libraries, which centralize common code patterns, simplifying the management of multiple pipelines. Additionally, strategies are provided to handle and remove old Jenkins builds, ensuring system optimization. Furthermore, using JFrog Xray, the chapter demonstrates how you can integrate automated security scans in your Jenkins pipeline, guaranteeing not just functional but also secure code deployment.