Tekton

Tekton workflow example

This workflow demonstrates creating Tekton resources in a Kubernetes cluster.

We create the following Kubernetes resources (in order as they appear):

  • a namespace called tekton-example

  • 2 Tasks, task-1 and task-2, that echo the message:

     Hi I am task #X
    
  • a Pipeline that executes the tasks one after the other

  • a PipelineRun for executing the Pipeline

Workflow diagram

Tekton workflow diagram

Prerequisite

  • Access to an OCP cluster with Tekton operator (Openshift pipelines) installed. The cluster credentials must allow creating the resources listed above.
  • The namespace “tekton-example” must not exist within the cluster before executing the workflow

Application configuration

Application properties can be initialized from environment variables before running the application:

Environment variableDescriptionMandatoryDefault value
OCP_API_SERVER_URLThe OpensShift API Server URL
OCP_API_SERVER_TOKENThe OpensShift API Server Token

How to run

mvn clean quarkus:dev

Example of POST to trigger the flow:

curl -X POST -H "Content-Type: application/json" http://localhost:8080/tekton

The response will include the created resources (IDs, statuses and such)


Last modified March 29, 2024: Remove extra lines (2f89dfb)