OpenShift pipelines is a solution to build cloud native CICD pipelines on Kubernetes. OpenShift Piplines is the OpenShift fork of Continuous Delivery Foundation project TektonCD-Pipelines.
If you would like a quick refresher on OpenShift Pipelines (Tekton Pipelins), please watch my talk from KubeCon Shanghai 2019.
For this article I will be using an OpenShift 4.x cluster running on AWS created using openshift-installer. If you want to follow along you can use any OpenShift 4.x cluster (CRC, on AWS, or anyother OpenShift 4 Cluster).
Install OpenShift Pipelines
The most effective way to install and setup OpenShift-Pipelines on OpenShift is using the OpenShift-Pipelines-Operator. The operator is available from the OperatorHub present on OpenShift 4.x Clusters. Click on Operators>OperatorHub from the side menu. Scroll down (or search for pipelines) to locate the tile OpenShift-Pipelines-Operator.
Click ‘install’ button.
In operator world we subscribe to an operator through a subscription channel. In the next screen you will see two options for channel selection:
- dev-preview: latest stable release (v0.8.1 at the time of writing)
- canary: next release candidate (v0.8.1 at the time writing, 0.9.0 will be available soon)
Select the dev-preview channel. Then, click subscribe.
The installation and life-cycle management of operators on an OpenShift cluster is done by Operator-Lifecycle-Manager (OLM). Once we click the subscribe button, OLM will setup the operator on you cluster with necessary permissions (RBAC). It will also create OpenShift Resources specified by the operator author in the subscription package. On the next screen (Operators>Installed Operators ) select Namespace ‘openshift-operators’. Wait till the ‘Status’ for Openshift-Pipelines-Operator is ‘InstallSucceeded’.
Click the name ‘OpenShift Pipelines Operator’ to go to view more information.
Click ‘Openshift PipelinesConfig’ tab.
Wait till an instance of ‘OpenShift Pipelines Config’ with name ‘cluster’ appears on the list. The appearance of ‘cluster’ instance indicates that the subscription to the operator channel is successful and the operator has started setting up its payload Openshift-Pipelines.
Confirming OpenShift Pipelines is Ready for our CICD Pipelines
There are ways to ensure that the payload OpenShift Pipelines has been installed correctly by OpenShift Pipelines Operator. Verify either one of the 2 checks given below to ensure that the operator has installed the payload Openshift-Pipelines, a set of default Taks, and Tekton Triggers successfully.
#1 Check Status of the ‘cluster’ Instance
This option will work only in OpenShift Versions 4.3 and above (due to a UI bug).
Click the listing ‘cluster’ seen on the above image. (If you get a 404 screen on OpenShift 4.2, go to #2)
This screen gives us little information at present. More information will be added to this initial screen in future releases. Click YAML tab to see the current status of OpenShift-Pipelines. Wait until (press reload button) until the condition ‘code: installed’ appears. (OpenShift Pipelines Version is v0.8.0 and OpenShift Pipelines Operator Version is v0.8.1)
#2 Check Status of the ‘cluster’ instance from Terminal
Login to you cluster as ClusterAdmin and fetch the ‘cluster ‘ instance.
$ oc get config.operator.tekton.dev clusterNAME STATUS
Ensure the STATUS is ‘installed’.
- Install Tekton Pipelines Command Line Client ‘tkn’
I highly recommend installing the Tekton CLI tkn. You can work with Tekton Tasks, Pipelines, PipelineRuns etc using ‘kubectl’ or ‘oc’. However, ‘tkn’ offers you an elegant customized CLI experience. tkn is aware of the semantics and life-cycle of Tekton Components. It provides context sensitive shell completion, well formatted logs and direct sub-commands to common OpenShift-Pipelines (Tekton) use cases.
You can find instructions to download and install tkn here.
2. Learn more about OpenShift Pipelines (Tekton Pipelines)