Getting Started with Pipelines
This tutorial shows you how to:
- Create two Tasks.
- Create a Pipeline containing your Tasks.
PipelineRunto instantiate and run the Pipeline containing your Tasks.
For this tutorial we are going to use minikube to run the commands locally.
Complete the Getting started with Tasks tutorial. Do not clean up your resources, skip the last section.
Create and run a second Task
You already have a Hello World! Task. To create a second Goodbye World! Task:
Create a new file named
goodbye-world.yamland add the following content:
apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: goodbye spec: steps: - name: goodbye image: ubuntu script: | #!/bin/bash echo "Goodbye World!"
Apply your Task file:
kubectl apply --filename goodbye-world.yaml
When a Task is part of a Pipeline you don’t have to instantiate it, the Pipeline is going to take care of that.
Create and run a Pipeline
A Pipeline defines an ordered series of Tasks arranged in a specific execution order as part of your CI/CD workflow.
In this section you are going to create your first Pipeline, that will include both the Hello World! and Goodbye World! Tasks.
Create a new file named
hello-goodbye-pipeline.yamland add the following content:
apiVersion: tekton.dev/v1beta1 kind: Pipeline metadata: name: hello-goodbye spec: tasks: - name: hello taskRef: name: hello - name: goodbye runAfter: - hello taskRef: name: goodbye
Apply your Pipeline configuration to your cluster:
kubectl apply --filename hello-goodbye-pipeline.yaml
Instantiate your Pipeline with a
PipelineRunobject. Create a new file named
hello-goodbye-pipeline-run.yamlwith the following content:
apiVersion: tekton.dev/v1beta1 kind: PipelineRun metadata: name: hello-goodbye-run spec: pipelineRef: name: hello-goodbye
Start your Pipeline by applying the
PipelineRunconfiguration to your cluster:
kubectl apply --filename hello-goodbye-pipeline-run.yaml
You see the following output:
Tekton now starts running your Pipeline.
To see the logs of the
PipelineRun, use the following command:
tkn pipelinerun logs hello-goodbye-run -f -n default
The output shows both Tasks completed successfully:
[hello : hello] Hello World! [goodbye : goodbye] Goodbye World!
To delete the cluster that you created for this quickstart run:
The output confirms that your cluster was deleted:
🔥 Deleting "minikube" in docker ... 🔥 Deleting container "minikube" ... 🔥 Removing /home/user/.minikube/machines/minikube ... 💀 Removed all traces of the "minikube" cluster.
Other useful resources
Was this page helpful?
Thanks! Tell us how we can further improve.
Sorry about that. Tell us how we can further improve.