Pipelines

OpenShift Container Platform 4.5

Configuring and using Pipelines in OpenShift Container Platform

Red Hat OpenShift Documentation Team

Abstract

This document provides instructions for configuring and using pipelines in OpenShift Container Platform.

Chapter 1. Understanding OpenShift Pipelines

Important

OpenShift Pipelines is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.

For more information about the support scope of Red Hat Technology Preview features, see https://access.redhat.com/support/offerings/techpreview/.

OpenShift Pipelines is a cloud-native, continuous integration and continuous delivery (CI/CD) solution based on Kubernetes resources. It uses Tekton building blocks to automate deployments across multiple platforms by abstracting away the underlying implementation details. Tekton introduces a number of standard Custom Resource Definitions (CRDs) for defining CI/CD pipelines that are portable across Kubernetes distributions.

1.1. Key features

  • OpenShift Pipelines is a serverless CI/CD system that runs Pipelines with all the required dependencies in isolated containers.
  • OpenShift Pipelines are designed for decentralized teams that work on microservice-based architecture.
  • OpenShift Pipelines use standard CI/CD pipeline definitions that are easy to extend and integrate with the existing Kubernetes tools, enabling you to scale on-demand.
  • You can use OpenShift Pipelines to build images with Kubernetes tools such as Source-to-Image (S2I), Buildah, Buildpacks, and Kaniko that are portable across any Kubernetes platform.
  • You can use the OpenShift Container Platform Developer Console to create Tekton resources, view logs of Pipeline runs, and manage pipelines in your OpenShift Container Platform namespaces.

1.2. OpenShift Pipelines concepts

OpenShift Pipelines provide a set of standard Custom Resource Definitions (CRDs) that act as the building blocks from which you can assemble a CI/CD pipeline for your application.

Task
A Task is the smallest configurable unit in a Pipeline. It is essentially a function of inputs and outputs that form the Pipeline build. It can run individually or as a part of a Pipeline. A Pipeline includes one or more Tasks, where each Task consists of one or more Steps. Steps are a series of commands that are sequentially executed by the Task.
Pipeline
A Pipeline consists of a series of Tasks that are executed to construct complex workflows that automate the build, deployment, and delivery of applications. It is a collection of PipelineResources, parameters, and one or more Tasks. A Pipeline interacts with the outside world by using PipelineResources, which are added to Tasks as inputs and outputs.
PipelineRun
A PipelineRun is the running instance of a Pipeline. A PipelineRun initiates a Pipeline and manages the creation of a TaskRun for each Task being executed in the Pipeline.
TaskRun
A TaskRun is automatically created by a PipelineRun for each Task in a Pipeline. It is the result of running an instance of a Task in a Pipeline. It can also be manually created if a Task runs outside of a Pipeline.
PipelineResource
A PipelineResource is an object that is used as an input and output for Pipeline Tasks. For example, if an input is a Git repository and an output is a container image built from that Git repository, these are both classified as PipelineResources. PipelineResources currently support Git resources, Image resources, Cluster resources, Storage Resources and CloudEvent resources.
Workspace
A Workspace is a storage volume that a Task requires at runtime to receive input or provide output. A Task or Pipeline declares the Workspace, and a TaskRun or PipelineRun provides the actual location of the storage volume, which mounts on the declared Workspace. This makes the Task flexible, reusable, and allows the Workspaces to be shared across multiple Tasks.
Trigger
A Trigger captures an external event, such as a Git pull request and processes the event payload to extract key pieces of information. This extracted information is then mapped to a set of predefined parameters, which trigger a series of tasks that may involve creation and deployment of Kubernetes resources. You can use Triggers along with Pipelines to create full-fledged CI/CD systems where the execution is defined entirely through Kubernetes resources.
Condition
A Condition refers to a validation or check, which is executed before a Task is run in your Pipeline. Conditions are like if statements which perform logical tests, with a return value of True or False. A Task is executed if all Conditions return True, but if any of the Conditions fail, the Task and all subsequent Tasks are skipped. You can use Conditions in your Pipeline to create complex workflows covering multiple scenarios.

1.3. Detailed OpenShift Pipeline Concepts

Given below is a detailed view of the various Pipeline concepts.

1.3.1. Tasks

Tasks are the building blocks of a Pipeline and consist of sequentially executed Steps. Steps are a series of commands that achieve a specific goal, such as building an image.

Every Task runs as a Pod and each Step runs in its own container within the same Pod. Because Steps run within the same Pod, they have access to the same volumes for caching files, ConfigMaps, and Secrets.

A Task uses inputs parameters, such as a Git resource, and outputs parameters, such as an image in a registry, to interact with other Tasks. They are reusable and can be used in multiple Pipelines.

Here is an example of a Maven Task with a single Step to build a Maven-based Java application.

apiVersion: tekton.dev/v1beta1 1
kind: Task 2
metadata:
  name: maven-build 3
spec: 4
  resources:
    inputs:
    - name: workspace-git
      targetPath: /
      type: git
  steps:
  - name: build
    image: maven:3.6.0-jdk-8-slim
    command:
    - /usr/bin/mvn
    args:
    - install
1
Task API version v1beta1.
2
Specifies the type of Kubernetes object. In this example, Task.
3
Unique name of this Task.
4
Lists the Task Steps along with input and output resources.

This Task starts the Pod and runs a container inside that Pod using the maven:3.6.0-jdk-8-slim image to run the specified commands. It receives an input directory called workspace-git that contains the source code of the application.

The Task only declares the placeholder for the Git repository, it does not specify which Git repository to use. This allows Tasks to be reusable for multiple Pipelines and purposes.

1.3.2. TaskRun

A TaskRun instantiates a Task for execution with specific inputs, outputs, and execution parameters on a cluster. It can be invoked on its own or as part of a PipelineRun.

A Task consists of one or more Steps that execute container images, and each container image performs a specific piece of build work. A TaskRun executes the Steps in a Task in the specified order, until all Steps execute successfully or a failure occurs.

Here is an example of a TaskRun to run a Task apply-manifests with relevant input parameters:

apiVersion: tekton.dev/v1beta1 1
kind: TaskRun 2
metadata:
  name: apply-manifests-taskrun 3
spec: 4
  resources: 5
    inputs:
    - name: source
      resourceRef:
        name: git-resource-name
  params: 6
  - name: manifest_dir
    value: directory-name
  taskRef: 7
    name: apply-manifests
    kind: Task
1
TaskRun API version v1beta1.
2
Specifies the type of Kubernetes object. In this example, TaskRun.
3
Unique name to identify this TaskRun.
4
Definition of the TaskRun. For this TaskRun, a set of input resources, parameters, and Tasks are specified.
5
Resources required to run the Tasks. For this TaskRun, git-resource-name is referred as an input resource.
6
List of parameters required to run the Task.
7
Name of the Task reference used for this TaskRun. This TaskRun executes the Task apply-manifests.

1.3.3. Pipelines

A Pipeline is a collection of Tasks arranged in a specific order of execution. You can define a CI/CD workflow for your application using Pipelines containing one or more Tasks.

A Pipeline definition consists of a number of fields or attributes, which together enable the Pipeline to accomplish a specific goal. Each Pipeline definition must contain at least one Task, which ingests specific inputs and produces specific outputs. The Pipeline definition can also optionally include Conditions, Workspaces, Parameters, or Resources depending on the application requirements.

Here is a code snippet of a Pipeline build-and-deploy, which builds an application image from a Git repository using buildah ClusterTask:

apiVersion: tekton.dev/v1beta1 1
kind: Pipeline 2
metadata: 3
  name: build-and-deploy
spec: 4
  resources: 5
  - name: git-repo
    type: git
  - name: image
    type: image
  params: 6
  - name: deployment-name
    type: string
    description: name of the deployment to be patched
  tasks: 7
  - name: build-image 8
    taskRef:
      name: buildah
      kind: ClusterTask
    resources:
      inputs:
      - name: source
        resource: git-repo
      outputs:
      - name: image
        resource: image
    params:
    - name: TLSVERIFY
      value: "false"
  - name: apply-manifests 9
    taskRef:
      name: apply-manifests
    resources:
      inputs:
      - name: source
        resource: git-repo
    runAfter: 10
    - build-image
...
1
Pipeline API version v1beta1.
2
Specifies the type of Kubernetes object. In this example, Pipeline.
3
Unique name of this Pipeline.
4
Specifies the definition and structure of the Pipeline.
5
Set of resources required to run the Tasks specified in the Pipeline.
6
Parameters used across all the Tasks in the Pipeline.
7
Specifies the list of Tasks used in the Pipeline. In this example, two Tasks are specified: build-image and apply-manifests.
8
Task build-image, which uses the buildah ClusterTask to build application images from a given Git repository.
9
Task apply-manifests, which uses a user-defined Task with the same name.
10
Specifies the sequence in which Tasks are run in a Pipeline. In this example, the apply-manifests Task is run only after the build-image Task is completed.

1.3.4. PipelineRun

A PipelineRun instantiates a Pipeline for execution with specific inputs, outputs, and execution parameters on a cluster. A corresponding TaskRun is created for each Task automatically in the PipelineRun.

All the Tasks in the Pipeline are executed in the defined sequence until all Tasks are successful or a Task fails. The status field tracks and stores the progress of each TaskRun in the PipelineRun for monitoring and auditing purpose.

Here is an example of a PipelineRun to run a Pipeline build-and-deploy with relevant resources and parameters:

apiVersion: tekton.dev/v1beta1 1
kind: PipelineRun 2
metadata:
  name: build-deploy-api-pipelinerun 3
spec:
  pipelineRef:
    name: build-and-deploy 4
  resources: 5
  - name: git-repo
    resourceRef:
      name: api-repo
  - name: image
    resourceRef:
      name: api-image
  params: 6
  - name: deployment-name
    value: vote-api
1
PipelineRun API version v1beta1.
2
Specifies the type of Kubernetes object. In this example, PipelineRun.
3
Unique name to identify this PipelineRun.
4
Name of the Pipeline to be run. In this example, build-and-deploy.
5
Name of the resources which will be required to run the Pipeline build-and-deploy.
6
Specifies the list of parameters required to run the Pipeline.

1.3.5. Workspaces

Workspaces declare shared storage volumes that a Task in a Pipeline needs at runtime. Instead of specifying the actual location of the volumes, Workspaces enable you to declare the filesystem or parts of the filesystem that would be required at runtime. You must provide the specific location details of the volume that is mounted into that Workspace in a TaskRun or a PipelineRun. This separation of volume declaration from runtime storage volumes makes the Tasks reusable, flexible, and independent of the user environment.

Listed below are the various ways in which you can use Workspaces:

  • Store Task inputs and outputs
  • Share data among Tasks
  • Use it as a mount point for credentials held in Secrets
  • Use it as a mount point for configurations held in ConfigMaps
  • Use it as a mount point for common tools shared by an organization
  • Create a cache of build artifacts that speed up jobs

You can specify Workspaces in the TaskRun or PipelineRun using:

  • A read-only ConfigMaps or Secret
  • An existing PersistentVolumeClaim shared with other Tasks
  • A PersistentVolumeClaim from a provided VolumeClaimTemplate
  • An emptyDir that is discarded when the TaskRun completes

Here is a code snippet of the build-and-deploy Pipeline which declares a shared-workspace Workspace for the Tasks, build-image and apply-manifests, defined in the Pipeline.

apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: build-and-deploy
spec:
  workspaces: 1
  - name: shared-workspace
  params:
...
  tasks: 2
  - name: build-image
   taskRef:
     name: buildah
     kind: ClusterTask
   params:
   - name: TLSVERIFY
     value: "false"
   - name: IMAGE
     value: $(params.IMAGE)
   workspaces: 3
   - name: source 4
     workspace: shared-workspace 5
   runAfter:
   - fetch-repository
 - name: apply-manifests
   taskRef:
     name: apply-manifests
   workspaces: 6
   - name: source
     workspace: shared-workspace
   runAfter:
    - build-image
...
1
List of Workspaces shared between the Tasks defined in the Pipeline. A Pipeline can define as many Workspaces as required. In this example, only one Workspace named shared-workspace is declared.
2
Definition of Tasks used in the Pipeline. This snippet defines two Tasks, build-image and apply-manifests, which share a common Workspace.
3
List of Workspaces used in the build-image Task. A Task definition can include as many Workspaces as it requires. However, it is recommended that a Task uses at most one writable Workspace.
4
Name that uniquely identifies the Workspace used in the Task. This Task uses one Workspace named source.
5
Name of the Pipeline Workspace used by the Task. Note that the Workspace source in turn uses Pipeline Workspace shared-workspace.
6
List of Workspaces used in apply-manifests Task. Note that this Task shares the source Workspace with build-image Task.

Here is a code snippet of the build-deploy-api-pipelinerun PipelineRun, which uses a PersistentVolumeClaim for defining the storage volume for the shared-workspace Workspace used in the build-and-deploy Pipeline.

apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
  name: build-deploy-api-pipelinerun
spec:
  pipelineRef:
    name: build-and-deploy
  resources:
  - name: image
    resourceRef:
      name: api-image
  params:
...

  workspaces: 1
  - name: shared-workspace 2
    persistentvolumeclaim:
      claimName: source-pvc 3
1
Specifies the list of Pipeline Workspaces for which volume binding will be provided in the PipelineRun.
2
The name of the Workspace in the Pipeline for which the volume is being provided.
3
Specifies the name of a predefined PersistentVolumeClaim, which will be attached to the Workspace. In this example, an existing source-pvc PersistentVolumeClaim is attached with the shared-workspace Workspace.

1.3.6. Triggers

Use Triggers in conjunction with Pipelines to create a full-fledged CI/CD system where the Kubernetes resources define the entire CI/CD execution. Pipeline Triggers capture the external events and process them to extract key pieces of information. Mapping this event data to a set of predefined parameters triggers a series of tasks that can then create and deploy Kubernetes resources.

For example, you define a CI/CD workflow using OpenShift Pipelines for your application. The PipelineRun must start for any new changes to take effect in the application repository. Triggers automate this process by capturing and processing any change events and by triggering a PipelineRun that deploys the new image with the latest changes.

Triggers consist of the following main components that work together to form a reusable, decoupled, and self-sustaining CI/CD system:

  • EventListeners provide endpoints, or an event sink, that listen for incoming HTTP-based events with a JSON payload. The EventListener performs lightweight event processing on the payload using Event Interceptors, which identify the type of payload and optionally modify it. Currently, Pipeline Triggers support four types of Interceptors: Webhook Interceptors, GitHub Interceptors, GitLab Interceptors, and Common Expression Language (CEL) Interceptors.
  • TriggerBindings extract the fields from an event payload and store them as parameters.
  • TriggerTemplates specify how to use the parameterized data from the TriggerBindings. A TriggerTemplate defines a resource template that receives input from the TriggerBindings, and then performs a series of actions that result in creation of new PipelineResources and initiation of a new PipelineRun.

EventListeners tie the concepts of TriggerBindings and TriggerTemplates together. The EventListener listens for the incoming event, handles basic filtering using Interceptors, extracts data using TriggerBindings, and then processes this data to create Kubernetes resources using TriggerTemplates.

Here is a code snippet of the vote-app-binding TriggerBinding, which extracts the Git repository information from the received event payload:

apiVersion: triggers.tekton.dev/v1alpha1 1
kind: TriggerBinding 2
metadata:
  name: vote-app-binding 3
spec:
  params: 4
  - name: git-repo-url
    value: $(body.repository.url)
  - name: git-repo-name
    value: $(body.repository.name)
  - name: git-revision
    value: $(body.head_commit.id)
1
TriggerBinding API version v1alpha1.
2
Specifies the type of Kubernetes object. In this example, TriggerBinding.
3
Unique name to identify this TriggerBinding.
4
List of parameters which will be extracted from the received event payload and passed to the TriggerTemplate. In this example, the Git repository URL, name, and revision are extracted from the body of the event payload.

Here is a code snippet of a vote-app-template TriggerTemplate, which creates Pipeline Resources from the Git repository information received from the TriggerBinding:

apiVersion: triggers.tekton.dev/v1alpha1 1
kind: TriggerTemplate 2
metadata:
  name: vote-app-template 3
spec:
  params: 4
  - name: git-repo-url
    description: The git repository url
  - name: git-revision
    description: The git revision
    default: master
  - name: git-repo-name
    description: The name of the deployment to be created / patched
  resourcetemplates: 5
  - apiVersion: tekton.dev/v1alpha1
    kind: PipelineResource 6
    metadata:
      name: $(params.git-repo-name)-git-repo-$(uid)
    spec:
      type: git
      params:
      - name: revision
        value: $(params.git-revision)
      - name: url
        value: $(params.git-repo-url)
...
1
TriggerTemplate API version v1alpha1.
2
Specifies the type of Kubernetes object. In this example, TriggerTemplate.
3
Unique name to identify this TriggerTemplate.
4
Parameters supplied by the TriggerBinding or EventListerner.
5
List of Resource templates created for the Pipeline from the parameters received in the TriggerBinding or EventListener.
6
A Pipeline Resource of type git is created using the parameters git-repo-name, git-repo-url, and git-revision.

Here is an example of an EventListener which uses vote-app-binding TriggerBinding and vote-app-template TriggerTemplate to process incoming events.

apiVersion: triggers.tekton.dev/v1alpha1 1
kind: EventListener 2
metadata:
  name: vote-app 3
spec:
  serviceAccountName: pipeline 4
  triggers:
  - bindings: 5
    - name: vote-app-binding
    template: 6
      name: vote-app-template
1
EventListener API version v1alpha1.
2
Specifies the type of Kubernetes object. In this example, EventListener.
3
Unique name to identify this EventListener.
4
Service account name to be used.
5
Name of the TriggerBinding to be used for this EventListener.
6
Name of the Triggertemplate to be used for this Eventlistener.

Additional resources

Chapter 2. Installing OpenShift Pipelines

Prerequisites

  • You have access to an OpenShift Container Platform cluster using an account with cluster-admin permissions.
  • You have installed oc CLI.
  • You have installed OpenShift Pipelines (tkn) CLI on your local system.

2.1. Installing the OpenShift Pipelines Operator in web console

You can install OpenShift Pipelines using the Operator listed in the OpenShift Container Platform OperatorHub. When you install the OpenShift Pipelines Operator, the Custom Resources (CRs) required for the Pipelines configuration are automatically installed along with the Operator.

Procedure

  1. In the Administrator perspective of the web console, navigate to OperatorsOperatorHub.
  2. Use the Filter by keyword box to search for OpenShift Pipelines Operator in the catalog. Click the OpenShift Pipelines Operator tile.

    Note

    Ensure that you do not select the Community version of the OpenShift Pipelines Operator.

  3. Read the brief description about the Operator on the OpenShift Pipelines Operator page. Click Install.
  4. On the Create Operator Subscription page:

    1. Select All namespaces on the cluster (default) for the Installation Mode. This mode installs the Operator in the default openshift-operators namespace, which enables the Operator to watch and be made available to all namespaces in the cluster.
    2. Select Automatic for the Approval Strategy. This ensures that the future upgrades to the Operator are handled automatically by the Operator Lifecycle Manager (OLM). If you select the Manual approval strategy, OLM creates an update request. As a cluster administrator, you must then manually approve the OLM update request to update the Operator to the new version.
    3. Select an Update Channel.

      • The ocp-<4.x> channel enables installation of the latest stable release of the OpenShift Pipelines Operator.
      • The preview channel enables installation of the latest preview version of the OpenShift Pipelines Operator, which may contain features that are not yet available from the 4.x update channel.
  5. Click Subscribe. You will see the Operator listed on the Installed Operators page.

    Note

    The Operator is installed automatically into the openshift-operators namespace.

  6. Verify that the Status is set to Succeeded Up to date to confirm successful installation of OpenShift Pipelines Operator.

2.2. Installing the OpenShift Pipelines Operator using the CLI

You can install OpenShift Pipelines Operator from the OperatorHub using the CLI.

Procedure

  1. Create a Subscription object YAML file to subscribe a namespace to the OpenShift Pipelines Operator, for example, sub.yaml:

    Example Subscription

    apiVersion: operators.coreos.com/v1alpha1
    kind: Subscription
    metadata:
      name: openshift-pipelines-operator
      namespace: openshift-operators
    spec:
      channel:  <channel name> 1
      name: openshift-pipelines-operator-rh 2
      source: redhat-operators 3
      sourceNamespace: openshift-marketplace 4

    1
    Specify the channel name from where you want to subscribe the Operator
    2
    Name of the Operator to subscribe to.
    3
    Name of the CatalogSource that provides the Operator.
    4
    Namespace of the CatalogSource. Use openshift-marketplace for the default OperatorHub CatalogSources.
  2. Create the Subscription object:

    $ oc apply -f sub.yaml

    The OpenShift Pipelines Operator is now installed in the default target namespace openshift-operators.

Additional Resources

Chapter 3. Uninstalling OpenShift Pipelines

Uninstalling the OpenShift Pipelines Operator is a two-step process:

  1. Delete the Custom Resources (CRs) that were added by default when you installed the OpenShift Pipelines Operator.
  2. Uninstall the OpenShift Pipelines Operator.

Uninstalling only the Operator will not remove the OpenShift Pipelines components created by default when the Operator is installed.

3.1. Deleting the OpenShift Pipelines components and Custom Resources

Delete the Custom Resources (CRs) created by default during installation of the OpenShift Pipelines Operator.

Procedure

  1. In the Administrator perspective of the web console, navigate to AdministrationCustom Resource Definition.
  2. Type config.operator.tekton.dev in the Filter by name box to search for the OpenShift Pipelines Operator CRs.
  3. Click CRD Config to see the Custom Resource Definition Details page.
  4. Click the Actions drop-down menu and select Delete Custom Resource Definition.

    Note

    Deleting the CRs will delete the OpenShift Pipelines components, and all the Tasks and Pipelines on the cluster will be lost.

  5. Click Delete to confirm the deletion of the CRs.

3.2. Uninstalling the OpenShift Pipelines Operator

Procedure

  1. From the OperatorsOperatorHub page, use the Filter by keyword box to search for OpenShift Pipelines Operator.
  2. Click the OpenShift Pipelines Operator tile. The Operator tile indicates it is installed.
  3. In the OpenShift Pipelines Operator descriptor page, click Uninstall.

Additional Resources

Chapter 4. Creating CI/CD solutions for applications using OpenShift Pipelines

With OpenShift Pipelines, you can create a customized CI/CD solution to build, test, and deploy your application.

To create a full-fledged, self-serving CI/CD Pipeline for an application, you must perform the following tasks:

  • Create custom Tasks, or install existing reusable Tasks.
  • Create a Pipeline and PipelineResources to define the delivery Pipeline for your application.
  • Create a PipelineRun to instantiate and invoke the Pipeline.
  • Add Triggers to capture any events in the source repository.

This section uses the pipelines-tutorial example to demonstrate the preceding tasks. The example uses a simple application which consists of:

  • A front-end interface vote-ui, with the source code in ui-repo Git repository.
  • A back-end interface vote-api, with the source code in api-repo Git repository.
  • apply_manifest and update-deployment Tasks in pipelines-tutorial Git repository.

Prerequisites

  • You have access to an OpenShift Container Platform cluster.
  • You have installed OpenShift Pipelines using the OpenShift Pipelines Operator listed in the OpenShift OperatorHub. Once installed, it is applicable to the entire cluster.
  • You have installed OpenShift Pipelines CLI.
  • You have forked the front-end ui-repo and back-end api-repo Git repositories using your GitHub ID.
  • You have Administrator access to your repositories.

4.1. Creating a project and checking your Pipeline ServiceAccount

Procedure

  1. Log in to your OpenShift Container Platform cluster:

    $ oc login -u <login> -p <password> https://openshift.example.com:6443
  2. Create a project for the sample application. For this example workflow, create the pipelines-tutorial project:

    $ oc new-project pipelines-tutorial
    Note

    If you create a project with a different name, be sure to update the resource URLs used in the example with your project name.

  3. View the pipeline ServiceAccount:

    OpenShift Pipelines Operator adds and configures a ServiceAccount named pipeline that has sufficient permissions to build and push an image. This ServiceAccount is used by PipelineRun.

    $ oc get serviceaccount pipeline

4.2. Creating Pipeline Tasks

Procedure

  1. Install the apply-manifests and update-deployment Tasks from the pipelines-tutorial repository, which contains a list of reusable Tasks for Pipelines:

    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-1/01_pipeline/01_apply_manifest_task.yaml
    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-1/01_pipeline/02_update_deployment_task.yaml
  2. Use the tkn task list command to list the Tasks you created:

    $ tkn task list

    The output verifies that the apply-manifests and update-deployment Tasks were created:

    NAME                DESCRIPTION   AGE
    apply-manifests                   1 minute ago
    update-deployment                 48 seconds ago
  3. Use the tkn clustertasks list command to list the Operator-installed additional ClusterTasks, for example --buildah and s2i-python-3:

    Note

    You must use a privileged Pod container to run the buildah ClusterTask because it requires a privileged security context. To learn more about Security Context Constraints (SCC) for Pods, see the Additional resources section.

    $ tkn clustertasks list

    The output lists the Operator-installed ClusterTasks:

    NAME                       DESCRIPTION   AGE
    buildah                                  1 day ago
    buildah-v0-11-3                          1 day ago
    git-clone                                1 day ago
    jib-maven                                1 day ago
    kn                                       1 day ago
    maven                                    1 day ago
    openshift-client                         1 day ago
    openshift-client-v0-11-3                 1 day ago
    s2i                                      1 day ago
    s2i-dotnet-3                             1 day ago
    s2i-dotnet-3-v0-11-3                     1 day ago
    s2i-go                                   1 day ago
    s2i-go-v0-11-3                           1 day ago
    s2i-java-11                              1 day ago
    s2i-java-11-v0-11-3                      1 day ago
    s2i-java-8                               1 day ago
    s2i-java-8-v0-11-3                       1 day ago
    s2i-nodejs                               1 day ago
    s2i-nodejs-v0-11-3                       1 day ago
    s2i-perl                                 1 day ago
    s2i-perl-v0-11-3                         1 day ago
    s2i-php                                  1 day ago
    s2i-php-v0-11-3                          1 day ago
    s2i-python-3                             1 day ago
    s2i-python-3-v0-11-3                     1 day ago
    s2i-ruby                                 1 day ago
    s2i-ruby-v0-11-3                         1 day ago
    s2i-v0-11-3                              1 day ago
    tkn                                      1 day ago

4.3. Defining and creating PipelineResources

PipelineResources are artifacts that are used as inputs or outputs of a Task.

After you create Tasks, create PipelineResources that contain the specifics of the Git repository and the image registry to be used in the Pipeline during execution:

Note

If you are not in the pipelines-tutorial namespace, and are using another namespace, ensure you update the front-end and back-end image resource to the correct URL with your namespace in the steps below. For example:

image-registry.openshift-image-registry.svc:5000/<namespace-name>/vote-api:latest

Procedure

  1. Create a PipelineResource that defines the Git repository for the front-end application:

    $ tkn resource create
    ? Enter a name for a pipeline resource : ui-repo
    ? Select a resource type to create : git
    ? Enter a value for url : http://github.com/openshift-pipelines/vote-ui.git
    ? Enter a value for revision : release-tech-preview-1

    The output verifies that the ui-repo PipelineResource was created.

    New git resource "ui-repo" has been created
  2. Create a PipelineResource that defines the OpenShift Container Platform internal image registry to where you want to push the front-end image:

    $ tkn resource create
    ? Enter a name for a pipeline resource : ui-image
    ? Select a resource type to create : image
    ? Enter a value for url : image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/ui:latest
    ? Enter a value for digest :

    The output verifies that the ui-image PipelineResource was created.

    New image resource "ui-image" has been created
  3. Create a PipelineResource that defines the Git repository for the back-end application:

    $ tkn resource create
    ? Enter a name for a pipeline resource : api-repo
    ? Select a resource type to create : git
    ? Enter a value for url : http://github.com/openshift-pipelines/vote-api.git
    ? Enter a value for revision : release-tech-preview-1

    The output verifies that the api-repo PipelineResource was created.

    New git resource "api-repo" has been created
  4. Create a PipelineResource that defines the OpenShift Container Platform internal image registry to where you want to push the back-end image:

    $ tkn resource create
    ? Enter a name for a pipeline resource : api-image
    ? Select a resource type to create : image
    ? Enter a value for url : image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/api:latest
    ? Enter a value for digest :

    The output verifies that the api-image PipelineResource was created.

    New image resource "api-image" has been created
  5. View the list of resources created:

    $ tkn resource list

    The output lists all the PipelineResource that were created.

    NAME        TYPE    DETAILS
    api-repo    git     url: http://github.com/openshift-pipelines/vote-api.git
    ui-repo     git     url: http://github.com/openshift-pipelines/vote-ui.git
    api-image   image   url: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/api:latest
    ui-image    image   url: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/ui:latest

4.4. Assembling a Pipeline

A Pipeline represents a CI/CD flow and is defined by the Tasks to be executed. It specifies how the Tasks interact with each other and their order of execution using the inputs , outputs, and runAfter parameters. It is designed to be generic and reusable in multiple applications and environments.

In this section, you will create a Pipeline that takes the source code of the application from GitHub and then builds and deploys it on OpenShift Container Platform.

The Pipeline performs the following tasks for the back-end application vote-api and front-end application vote-ui:

  • Clones the source code of the application from the Git repositories api-repo and ui-repo.
  • Builds the container images api-image and ui-image using the buildah ClusterTask.
  • Pushes the api-image and ui-image images to the internal image registry.
  • Deploys the new images on OpenShift Container Platform using the apply-manifests and update-deployment Tasks.

Procedure

  1. Copy the contents of the following sample Pipeline YAML file and save it:

    apiVersion: tekton.dev/v1beta1
    kind: Pipeline
    metadata:
      name: build-and-deploy
    spec:
      resources:
      - name: git-repo
        type: git
      - name: image
        type: image
      params:
      - name: deployment-name
        type: string
        description: name of the deployment to be patched
      tasks:
      - name: build-image
        taskRef:
          name: buildah
          kind: ClusterTask
        resources:
          inputs:
          - name: source
            resource: git-repo
          outputs:
          - name: image
            resource: image
        params:
        - name: TLSVERIFY
          value: "false"
      - name: apply-manifests
        taskRef:
          name: apply-manifests
        resources:
          inputs:
          - name: source
            resource: git-repo
        runAfter:
        - build-image
      - name: update-deployment
        taskRef:
          name: update-deployment
        resources:
          inputs:
          - name: image
            resource: image
        params:
        - name: deployment
          value: $(params.deployment-name)
        runAfter:
        - apply-manifests

    Notice that the Pipeline definition abstracts away the specifics of the Git source repository and image registries to be used during the Pipeline execution.

  2. Create the Pipeline:

    $ oc create -f <pipeline-yaml-file-name.yaml>

    Alternatively, you can also execute the YAML file directly from the Git repository:

    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-1/01_pipeline/04_pipeline.yaml
  3. Use the tkn pipeline list command to verify that the Pipeline is added to the application:

    $ tkn pipeline list

    The output verifies that the build-and-deploy Pipeline was created:

    NAME               AGE            LAST RUN   STARTED   DURATION   STATUS
    build-and-deploy   1 minute ago   ---        ---       ---        ---

4.5. Running a Pipeline

A PipelineRun starts a Pipeline and ties it to the Git and image resources that should be used for the specific invocation. It automatically creates and starts the TaskRuns for each Task in the Pipeline.

Procedure

  1. Start the Pipeline for the back-end application:

    $ tkn pipeline start build-and-deploy -r git-repo=api-repo -r image=api-image -p deployment-name=vote-api

    Note the PipelineRun ID returned in the command output.

  2. Track the PipelineRun progress:

    $ tkn pipelinerun logs <pipelinerun ID> -f
  3. Start the Pipeline for the front-end application:

    $ tkn pipeline start build-and-deploy -r git-repo=ui-repo -r image=ui-image -p deployment-name=vote-ui

    Note the PipelineRun ID returned in the command output.

  4. Track the PipelineRun progress:

    $ tkn pipelinerun logs <pipelinerun ID> -f
  5. After a few minutes, use tkn pipelinerun list command to verify that the Pipeline ran successfully by listing all the PipelineRuns:

    $ tkn pipelinerun list

    The output lists the PipelineRuns:

     NAME                         STARTED      DURATION     STATUS
     build-and-deploy-run-xy7rw   1 hour ago   2 minutes    Succeeded
     build-and-deploy-run-z2rz8   1 hour ago   19 minutes   Succeeded
  6. Get the application route:

    $ oc get route vote-ui --template='http://{{.spec.host}}'

    Note the output of the previous command. You can access the application using this route.

  7. To rerun the last PipelineRun, using the PipelineResources and ServiceAccount of the previous Pipeline, run:

    $ tkn pipeline start build-and-deploy --last

4.6. Adding Triggers to a Pipeline

After you have assembled and started the Pipeline for the application, add TriggerBindings, TriggerTemplates, and an EventListener to capture GitHub events.

Procedure

  1. Copy the content of the following sample TriggerBinding YAML file and save it:

    apiVersion: triggers.tekton.dev/v1alpha1
    kind: TriggerBinding
    metadata:
      name: vote-app
    spec:
      params:
      - name: git-repo-url
        value: $(body.repository.url)
      - name: git-repo-name
        value: $(body.repository.name)
      - name: git-revision
        value: $(body.head_commit.id)
  2. Create the TriggerBinding:

    $ oc create -f <triggerbinding-yaml-file-name.yaml>

    Alternatively, you can create the TriggerBinding directly from the pipelines-tutorial Git repository:

    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-1/03_triggers/01_binding.yaml
  3. Copy the content of the following sample TriggerTemplate YAML file and save it:

    apiVersion: triggers.tekton.dev/v1alpha1
    kind: TriggerTemplate
    metadata:
      name: vote-app
    spec:
      params:
      - name: git-repo-url
        description: The git repository url
      - name: git-revision
        description: The git revision
        default: master
      - name: git-repo-name
        description: The name of the deployment to be created / patched
    
      resourcetemplates:
      - apiVersion: tekton.dev/v1alpha1
        kind: PipelineResource
        metadata:
          name: $(params.git-repo-name)-git-repo-$(uid)
        spec:
          type: git
          params:
          - name: revision
            value: $(params.git-revision)
          - name: url
            value: $(params.git-repo-url)
    
      - apiVersion: tekton.dev/v1alpha1
        kind: PipelineResource
        metadata:
          name: $(params.git-repo-name)-image-$(uid)
        spec:
          type: image
          params:
          - name: url
            value: image-registry.openshift-image-registry.svc:5000/pipelines-tutorial/$(params.git-repo-name):latest
    
      - apiVersion: tekton.dev/v1beta1
        kind: PipelineRun
        metadata:
          name: build-deploy-$(params.git-repo-name)-$(uid)
        spec:
          serviceAccountName: pipeline
          pipelineRef:
            name: build-and-deploy
          resources:
          - name: git-repo
            resourceRef:
              name: $(params.git-repo-name)-git-repo-$(uid)
          - name: image
            resourceRef:
              name: $(params.git-repo-name)-image-$(uid)
          params:
          - name: deployment-name
            value: $(params.git-repo-name)
  4. Create the TriggerTemplate:

    $ oc create -f <triggertemplate-yaml-file-name.yaml>

    Alternatively, you can create the TriggerTemplate directly from the pipelines-tutorial Git repository:

    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-1/03_triggers/02_template.yaml
  5. Copy the contents of the following sample EventListener YAML file and save it:

    apiVersion: triggers.tekton.dev/v1alpha1
    kind: EventListener
    metadata:
      name: vote-app
    spec:
      serviceAccountName: pipeline
      triggers:
      - bindings:
        - name: vote-app
        template:
          name: vote-app
  6. Create the EventListener:

    $ oc create -f <eventlistener-yaml-file-name.yaml>

    Alternatively, you can create the EvenListener directly from the pipelines-tutorial Git repository:

    $ oc create -f https://raw.githubusercontent.com/openshift/pipelines-tutorial/release-tech-preview-1/03_triggers/03_event_listener.yaml
  7. Expose the EventListener service as an OpenShift Container Platform route to make it publicly accessible:

    $ oc expose svc el-vote-app

4.7. Creating Webhooks

Webhooks are HTTP POST messages that are received by the EventListeners whenever a configured event occurs in your repository. The event payload is then mapped to TriggerBindings, and processed by TriggerTemplates. The TriggerTemplates eventually start one or more PipelineRuns, leading to the creation and deployment of Kubernetes resources.

In this section, you will configure a Webhook URL on your forked Git repositories vote-ui and vote-api. This URL points to the publicly accessible EventListener service route.

Note

Adding Webhooks requires administrative privileges to the repository. If you do not have administrative access to your repository, contact your system administrator for adding Webhooks.

Procedure

  1. Get the Webhook URL:

    $ echo "URL: $(oc  get route el-vote-app --template='http://{{.spec.host}}')"

    Note the URL obtained in the output.

  2. Configure Webhooks manually on the front-end repository:

    1. Open the front-end Git repository vote-ui in your browser.
    2. Click SettingsWebhooksAdd Webhook
    3. On the Webhooks/Add Webhook page:

      1. Enter the Webhook URL from step 1 in Payload URL field
      2. Select application/json for the Content type
      3. Specify the secret in the Secret field
      4. Ensure that the Just the push event is selected
      5. Select Active
      6. Click Add Webhook
  3. Repeat step 2 for the back-end repository vote-api.

4.8. Triggering a PipelineRun

Whenever a push event occurs in the Git repository, the configured Webhook sends an event payload to the publicly exposed EventListener service route. The EventListener service of the application processes the payload, and passes it to the relevant TriggerBindings and TriggerTemplates pair. The TriggerBinding extracts the parameters and the TriggerTemplate uses these parameters to create resources. This may rebuild and redeploy the application.

In this section, you will push an empty commit to the front-end vote-api repository, which will trigger the PipelineRun.

Procedure

  1. From the terminal, clone your forked Git repository vote-api:

    $ git clone git@github.com:<your GitHub ID>/vote-api.git -b release-tech-preview-1
  2. Push an empty commit:

    $ git commit -m "empty-commit" --allow-empty && git push origin release-tech-preview-1
  3. Check if the PipelineRun was triggered:

    $ tkn pipelinerun list

    Notice that a new PipelineRun was initiated.

Additional resources

Chapter 5. Working with OpenShift Pipelines using the Developer perspective

You can use the Developer perspective of the OpenShift Container Platform web console to create CI/CD Pipelines for your software delivery process.

In the Developer perspective:

  • Use the AddPipelinePipeline Builder option to create customized Pipelines for your application.
  • Use the AddFrom Git option to create Pipelines using operator-installed Pipeline templates and resources while creating an application on OpenShift Container Platform.

After you create the Pipelines for your application, you can view and visually interact with the deployed Pipelines in the Pipelines view. You can also use the Topology view to interact with the Pipelines created using the From Git option. You need to apply custom labels to a Pipeline created using the Pipeline Builder to see it in the Topology view.

Prerequisites

  • You have access to an OpenShift Container Platform cluster and have switched to the Developer perspective in the web console.
  • You have the OpenShift Pipelines Operator installed in your cluster.
  • You are a cluster administrator or a user with create and edit permissions.
  • You have created a project.

5.1. Constructing Pipelines using the Pipeline Builder

In the Developer perspective of the console, you can use the AddPipelinePipeline Builder option to:

  • Construct a Pipeline flow using existing Tasks and ClusterTasks. When you install the OpenShift Pipelines Operator, it adds reusable Pipeline ClusterTasks to your cluster.
  • Specify the type of resources required for the Pipeline Run, and if required, add additional parameters to the Pipeline.
  • Reference these Pipeline resources in each of the Tasks in the Pipeline as input and output resources.
  • The parameters for a Task are prepopulated based on the specifications of the Task. If required, reference any additional parameters added to the Pipeline in the Task.

Procedure

  1. In the Add view of the Developer perspective, click the Pipeline tile to see the Pipeline Builder page.
  2. Enter a unique name for the Pipeline.
  3. Select a Task from the Select task list to add a Task to the Pipeline. This example uses the s2i-nodejs Task.

    1. To add sequential Tasks to the Pipeline, click the plus icon to the right or left of the Task, and from the Select task list, select the Task you want to add to the Pipeline. For this example, use the plus icon to the right of the s2i-nodejs Task to add an openshift-client Task.
    2. To add a parallel Task to the existing Task, click the plus icon displayed below the Task, and from the Select Task list, select the parallel Task you want to add to the Pipeline.

      Figure 5.1. Pipeline Builder

      op pipeline builder
  4. Click Add Resources to specify the name and type of resources that the Pipeline Run will use. These resources are then used by the Tasks in the Pipeline as inputs and outputs. For this example:

    1. Add an input resource. In the Name field, enter Source, and from the Resource Type drop-down list, select Git.
    2. Add an output resource. In the Name field, enter Img, and from the Resource Type drop-down list, select Image.
  5. The Parameters for a Task are prepopulated based on the specifications of the Task. If required, use the Add Parameters link to add additional parameters.
  6. A Missing Resources warning is displayed on a Task if the resources for the Task are not specified. Click the s2i-nodejs Task to see the side panel with details for the Task.

    Figure 5.2. Tasks details in Pipelines Builder

    op pipeline builder task details
  7. In the Task side panel, specify the resources and parameters for it:

    1. In the Input ResourcesSource section, the Select Resources drop-down list displays the resources that you added to the Pipeline. For this example, select Source.
    2. In the Output ResourcesImage section, click the Select Resources list, and select Img.
    3. If required, in the Parameters section, add more parameters to the default ones, by using the $(params.<param-name>) syntax.
  8. Similarly, add an input resource for the openshift-client Task.
  9. Click Create to create the Pipeline. You are redirected to the Pipeline Details page that displays the details of the created Pipeline. You can now use the Action button to start the Pipeline.

Optionally, you can also use the Edit YAML link, on the upper right of the Pipeline Builder page, to directly modify a Pipeline YAML file in the console. You can also use the operator-installed, reusable snippets and samples to create detailed Pipelines.

5.2. Creating applications with OpenShift Pipelines

To create Pipelines along with applications, use the From Git option in the Add view of the Developer perspective. For more information, see Creating applications using the Developer perspective.

5.3. Interacting with Pipelines using the Developer perspective

The Pipelines view in the Developer perspective lists all the Pipelines in a project along with details, such as the namespace in which the Pipeline was created, the last PipelineRun, the status of the Tasks in the PipelineRun, the status of the PipelineRun, and the time taken for the run.

Procedure

  1. In the Pipelines view of the Developer perspective, select a project from the Project drop-down list to see the Pipelines in that project.

    Figure 5.3. Pipelines view in the Developer perspective

    op pipeline list
  2. Click the required Pipeline to see the Pipeline Details page. This page provides a visual representation of all the serial and parallel Tasks in the Pipeline. The Tasks are also listed at the lower right of the page. You can click the listed Tasks to view Task details.
  3. Optionally, in the Pipeline Details page:

    • Click the YAML tab to edit the YAML file for the Pipeline.
    • Click the Pipeline Runs tab to see the completed, running, or failed runs for the Pipeline. You can use the Options menu kebab to stop a running Pipeline, to rerun a Pipeline using the same parameters and resources as that of the previous Pipeline execution, or to delete a PipelineRun.
    • Click the Parameters tab to see the parameters defined in the Pipeline. You can also add or edit additional parameters as required.
    • Click the Resources tab to see the resources defined in the Pipeline. You can also add or edit additional resources as required.

5.4. Starting Pipelines

After you create a Pipeline, you need to start it to execute the included Tasks in the defined sequence. You can start a Pipeline Run from the Pipelines view, Pipeline Details page, or the Topology view.

Procedure

To start a Pipeline using the Pipelines view:

  1. In the Pipelines view of the Developer perspective, click the Options kebab menu adjoining a Pipeline, and select Start.
  2. The Start Pipeline dialog box displays the Git Resources and the Image Resources based on the Pipeline definition.

    Note

    For Pipelines created using the From Git option, the Start Pipeline dialog box also displays an APP_NAME field in the Parameters section, and all the fields in the dialog box are prepopulated by the Pipeline templates.

    1. If you have resources in your namespace, the Git Resources and the Image Resources fields are prepopulated with those resources. If required, use the drop-downs to select or create the required resources and customize the Pipeline Run instance.
  3. Optional: Modify the Advanced Options to add credentials to authenticate the specified private Git server or Docker registry.

    1. Under Advanced Options, click Show Credentials Options and select Add Secret.
    2. In the Create Source Secret section, specify the following:

      1. A unique Secret Name for the secret.
      2. In the Designated provider to be authenticated section, specify the provider to be authenticated in the Access to field, and the base Server URL.
      3. Select the Authentication Type and provide the credentials:

        • For the Authentication Type Image Registry Crendentials, specify the Registry Server Address that you want to authenticate, and provide your credentials in the Username, Password, and Email fields.

          Select Add Credentials if you want to specify an additional Registry Server Address.

        • For the Authentication Type Basic Authentication, specify the values for the UserName and Password or Token fields.
        • For the Authentication Type SSH Keys, specify the value for the SSH Private Key field.
      4. Select the check mark to add the secret.

    You can add multiple secrets based upon the number of resources in your Pipeline.

  4. Click Start to start the PipelineRun.
  5. The Pipeline Run Details page displays the Pipeline being executed. After the Pipeline starts, the Tasks and Steps within each Task are executed. You can:

    • Hover over the Tasks to see the time taken for the execution of each Step.
    • Click on a Task to see logs for each of the Steps in the Task.
    • Click the Logs tab to see the logs according to the execution sequence of the Tasks and use the Download button to download the logs to a text file.

      Figure 5.4. Pipeline run

      op pipeline run
  6. For Pipelines created using the From Git option, you can use the Topology view to interact with Pipelines after you start them:

    Note

    To see Pipelines created using the Pipeline Builder in the Topology view, customize the Pipeline labels to link the Pipeline with the application workload.

    1. On the left navigation panel, click Topology, and click on the application to see the Pipeline Runs listed in the side panel.
    2. In the Pipeline Runs section, click Start Last Run to start a new Pipeline Run with the same parameters and resources as the previous ones. This option is disabled if a Pipeline Run has not been initiated.

      Figure 5.5. Pipelines on the Topology view

      op pipeline topology
    3. In the Topology page, hover to the left of the application to see the status of the Pipeline Run for the application.

5.5. Editing Pipelines

You can edit the Pipelines in your cluster using the Developer perspective of the web console:

Procedure

  1. In the Pipelines view of the Developer perspective, select the Pipeline you want to edit to see the details of the Pipeline. In the Pipeline Details page, click Actions and select Edit Pipeline.
  2. In the Pipeline Builder page:

    • You can add additional Tasks, parameters, or resources to the Pipeline.
    • You can click the Task you want to modify to see the Task details in the side panel and modify the required Task details, such as the display name, parameters and resources.
    • Alternatively, to delete the Task, click the Task, and in the side panel, click Actions and select Remove Task.
  3. Click Save to save the modified Pipeline.

5.6. Deleting Pipelines

You can delete the Pipelines in your cluster using the Developer perspective of the web console.

Procedure

  1. In the Pipelines view of the Developer perspective, click the Options kebab menu adjoining a Pipeline, and select Delete Pipeline.
  2. In the Delete Pipeline confirmation prompt, click Delete to confirm the deletion.

Chapter 6. OpenShift Pipelines release notes

OpenShift Pipelines is a cloud-native CI/CD experience based on the Tekton project which provides:

  • Standard Kubernetes-native pipeline definitions (CRDs).
  • Serverless pipelines with no CI server management overhead.
  • Extensibility to build images using any Kubernetes tool, such as S2I, Buildah, JIB, and Kaniko.
  • Portability across any Kubernetes distribution.
  • Powerful CLI for interacting with pipelines.
  • Integrated user experience with the Developer perspective of the OpenShift Container Platform web console.

For an overview of OpenShift Pipelines, see Understanding OpenShift Pipelines.

6.1. Getting support

If you experience difficulty with a procedure described in this documentation, visit the Red Hat Customer Portal to learn more about Red Hat Technology Preview features support scope.

For questions and feedback, you can send an email to the product team at pipelines-interest@redhat.com.

6.2. Release notes for Red Hat OpenShift Pipelines Technology Preview 1.0

6.2.1. New features

OpenShift Pipelines Technology Preview (TP) 1.0 is now available on OpenShift Container Platform 4.5. OpenShift Pipelines TP 1.0 is updated to support:

  • Tekton Pipelines 0.11.3
  • Tekton tkn CLI 0.9.0
  • Tekton Triggers 0.4.0
  • ClusterTasks based on Tekton Catalog 0.11

In addition to the fixes and stability improvements, here is a highlight of what’s new in OpenShift Pipelines 1.0.

6.2.1.1. Pipelines

  • Support for v1beta1 API Version.
  • Support for an improved LimitRange. Previously, LimitRange was specified exclusively for the TaskRun and the PipelineRun. Now there is no need to explicitly specify the LimitRange. The minimum LimitRange across the namespace is used.
  • Support for sharing data between Tasks using TaskResults and TaskParams.
  • Pipelines can now be configured to not overwrite the HOME environment variable and workingDir of Steps.
  • Similar to Task Steps, sidecars now support script mode.
  • You can now specify a different scheduler name in TaskRun podTemplate.
  • Support for variable substitution using Star Array Notation.
  • Tekton Controller can now be configured to monitor an individual namespace.
  • A new description field is now added to the specification of Pipeline, Task, ClusterTask, Resource, and Condition.
  • Addition of proxy parameters to Git PipelineResources.

6.2.1.2. Pipelines CLI

  • The describe subcommand is now added for the following tkn resources: eventlistener, condition, triggertemplate, clustertask, and triggerbinding.
  • Support added for v1beta1 to the following commands along with backward comptibility for v1alpha1: clustertask, task, pipeline, pipelinerun, and taskrun.
  • The following commands can now list output from all namespaces using the --all-namespaces flag option:

    • tkn task list
    • tkn pipeline list
    • tkn taskrun list
    • tkn pipelinerun list

      The output of these commands is also enhanced to display information without headers using the --no-headers flag option.

  • You can now start a Pipeline using default parameter values by specifying --use-param-defaults flag in the tkn pipelines start command.
  • Support for Workspace is now added to tkn pipeline start and tkn task start commands.
  • A new clustertriggerbinding command is now added with the following subcommands: describe, delete, and list.
  • You can now directly start a pipeline run using a local or remote yaml file.
  • The describe subcommand now displays an enhanced and detailed output. With the addition of new fields, such as description, timeout, param description, and sidecar status, the command output now provides more detailed information about a specific tkn resource.
  • The tkn task log command now displays logs directly if only one task is present in the namespace.

6.2.1.3. Triggers

  • Triggers can now create both v1alpha1 and v1beta1 Pipeline resources.
  • Support for new Common Expression Language (CEL) interceptor function - compareSecret. This function securely compares strings to secrets in CEL expressions.
  • Support for authentication and authorization at the EventListener Trigger level.

6.2.2. Deprecated features

The following items are deprecated in this release:

  • The environment variable $HOME, and variable workingDir in the Steps specification are deprecated and might be changed in a future release. Currently in a Step container, HOME and workingDir are overwritten to /tekton/home and /workspace respectively.

    In a later release, these two fields will not be modified, and will be set to values defined in the container image and Task YAML. For this release, use flags disable-home-env-overwrite and disable-working-directory-overwrite to disable overwriting of the HOME and workingDir variables.

  • The following commands are deprecated and might be removed in the future release:

    • tkn pipeline create
    • tkn task create
  • The -f flag with the tkn resource create command is now deprecated. It might be removed in the future release.
  • The -t flag and the --timeout flag (with seconds format) for the tkn clustertask create command are now deprecated. Only duration timeout format is now supported, for example 1h30s. These deprecated flags might be removed in the future release.

6.2.3. Known issues

  • If you are upgrading from an older version of OpenShift Pipelines, you must delete your existing deployments before upgrading to OpenShift Pipelines version 1.0. To delete an existing deployment, you must first delete Custom Resources and then uninstall the OpenShift Pipelines Operator. For more details, see the uninstalling OpenShift Pipelines section.
  • Submitting the same v1alpha1 Tasks more than once results in an error. Use oc replace instead of oc apply when re-submitting a v1alpha1 Task.
  • The buildah ClusterTask does not work when a new user is added to a container.

    When the Operator is installed, the --storage-driver flag for the buildah ClusterTask is not specified, therefore the flag is set to its default value. In some cases, this causes the storage driver to be set incorrectly. When a new user is added, the incorrect storage-driver results in the failure of the buildah ClusterTask with the following error:

    useradd: /etc/passwd.8: lock file already used
    useradd: cannot lock /etc/passwd; try again later.

    As a workaround, manually set the --storage-driver flag value to overlay in the buildah-task.yaml file:

    1. Login to your cluster as a cluster-admin:

      $ oc login -u <login> -p <password> https://openshift.example.com:6443
    2. Use the oc edit command to edit buildah ClusterTask:

      $ oc edit clustertask buildah

      The current version of the buildah clustertask YAML file opens in the editor set by your EDITOR environment variable.

    3. Under the steps field, locate the following command field:

       command: ['buildah', 'bud', '--format=$(params.FORMAT)', '--tls-verify=$(params.TLSVERIFY)', '--layers', '-f', '$(params.DOCKERFILE)', '-t', '$(resources.outputs.image.url)', '$(params.CONTEXT)']
    4. Replace the command field with the following:

       command: ['buildah', '--storage-driver=overlay', 'bud', '--format=$(params.FORMAT)', '--tls-verify=$(params.TLSVERIFY)', '--no-cache', '-f', '$(params.DOCKERFILE)', '-t', '$(params.IMAGE)', '$(params.CONTEXT)']
    5. Save the file and exit.

    Alternatively, you can also modify the buildah ClusterTask YAML file directly on the web console by navigating to PipelinesCluster Tasksbuildah. Select Edit Cluster Task from the Actions menu and replace the command field as shown in the previous procedure.

6.2.4. Fixed issues

  • Previously, the DeploymentConfig Task triggered a new deployment build even when an image build was already in progress. This caused the deployment of the Pipeline to fail. With this fix, the deploy task command is now replaced with the oc rollout status command which waits for the in-progress deployment to finish.
  • Support for APP_NAME parameter is now added in Pipeline templates.
  • Previously, the Pipeline template for Java S2I failed to look up the image in the registry. With this fix, the image is looked up using the existing image PipelineResources instead of the user provided IMAGE_NAME parameter.
  • All the Openshift Pipelines images are now based on the Red Hat Universal Base Images (UBI).
  • Previously, when the Pipeline was installed in a namespace other than tekton-pipelines, the tkn version command displayed the Pipeline version as unknown. With this fix, the tkn version command now displays the correct Pipeline version in any namespace.
  • The -c flag is no longer supported for the tkn version command.
  • Non-admin users can now list the ClusterTriggerBindings.
  • The EventListener CompareSecret function is now fixed for the CEL Interceptor.
  • The list, describe, and start subcommands for task and clustertask now correctly display the output in case a Task and ClusterTask have the same name.
  • Previously, the OpenShift Pipelines Operator modified the privileged Security Context Constraints (SCCs), which caused an error during cluster upgrade. This error is now fixed.
  • In the tekton-pipelines namespace, the timeouts of all TaskRuns and PipelineRuns are now set to the value of default-timeout-minutes field using the ConfigMap.
  • Previously, the Pipelines section in the web console was not displayed for non-admin users. This issue is now resolved.

Legal Notice

Copyright © 2020 Red Hat, Inc.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution–Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, the Red Hat logo, JBoss, OpenShift, Fedora, the Infinity logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
Node.js® is an official trademark of Joyent. Red Hat is not formally related to or endorsed by the official Joyent Node.js open source or commercial project.
The OpenStack® Word Mark and OpenStack logo are either registered trademarks/service marks or trademarks/service marks of the OpenStack Foundation, in the United States and other countries and are used with the OpenStack Foundation's permission. We are not affiliated with, endorsed or sponsored by the OpenStack Foundation, or the OpenStack community.
All other trademarks are the property of their respective owners.