Chapter 8: Adding when Expressions
In the pipelines you've built so far, Tekton executed tasks in a specified order as long as the previous one was successful. As you work your way toward more advanced CI/CD Tekton pipelines, you will encounter cases where some of your tasks will need to be guarded. A typical use case would be to prevent a deployment task from being executed if the branch on which a commit happened is anything but main
.
When expressions can be added to Tekton tasks to add a condition on when to execute a specific task. In this chapter, you will learn more about building your when
expressions and how to add them to a task to block their execution.
Finally, to decide whether a task should be executed or not, you will see how you can use pipeline parameters as an input to evaluate.
In this chapter, we are going to cover the following main topics:
- Introducing when expressions
- Using when expressions with parameters
- Using the notin...