Upgrade to Pro — share decks privately, control downloads, hide ads and more …

A Guide to Tekton for Jenkins Users

A Guide to Tekton for Jenkins Users

Tekton Pipelines is an open-source project that focuses on providing a Kubernetes-native, lightweight, easy to manage serverless CI/CD framework. In this session, you will learn about Tekton Pipelines, how it works and see examples of how you can use it to build container-based CI/CD pipelines. We will also discuss what this means for Jenkins users.

Red Hat Livestreaming

August 10, 2020
Tweet

More Decks by Red Hat Livestreaming

Other Decks in Technology

Transcript

  1. GENERAL DISTRIBUTION 2 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
  2. GENERAL DISTRIBUTION 3 Tekton Pipelines Kubernetes-native declarative pipelines Standard and

    portable to any Kubernetes platform Run pipelines in isolated containers with all required dependencies Serverless CI/CD with no single server to share and maintain Web, CLI, and Visual Studio Code and IDE plugins
  3. GENERAL DISTRIBUTION Steps 4 • 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 ...
  4. GENERAL DISTRIBUTION Task 5 • 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 Task Step Step Step Step TEKTON CONCEPTS Example Tasks: Maven Install, AWS CLI, Kubectl Deploy, Security Scan, etc
  5. GENERAL DISTRIBUTION 6 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) ]
  6. GENERAL DISTRIBUTION Pipeline 7 • Define Tasks execution order (graph)

    • Inputs and parameters • Retries tasks • Conditional task execution • Workspaces for sharing data between tasks • Reusable across projects Pipeline Task Task Task Task TEKTON CONCEPTS
  7. GENERAL DISTRIBUTION kind: Pipeline metadata: name: deploy-pipeline spec: params: -

    name: app-git-repo tasks: - name: fetch-from-git taskRef: name: git-clone params: ... - name: skaffold-unit-tests runAfter: [fetch-from-git] taskRef: name: unit-tests ... - name: build-skaffold-app runAfter: [skaffold-unit-tests] taskRef: name: kaniko ... 8 Pipeline Example
  8. GENERAL DISTRIBUTION OpenShift Pipelines Architecture TEKTON CONCEPTS 9 PipelineResource Pipeline

    Task Task Define pipeline Run pipelines Pipeline Controllers (Tekton, ext, ...) pipeline-pod-a pipeline-pod-b PipelineRun TaskRun TaskRun pipeline-pod-c
  9. GENERAL DISTRIBUTION OpenShift Pipelines OPENSHIFT PIPELINES 10 OpenShift Dev Console

    OpenShift Pipelines Tekton CLI Kubernetes CI/CD Core Developer Tools CodeReady Workspaces (Eclipse Che) Tekton Pipelines Integrations Extensions Operator API Visual Studio Code Tasks
  10. GENERAL DISTRIBUTION 11 Jenkins Pipeline Tekton Pipeline pipeline { stages

    { stage('Git Clone') { steps { ... } } stage('Build App') { steps { ... } } stage('Test') { steps { ... } } stage('Code Analysis') { steps { ... } } } } kind: Pipeline spec: tasks: - name: git-clone - name: build-app - name: test - name: code-analysis
  11. GENERAL DISTRIBUTION 12 Jenkins Pipeline Tekton Pipeline pipeline { agent

    { label 'maven' } stages { stage ('Clone') { git url: 'https://github.com/...' } stage ('Build App') { withMaven(maven: 'maven-3') { sh "mvn clean verify" } } ... } kind: Pipeline spec: tasks: - name: git-clone taskRef: name: git-clone params: - name: url value: https://github.com/... workspaces: - name: app-workspace workspace: app-source - name: build-app taskRef: name: maven params: - name: GOALS value: ["clean", "verify"] runAfter: - git-clone workspaces: - name: app-workspace workspace: app-source
  12. GENERAL DISTRIBUTION Why Tekton? WHAT IS CI/CD? 13 Jenkins Tekton

    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
  13. GENERAL DISTRIBUTION linkedin.com/company/red-hat youtube.com/user/RedHatVideos facebook.com/redhatinc twitter.com/RedHat 14 Red Hat is

    the world’s leading provider of enterprise open source software solutions. Award-winning support, training, and consulting services make Red Hat a trusted adviser to the Fortune 500. Thank you