Chapter 6
In this chapter, you learned one important concept called finally
tasks. In this section, you will put this knowledge to work and use exit codes to change the final output of your pipelines.
Fail if root
Create a pipeline with a simple task. This task will check whether the container is running as the root user. If it is indeed running as the root user, the task will fail.
Here is a possible solution for the exercise:
apiVersion: tekton.dev/v1beta1 kind: Task metadata: name: fail-if-root spec: steps: - name: fail-if-root image: registry.access.redhat.com/ubi8/ubi script: | if [ $(whoami) == "root" ] then echo "User is root" ...