Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

InvalidTaskResultsReference when dynamically generating subsequent tasks in a pipeline using matrix #8324

Open
jjsiv opened this issue Oct 10, 2024 · 0 comments · May be fixed by #8327
Open
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@jjsiv
Copy link

jjsiv commented Oct 10, 2024

Expected Behavior

Pipeline runs and taskruns from all 3 tasks are generated.

Actual Behavior

PipelineRun fails with 'invalid result reference in pipeline task "printer": unable to validate result referencing pipeline task "platforms": task spec not found'

Steps to Reproduce the Problem

Run a pipeline with 3 tasks:

  • first task generates an array type result
  • second task references the array type result generated from the first task to dynamically generate taskruns using matrix. Each of these runs then sets a string type result
  • third task references the aggregated results of taskruns from the second task to dynamically fan out tasks once again using matrix, as described in the documentation here. This will fail with the following error: 'invalid result reference in pipeline task "printer": unable to validate result referencing pipeline task "platforms": task spec not found'
apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: array-emitter
spec:
  results:
  - name: array
    type: array
  steps:
    - name: echo
      image: mirror.gcr.io/alpine
      script: |
        echo -n "[\"linux\",\"max\",\"windows\"]" > $(results.array.path)
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: platform-browsers
spec:
  params:
    - name: platform
    - name: testmatrixed
  results:
  - name: str
    type: string
  steps:
    - name: echo
      image: mirror.gcr.io/alpine
      script: |
        echo "$(params.platform)"
        echo -n "PARAM" > $(results.str.path)
---
apiVersion: tekton.dev/v1
kind: Task
metadata:
  name: printer
spec:
  params:
    - name: test
  steps:
    - name: echo
      image: mirror.gcr.io/alpine
      script: |
        echo $(params.test)
---
apiVersion: tekton.dev/v1
kind: PipelineRun
metadata:
  name: matrixed-pr
spec:
  taskRunTemplate:
    serviceAccountName: "default"
  pipelineSpec:
    tasks:

    - name: array-emitter
      taskRef:
        name: array-emitter

    - name: platforms
      params:
        - name: test
          value: test
      matrix:
        params:
          - name: platform
            value: $(tasks.array-emitter.results.array[*])
      taskRef:
        name: platform-browsers

    - name: printer
      taskRef:
        name: printer
      matrix:
        params:
          - name: platform
            value: $(tasks.platforms.results.str[*])

Additional Info

  • Kubernetes version:

    Output of kubectl version:

Client Version: v1.31.1
Kustomize Version: v5.4.2
Server Version: v1.31.1

  • Tekton Pipeline version:

    Output of tkn version or kubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'

v0.64.0
@jjsiv jjsiv added the kind/bug Categorizes issue or PR as related to a bug. label Oct 10, 2024
@chengjoey chengjoey linked a pull request Oct 14, 2024 that will close this issue
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant