Slide 1

Slide 1 text

Tekton High overview about the engine behind OpenShift Pipelines. GitOps Guide to the Galaxy 1 Christian Hernandez Cloud Platforms BU

Slide 2

Slide 2 text

GENERAL DISTRIBUTION Why Cloud-Native CI/CD? WHAT IS CI/CD? 2 Traditional CI/CD Cloud-Native CI/CD Designed for Virtual Machines Designed for Containers and Kubernetes Require IT Ops for CI engine maintenance Pipeline as a service with no Ops overhead Plugins shared across CI engine Pipelines fully isolated from each other Plugin dependencies with undefined update cycles Everything lifecycled as container images No interoperability with Kubernetes resources Native Kubernetes resources Admin manages persistence Platform manages persistence Config baked into CI engine container Configured via Kubernetes ConfigMaps

Slide 3

Slide 3 text

GENERAL DISTRIBUTION Why Cloud-Native CI/CD? WHAT IS CI/CD? 3 Traditional CI/CD Cloud-Native CI/CD Designed for Virtual Machines Designed for Containers and Kubernetes Require IT Ops for CI engine maintenance Pipeline as a service with no Ops overheard Plugins shared across CI engine Pipelines fully isolated from each other Plugin dependencies with undefined update cycles Everything lifecycled as container images No interoperability with Kubernetes resources Native Kubernetes resources Admin manages persistence Platform manages persistence Config baked into CI engine container Configured via Kubernetes ConfigMaps

Slide 4

Slide 4 text

CONFIDENTIAL Designator 4 OpenShift Pipelines

Slide 5

Slide 5 text

GENERAL DISTRIBUTION 5 Governed by the Continuous Delivery Foundation Contributions from Google, Red Hat, Cloudbees, IBM, Pivotal and many more An open-source project for providing a set of shared and standard components for building Kubernetes-style CI/CD systems OPENSHIFT PIPELINES

Slide 6

Slide 6 text

GENERAL DISTRIBUTION 6 Tekton Concepts TEKTON CONCEPTS Step Run commands in a container with volumes, env vars, etc Task A list of steps that run sequentially in the same pod Pipeline A graph of tasks executed in a certain order Task Run An invocation of a task with inputs and outputs Pipeline Run An invocation of a pipeline with inputs and outputs Condition An check that can determine if a task should be executed Pipeline Resource Inputs and outputs to tasks and pipelines (git, image, etc) Catalog A collection of reusable tasks Triggers A Tekton sub-project to start pipelines based on events

Slide 7

Slide 7 text

GENERAL DISTRIBUTION Steps 7 ● Run command or script in a container ● Kubernetes container spec ○ Env vars ○ Volumes ○ Config maps ○ Secrets TEKTON CONCEPTS - name: build image: maven:3.6.0-jdk-8-slim command: [“mvn”] args: [“install”] - name: parse-yaml image: python3 script:|- #!/usr/bin/env python3 ...

Slide 8

Slide 8 text

GENERAL DISTRIBUTION Task 8 Task Step Step Step Step TEKTON CONCEPTS Example Tasks: Maven Install, AWS CLI, Kubectl Deploy, Security Scan, etc ● Defines a unit of work to be executed ● A list of steps to run sequentially ● Step containers run in the task pod ● Has inputs, outputs and parameters ● Workspaces and results for sharing data ● Can run independent of pipelines

Slide 9

Slide 9 text

GENERAL DISTRIBUTION 9 Maven Task Example kind: Task metadata: name: maven spec: params: - name: goal type: string default: package steps: - name: mvn image: maven:3.6.0-jdk-8-slim command: [ mvn ] args: [ $(params.goal) ]

Slide 10

Slide 10 text

GENERAL DISTRIBUTION TaskRun TEKTON CONCEPTS 10 ● Runs a Task to completion in a pod ● References or embeds a Task spec ● Provides input to Tasks ○ Parameters ○ Resources ○ Service account ○ Workspaces ● Contains execution status and metadata TaskRun step status step status Pod step status container container container Task step step step refers to creates

Slide 11

Slide 11 text

GENERAL DISTRIBUTION Pipeline 11 ● Define Tasks execution order (graph) ○ Serial ○ Parallel ● Inputs and parameters ● Retries tasks ● Conditional task execution ● Workspaces for sharing data between tasks ● Reusable across projects Pipeline Task Task Task Task TEKTON CONCEPTS

Slide 12

Slide 12 text

GENERAL DISTRIBUTION Sharing Data Between Tasks TEKTON CONCEPTS 12 Task: results ● Task exposes data as variables ● Suitable for small pieces of data ● Examples: commit id and branch name Task: workspaces ● Shared volumes between tasks ○ Persistent volumes ○ Config maps ○ Secrets ● Suitable for large data ● Examples: code, binaries, reports Pipeline Task Task /workspace/myw PersistentVolumeClaim

Slide 13

Slide 13 text

GENERAL DISTRIBUTION PipelineRun 13 TEKTON CONCEPTS PipelineRun ● Runs a pipeline to completion ● References or embeds a Pipeline spec ● Creates TaskRuns to execute Tasks in the Pipeline ● TaskRun pods may get scheduled on different node ● Provides inputs and params to pipeline ● Provides volumes for declared pipeline workspaces PipelineRun TaskRun Pod Pipeline creates TaskRun Pod TaskRun Pod Task Task Task

Slide 14

Slide 14 text

GENERAL DISTRIBUTION Triggers 14 TEKTON CONCEPTS Run pipelines based on events like HTTP webhooks on commit, pull request, etc EventListener TriggerTemplate webhook TriggerBinding How to map webhook JSON payload to variables What resources to create (e.g. PipelineRun) using the variables from payload mapping Interceptors PipelineRun Filter or modify webhook payload e.g. match branch or files changes

Slide 15

Slide 15 text

GENERAL DISTRIBUTION Task Catalog TEKTON CONCEPTS 15 ● Catalog of reusable Tasks ○ Image build: buildah, kaniko, jib, buildpacks, etc ○ Source-to-Image: Java, Python, Go, Ruby, etc ○ Language specific: maven, gradle, go, … ○ More to come soon ● Import and compose pipelines ● Available catalogs ○ tektoncd/catalog ○ openshift/pipelines-catalog ● Tekton Hub in beta! ○ https://hub-preview.tekton.dev/

Slide 16

Slide 16 text

GENERAL DISTRIBUTION OpenShift Pipelines Architecture TEKTON CONCEPTS 16 PipelineResource Pipeline Task Task Define pipeline Run pipelines Pipeline Controllers (Tekton, ext, ...) pipeline-pod-a pipeline-pod-b PipelineRun TaskRun TaskRun pipeline-pod-c

Slide 17

Slide 17 text

Let’s Explore! Hacking away at it until it works. GitOps Happy Hour 17 Keyboard time!