Running a halting task
Your pipelines are there to help you automate the delivery mechanisms of your applications. The ultimate goal is to make it possible to ship faster and more frequently. On the other hand, you also want to avoid pushing code that is broken or that doesn't pass your standards. This is why you will sometimes have some pipeline runs that won't complete. If you have a task running some failing unit tests, Tekton should not start the deployment task.
To demonstrate this, you will create a task that logs some text and then uses a specific exit code to tell Tekton whether the task succeeded or not.
Note
Normally, the executable running inside a step would provide the exit code. For those codes, 0
indicates success, while any other number indicates some failure.
You will then build a pipeline using that task to simulate failing tasks inside a CI/CD pipeline:
- Create a new file named
log-and-exit.yaml
in which you create a new task called...