Building CI/CD Systems Using Tekton

Book description

Automate the delivery of applications using Tekton Pipelines and Triggers to deploy new releases quickly and more efficiently

Key Features

  • Learn how to create powerful pipelines using CI/CD tools
  • Understand how to run, deploy and test applications directly in a cloud-native environment
  • Explore the new Tekton Pipelines 2021 features

Book Description

Tekton is a powerful yet flexible Kubernetes-native open source framework for creating continuous integration and continuous delivery (CI/CD) systems. It enables you to build, test, and deploy across multiple cloud providers or on-premise systems.

Building CI/CD Systems Using Tekton covers everything you need to know to start building your pipeline and automating application delivery in a cloud-native environment. Using a hands-on approach, you will learn about the basic building blocks, such as tasks, pipelines, and workspaces, which you can use to compose your CI/CD pipelines. As you progress, you will understand how to use these Tekton objects in conjunction with Tekton Triggers to automate the delivery of your application in a Kubernetes cluster.

By the end of this book, you will have learned how to compose Tekton Pipelines and use them with Tekton Triggers to build powerful CI/CD systems.

What you will learn

  • Understand the basic principles behind CI/CD
  • Explore what tasks are and how they can be made reusable and flexible
  • Focus on how to use Tekton objects to compose a robust pipeline
  • Share data across a pipeline using volumes and workspaces
  • Discover more advanced topics such as WhenExpressions and Secrets to build complex pipelines
  • Understand what Tekton Triggers are and how they can be used to automate CI/CD pipelines
  • Build a full CI/CD pipeline that automatically deploys an application to a Kubernetes cluster when an update is done to a code repository

Who this book is for

This continuous integration and continuous delivery book is for anyone who wants to learn about one of the most powerful Kubernetes-native CI/CD systems - Tekton. Software developers who want to leverage the Custom Resource Definitions (CRDs) in Kubernetes and use Tekton to run pipeline tasks in order to build and own application delivery pipelines will also find this book particularly helpful. Beginner-level knowledge of software development concepts and Kubernetes is required to get the most out of this book.

Table of contents

  1. Building CI/CD Systems Using Tekton
  2. Contributors
  3. About the author
  4. About the reviewers
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
    4. Download the example code files
    5. Code in Action
    6. Download the color images
    7. Conventions used
    8. Get in touch
    9. Share your thoughts
  6. Section 1: Introduction to CI/CD
  7. Chapter 1: A Brief History of CI/CD
    1. The early days
      1. Waterfall model
    2. Understanding the impacts of Agile development practices
      1. Here be testing
    3. Deploying in the era of the cloud
      1. Works on my machine!
      2. The cloud today – cloud native
      3. The future of the cloud
    4. Demystifying continuous integration versus continuous delivery versus continuous deployment
      1. Continuous integration
      2. Continuous delivery
      3. Continuous deployment
      4. CI/CD in the real world
    5. Summary
  8. Chapter 2: A Cloud-Native Approach to CI/CD
    1. Being a software developer in the age of cloud-native development
    2. Understanding cloud-native CI/CD
      1. Containers
      2. Serverless
      3. DevOps
    3. Introducing Tekton
      1. Tekton CLI
      2. Tekton Triggers
      3. Tekton Catalog
      4. Tekton Dashboard
    4. Exploring Tekton's building blocks
      1. Steps, tasks, and pipelines
      2. Where to use a step, a task, or a pipeline
      3. Workspaces
    5. Understanding TaskRuns and PipelineRuns
      1. TaskRuns
      2. PipelineRuns
    6. Summary
  9. Section 2: Tekton Building Blocks
  10. Chapter 3: Installation and Getting Started
    1. Technical requirements
    2. Setting up a developer environment
      1. Git
      2. Node.js
      3. VS Code
    3. Installing a container runtime and setting up a registry
      1. Docker
      2. Docker Hub
    4. Picking a Kubernetes distribution (local, cloud, hosted)
      1. minikube
    5. Connecting to your Kubernetes cluster
    6. Preparing the Tekton tooling
      1. Tekton Dashboard
    7. Summary
  11. Chapter 4: Stepping into Tasks
    1. Technical requirements
    2. Introducing tasks
    3. Understanding Steps
    4. Building your first task
      1. Adding additional Steps
      2. Using scripts
    5. Adding task parameters
      1. Making the Hello task more reusable
      2. Using array type parameters
      3. Adding a default value
    6. Sharing data
      1. Accessing the home directory
      2. Using results
      3. Using Kubernetes volumes
      4. Using workspaces
    7. Visualizing tasks
      1. The VS Code Tekton Pipelines extension
      2. Tekton Dashboard
    8. Digging into TaskRuns
    9. Getting your hands dirty
      1. More than Hello World
      2. Build a generic curl task
      3. Create a random user
    10. Summary
  12. Chapter 5: Jumping into Pipelines
    1. Technical requirements
    2. Introducing pipelines
    3. Building your first pipeline
    4. Parameterizing pipelines
    5. Reusing tasks in the context of a pipeline
    6. Ordering tasks within pipelines
    7. Using task results in pipelines
    8. Introducing pipeline runs
    9. Getting your hands dirty
      1. Back to the basics
      2. Counting files in a repo
      3. Weather services
    10. Summary
  13. Chapter 6: Debugging and Cleaning Up Pipelines and Tasks
    1. Technical requirements
    2. Debugging pipelines
    3. Running a halting task
    4. Adding a finally task
    5. Getting your hands dirty
      1. Fail if root
      2. Make your bets
    6. Summary
  14. Chapter 7: Sharing Data with Workspaces
    1. Technical requirements
    2. Introducing workspaces
    3. Types of volume sources
      1. emptyDir
      2. ConfigMap
      3. Secret
      4. Persistent volume claims and volume claim templates
    4. Using your first workspace
    5. Using workspaces with task runs
    6. Adding a workspace to a pipeline
    7. Persisting data within a pipeline
    8. Cleaning up with finally
    9. Using workspaces in pipeline runs
    10. Using volume claim templates
    11. Getting your hands dirty
      1. Write and read
      2. Pick a card
      3. Hello admin
    12. Summary
  15. Chapter 8: Adding when Expressions
    1. Technical requirements
    2. Introducing when expressions
    3. Using when expressions with parameters
    4. Using the notin operator
    5. Using when expressions with results
    6. Getting your hands dirty
      1. Hello Admin
      2. Critical Hit
      3. Not working on weekends
    7. Summary
  16. Chapter 9: Securing Authentication
    1. Technical requirements
    2. Introducing authentication in Tekton
    3. Authenticating into a Git repository
      1. Basic authentication
      2. SSH authentication
    4. Authenticating in a container registry
    5. Summary
  17. Section 3: Tekton Triggers
  18. Chapter 10: Getting Started with Triggers
    1. Technical requirements
    2. Introducing Tekton Triggers
    3. Installing Tekton Triggers
    4. Configuring your cluster
      1. Using a local cluster
      2. Cloud-based clusters
    5. Defining new objects
      1. Trigger templates
      2. Trigger bindings
      3. Event listeners
    6. Summary
  19. Chapter 11: Triggering Tekton
    1. Technical requirements
    2. Creating a pipeline to be triggered
    3. Creating the trigger
      1. TriggerBinding
      2. TriggerTemplate
      3. EventListener
    4. Configuring the incoming webhooks
      1. Creating a secret
      2. Exposing a route
      3. Making the route publicly available
      4. Configuring your GitHub repository
    5. Triggering the pipeline
    6. Summary
  20. Section 4: Putting It All Together
  21. Chapter 12: Preparing for a New Pipeline
    1. Technical requirements
    2. Cleaning up your cluster
    3. Installing the necessary tooling
    4. Exploring the source code
      1. Creating the container
      2. Deploying the application
    5. Updating the application manually
    6. Summary
  22. Chapter 13: Building a Deployment Pipeline
    1. Technical requirements
    2. Identifying the components
    3. Using the task catalog
    4. Adding an additional task
    5. Creating the pipeline
    6. Creating the trigger
    7. Summary
  23. Assessments
    1. Technical requirements
    2. Chapter 4
      1. More than Hello World
      2. Build a generic curl task
      3. Create a random user
    3. Chapter 5
      1. Back to the basics
      2. Counting files in a repo
      3. Weather services
    4. Chapter 6
      1. Fail if root
      2. Make your bets
    5. Chapter 7
      1. Write and read
      2. Pick a card
      3. Hello admin
    6. Chapter 8
      1. Hello Admin
      2. Critical Hit
      3. Not working on weekends
    7. Why subscribe?
  24. Other Books You May Enjoy
    1. Packt is searching for authors like you
    2. Share your thoughts

Product information

  • Title: Building CI/CD Systems Using Tekton
  • Author(s): Joel Lord
  • Release date: September 2021
  • Publisher(s): Packt Publishing
  • ISBN: 9781801078214