tektoncd / website

Tekton Website
https://tekton.dev
Apache License 2.0
62 stars 149 forks source link

Pipelines #533

Closed oDevArc closed 1 year ago

oDevArc commented 1 year ago

Hello

In this section https://tekton.dev/docs/pipelines/pipelines/#guard-task-execution-using-when-expressions it seems that the example given for a task named name: first-create-file cannot work because the when clause of the next task echo-file-exists is calling the result of the task by this expression : input: "$(tasks.check-file.results.exists)" which fot me is trying to get the result of task named check-file which is not existing ! the good name would be first-create-file and the the when section would be:

tasks:
  - name: first-create-file
    when:
      - input: "$(params.path)"
        operator: in
        values: ["README.md"]
    taskRef:
      name: first-create-file
---
tasks:
  - name: echo-file-exists
    when:
      - input: "$(tasks.first-create-file.results.exists)" #<<<< this line

I'm not sure of me :-) because I'm learning !

in the full example line 36 there is a task named check-file : https://github.com/tektoncd/pipeline/blob/release-v0.46.x/examples/v1beta1/pipelineruns/pipelinerun-with-when-expressions.yaml#L36

AlanGreene commented 1 year ago

Hi @oDevArc, thanks for raising this issue. These examples are snippets from separate Pipelines (each has their own tasks field) showing examples of some of the ways when expressions can be used, and are not meant to be considered together.

The full example contains a complete pipeline where tasks reference each other using when expressions.

Would you like to open a PR clarifying this in the docs?

oDevArc commented 1 year ago

no it's ok sorry for the disturbance