pipeline
pipeline copied to clipboard
InvalidTaskResultsReference when dynamically generating subsequent tasks in a pipeline using matrix
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 versionorkubectl get pods -n tekton-pipelines -l app=tekton-pipelines-controller -o=jsonpath='{.items[0].metadata.labels.version}'
v0.64.0