tektoncd / pipeline

A cloud-native Pipeline resource.
https://tekton.dev
Apache License 2.0
8.45k stars 1.77k forks source link

matrixed `PipelineRun` status conditions should include the all the taskruns count #7365

Open karthikjeeyar opened 10 months ago

karthikjeeyar commented 10 months ago

Expected Behavior

Matrixed Pipelinerun status condition message to include all the TaskRuns count produced by the PipelineRun

  conditions:
    - lastTransitionTime: '2023-11-15T09:34:54Z'
      message: 'Tasks Completed: 12 (Failed: 0, Cancelled 0), Skipped: 0'
      reason: Succeeded
      status: 'True'
      type: Succeeded

Actual Behavior

Pipelinerun status condition message count only includes the tasks from the spec.pipelineSpec.tasks

  conditions:
    - lastTransitionTime: '2023-11-15T09:34:54Z'
      message: 'Tasks Completed: 3 (Failed: 0, Cancelled 0), Skipped: 0'
      reason: Succeeded
      status: 'True'
      type: Succeeded

Steps to Reproduce the Problem

apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: platform-browsers
  annotations:
    description: |
      A task that does something cool with platforms and browsers
spec:
  params:
    - name: platform
    - name: browser
    - name: url
  steps:
    - name: echo
      image: alpine
      script: |
        echo "Visit $(params.url) on $(params.platform) using $(params.browser)."
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  generateName: matrixed-pr-
spec:
  taskRunTemplate:
    serviceAccountName: "default"
  pipelineSpec:
    tasks:
      - name: get-platforms
        taskSpec:
          results:
            - name: platforms
              type: array
          steps:
            - name: produce-a-list-of-platforms
              image: bash:latest
              script: |
                #!/usr/bin/env bash
                echo -n "[\"linux\",\"mac\",\"windows\"]" | tee $(results.platforms.path)
      - name: get-browsers-and-url
        taskSpec:
          results:
            - name: browsers
              type: array
            - name: url
          steps:
            - name: produce-a-list-of-browsers
              image: bash:latest
              script: |
                #!/usr/bin/env bash
                echo -n "[\"chrome\",\"safari\",\"firefox\"]" | tee $(results.browsers.path)
            - name: produce-url
              image: bash:latest
              script: |
                #!/usr/bin/env bash
                echo -n "myfavoritesitedotcom" | tee $(results.url.path)
      - name: platforms-and-browsers-dag
        matrix:
          params:
            - name: platform
              value: $(tasks.get-platforms.results.platforms[*])
            - name: browser
              value:
                - $(tasks.get-browsers-and-url.results.browsers[0])
                - $(tasks.get-browsers-and-url.results.browsers[2])
            - name: url
              value:
                - $(tasks.get-browsers-and-url.results.url)
        taskRef:
          name: platform-browsers
  1. Create the task and Pipelinerun
  2. Check the status.conditions[0].message

Additional Info

Server Version: version.Info{Major:"1", Minor:"27", GitVersion:"v1.27.3+ab0b8ee", GitCommit:"ee9c1a1f13b06f5e2a79dcbd06285ec3f8315448", GitTreeState:"clean", BuildDate:"2023-06-27T15:55:01Z", GoVersion:"go1.20.3", Compiler:"gc", Platform:"linux/amd64"}
v0.50.3
karthikjeeyar commented 10 months ago

/cc @vdemeester

pratap0007 commented 10 months ago

/assign