Reader small image

You're reading from  Building CI/CD Systems Using Tekton

Product typeBook
Published inSep 2021
PublisherPackt
ISBN-139781801078214
Edition1st Edition
Right arrow
Author (1)
Joel Lord
Joel Lord
author image
Joel Lord

Joel Lord (joel__lord on Twitter) is passionate about the web and technology in general. He likes to learn new things, but most of all, he wants to share his discoveries. He does so by traveling to various conferences all across the globe. He graduated from college with a degree in computer programming in the last millennium. Apart from a little break to get his BSc in computational astrophysics, he has always worked in the industry. In his daily job, Joel is a developer advocate with MongoDB, where he connects with software engineers to help them make the web better by using best practices around JavaScript. In his free time, he can be found stargazing on a campground somewhere or brewing a fresh batch of beer in his garage.
Read more about Joel Lord

Right arrow

Chapter 2: A Cloud-Native Approach to CI/CD

In the first chapter, we took a trip down memory lane to see how software engineering evolved to where it is today – that is, to the days of cloud-native software development. However, cloud-native is still a vague term that does not seem to have a fixed definition.

In this chapter, you will learn about what it means to build software in the context of cloud-native. You will learn about how this differs from traditional software development.

Once you have a better understanding of what cloud-native means, we will see how this applies to CI/CD. To do so, we will look at some of the benefits provided to us by cloud-native principles and try to apply them to CI/CD.

These principles will lead us to Tekton. In this chapter, you will learn what Tekton's mission is and how it fits into cloud-native strategies. You will then learn about the basic components that can be used to build Tekton pipelines and how they all work together...

Being a software developer in the age of cloud-native development

Chances are that you've had to deal with the cloud at some point or another in your career already, but does that make you a cloud-native software developer? The term cloud-native can be overloaded. There are many definitions out there, and it's usually more of a range than an actual set of criteria.

For all things cloud-native-related, we can look toward the Cloud Native Computing Foundation, also known as the CNCF (https://www.cncf.io). The CNCF is a vendor-neutral home for open source projects that are related to cloud-native technologies. They host projects such as Kubernetes, containerd, and Prometheus.

In 2018, they came up with the following definition:

"Cloud-native technologies empower organizations to build and run scalable applications in modern, dynamic environments such as public, private, and hybrid clouds. Containers, service meshes, microservices, immutable infrastructure, and...

Understanding cloud-native CI/CD

Now that you have a better understanding of what cloud-native software development means, let's see what it means in the context of CI/CD pipelines.

Cloud-native CI/CD is based on three principles:

  • Containers
  • Serverless
  • DevOps

Let's look at each of them in more detail.

Containers

Cloud-native, in the context of CI/CD, means that everything should be running inside containers. Each operation that's completed on a code base to test or package up the application should be done in its own isolated container.

Using those containers ensures that any team member or automated system can execute the same operation and get the same predictable end result.

This also means that all the runtimes and configurations needed to run a specific task on some source code will always be the same each time the pipeline runs. This ensures more stability in the pipelines, and you don't need a system administrator...

Introducing Tekton

When you look at CI/CD solutions, they all aim to do the same thing. Essentially, you provide a pipeline with an input (typically, this is your source code), and you get an output at the end (typically, this is a packaged application).

The steps that are performed on your inputs can vary from one project to another, but the same ones can also be used across all your projects. Think of actions such as git clone. Chances are, this will almost always be the first step in your pipeline.

The main goal of Tekton is to provide a cloud-native standard set of building blocks for CI/CD systems to make it easier and faster to build, test, and package up your source code. It runs on Kubernetes and can target any platform, any language, and any cloud.

The Tekton project's vision is to create a set of composable, declarative, reproducible, and cloud-native components that can be used to develop robust pipelines. Because Tekton adds a set of Custom Resource Definitions...

Exploring Tekton's building blocks

We are almost ready to get started with some hands-on examples of how to use Tekton, but before we do so, it is crucial to understand the basic building blocks that are used to build Tekton pipelines.

There are not many components that can be used to build pipelines in Tekton, but they can all be parameterized and tweaked to build powerful pipelines. In this section, we will explore all of them and see how they fit together.

Steps, tasks, and pipelines

The components you will be using the most when dealing with Tekton pipelines are steps, tasks, and pipelines. You can see the relationship between each of them in the following diagram:

Figure 2.2 – Steps, tasks, and pipelines (http://tekton.dev/concepts)

To get a better understanding of how they work together, let's look at them individually.

Steps

Steps are the most basic units that you can use to create your pipeline. They represent a single...

Understanding TaskRuns and PipelineRuns

TaskRuns and PipelineRuns represent how their counterparts are executed; that is, the task and the pipeline. They hold the current status of the task's and pipeline's execution and provide you with more information on their performance, as shown in the following diagram:

Figure 2.3 – PipelineRuns (http://tekton.dev/docs/concepts)

Here, you can see the tasks and pipelines that can be defined as templates so that they can be executed. When you use the CLI to start a pipeline (or a task), it will create the associated run.

TaskRuns

A TaskRun is used to execute a task on a cluster. While the task describes the operation that needs to happen in your pipeline, TaskRun describes this task's execution.

A TaskRun will execute all the steps in the task. It will also contain the status of the task's execution and the status of the execution of each step.

The TaskRun will execute until all...

Summary

In this chapter, you looked at the various building blocks that you can use to build your Tekton CI/CD pipelines. There aren't many components that you can use, but you will learn how to develop sturdy pipelines with them in the next few chapters.

Now that you know what steps, tasks, pipelines, and workspaces are, it is time to build our pipelines.

In the next chapter, you will learn how to install the necessary tooling to run Tekton and then jump into some hands-on examples.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Building CI/CD Systems Using Tekton
Published in: Sep 2021Publisher: PacktISBN-13: 9781801078214
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Author (1)

author image
Joel Lord

Joel Lord (joel__lord on Twitter) is passionate about the web and technology in general. He likes to learn new things, but most of all, he wants to share his discoveries. He does so by traveling to various conferences all across the globe. He graduated from college with a degree in computer programming in the last millennium. Apart from a little break to get his BSc in computational astrophysics, he has always worked in the industry. In his daily job, Joel is a developer advocate with MongoDB, where he connects with software engineers to help them make the web better by using best practices around JavaScript. In his free time, he can be found stargazing on a campground somewhere or brewing a fresh batch of beer in his garage.
Read more about Joel Lord