Skip to content

Dependent Task after Task with when condition are skipped #7680

@Allda

Description

@Allda

Expected Behavior

Hello, I am building a pipeline with a conditional series of tasks that use the same when condition, after that series of tasks there is one or more other tasks that don't have the condition.

Simplified task schema looks like this

A -> B -> C

where A and B use the condition given by the pipeline argument. At the same time, B uses the output of A as an input parameter.

I expect the C is triggered regardless of A or B but as shown bellow this is no the case and if A and B are skipped the C is also skipped.

Actual Behavior

Based on the pipeline argument A and B are skipped as expected, but C is also skipped which is unexpected. Skipped reasons are the following:
A - When Expressions evaluated to false
B - Results were missing < -- This task uses when and should be also skipped the same way as task A
C - Parent Tasks were skipped

Steps to Reproduce the Problem

  1. Create the following task and pipeline
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
  name: basic-task
spec:
  params:
    - default: Hello
      name: appName
      type: string
  results:
    - name: my-result
      type: string
  steps:
    - image: registry.redhat.io/ubi7/ubi-minimal
      name: ''
      resources: {}
      script: |

        echo $(inputs.params.appName)

        echo $(inputs.params.appName) > $(results.my-result.path)
apiVersion: tekton.dev/v1beta1
kind: Pipeline
metadata:
  name: when
spec:
  params:
    - default: foo
      name: param1
      type: string
  tasks:
    - name: basic-task
      params:
        - name: appName
          value: Hello
      taskRef:
        kind: Task
        name: basic-task
      when:
        - input: $(params.param1)
          operator: in
          values:
            - bar
    - name: basic-task-2
      params:
        - name: appName
          value: $(tasks.basic-task.results.my-result)
      runAfter:
        - basic-task
      taskRef:
        kind: Task
        name: basic-task
      when:
        - input: $(params.param1)
          operator: in
          values:
            - bar
    - name: basic-task-3
      params:
        - name: appName
          value: Hello
      runAfter:
        - basic-task-2
      taskRef:
        kind: Task
        name: basic-task

  1. Execute pipeline with default params

Additional Info

Client Version: 4.14.6
Kustomize Version: v5.0.1
Server Version: 4.13.31
Kubernetes Version: v1.26.13+77e61a2

  • Tekton Pipeline version:

Client version: 0.33.0
Chains version: v0.16.1
Pipeline version: v0.47.6
Triggers version: v0.24.2
Operator version: v0.67.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions