Skip to content

Commit

Permalink
Fix Example with Completed and Succeeded Execution Status
Browse files Browse the repository at this point in the history
Today, an example `pipeline` that demonstrates using the execution
status of `tasks` - `$(tasks.status)` - in `when` expressions in
`finally tasks` uses `Succeeded` in a `Task` that should be executed
but the status is actually `Completed`. This example would be confusing
to users as reported on Slack.

As explained in the [docs](https://github.com/tektoncd/pipeline/blob/release-v0.24.x/docs/pipelines.md#using-aggregate-execution-status-of-all-tasks):
- `Succeeded`: all `tasks` have succeeded
- `Failed`: one ore more `tasks` failed
- `Completed`: all `tasks` completed successfully including one or more
skipped `tasks`

In this change:
- correct the `task` that should be executed to check `Completed`
instead of `Succeeded`
- add a `finally task` that shows `Succeeded` would block execution
because the aggregate execution status is actually `Completed`
  • Loading branch information
jerop authored and tekton-robot committed Aug 6, 2021
1 parent 50ebf6a commit 05d55b2
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,24 @@ spec:
- name: echo
image: ubuntu
script: exit 1
- name: finally-task-should-be-skipped-5 # when expression using tasks execution status, evaluates to false
when:
- input: "$(tasks.status)"
operator: in
values: ["Succeeded"]
taskSpec:
steps:
- name: echo
image: ubuntu
script: exit 1
- name: finally-task-should-be-executed # when expression using execution status, tasks execution status, param, and results
when:
- input: "$(tasks.echo-file-exists.status)"
operator: in
values: ["Succeeded"]
- input: "$(tasks.status)"
operator: in
values: ["Succeeded"]
values: ["Completed"]
- input: "$(tasks.check-file.results.exists)"
operator: in
values: ["yes"]
Expand Down

0 comments on commit 05d55b2

Please sign in to comment.