Reusing tasks in the context of a pipeline
In the last chapter, you saw how to make tasks reusable by using parameters. You also saw how you can set the values for those parameters from a pipeline. Using those parameters, you can use a given task in multiple pipelines, and you can even use a given task inside a single pipeline. This is what you will do here:
- Start with a new file called
log-task.yaml
. Here, create a new task calledlogger
:apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: logger spec:
- This task will need a parameter. You can give it the name
text
. This will be a parameter of thestring
type:params: - name: text type: string
- For the
steps
object, you will have a single step that logs the date and time followed by the text to be logged:steps: - name: log image: registry.access.redhat.com/ubi8/ubi-minimal...