Define a Tekton-Enabled YAML Template and Use it to Create and Config a Tekton Pipeline

1 min read

Step-by-step instructions on how to define a Tekton-enabled template and use it to create and pre-config a Tekton Pipeline.

Tekton Pipelines is an open source project (born out of Knative Build) that you can use to configure and run continuous integration/continuous delivery (CI/CD) pipelines within a Kubernetes cluster. 

Tekton Pipelines are cloud native and run on Kubernetes using custom resource definitions specialized for executing CI/CD workflows, and they can be created and configured by using a YAML template. 

This post will show you how to define a Tekton-enabled YAML template and use it to automatically create and pre-config a Tekton Pipeline.

Defining a Tekton-enabled template

The Tekton Pipeline needs to define a private worker, git inputs , triggers, and essential properties, and these specifications can be defined into a single YAML document. 

The following is a tekton.yaml example:

private_worker: ${PRIVATE_WORKER}
- type: git
  branch: master
  service: ${SAMPLE_REPO}
- type: git
  name: Trigger
  service: ${SAMPLE_REPO}
  branch: master
  events: {"push":true,"pull_request":true,"pull_request_closed":false}
  eventListener: listener
  value: .
  type: text
  value: Dockerfile
  type: text 
  value: 123456
  type: SECURE

The above YAML contains the references to environment variables (enclosed with `${}`) that are defined as a part of configuration in the Pipeline service definition of toolchain.yaml. 

For more detailed information, see "Tekton Pipeline YAML Format."

Using the template to create and config a Tekton pipeline

  1. After you have followed the instructions above and the template is ready, you can go to IBM Cloud to create a toolchain page and redirect to your template link. Here is a public example template
  2. Paste the API Key for the pipeline and the Service-id API Key for the private worker (if the private work needs to be set).
  3. You can then can click the Create button and a configured Tekton pipeline will be ready to use.

The Tekton-enabled template allows you to automatically configure a Tekton pipeline, and it is great for helping groups of people get new projects up and running quickly with a known set of well-integrated tools.

Contact us

Now you can try it out yourself. For more information, see our documentation. If you have questions, engage our team via Slack by registering here and join the discussion in the #ask-your-question channel on our public Cloud DevOps @ IBM Slack.

We’d love to hear your feedback.

Learn more about Tekton by reading "Build and Deliver Using Tekton-Enabled Pipelines" and watching our video, "What is Tekton?":

Be the first to hear about news, product updates, and innovation from IBM Cloud