Skip to content

Commit 876b81e

Browse files
joaosilva15tekton-robot
authored andcommitted
FIX: Prevent panic on parameter evaluation
Signed-off-by: Joao Pedro Silva <[email protected]>
1 parent 597f386 commit 876b81e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

pkg/reconciler/pipelinerun/pipelinerun_test.go

+4
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ spec:
296296
value: $(context.pipeline.name)
297297
- name: contextRetriesParam
298298
value: $(context.pipelineTask.retries)
299+
- name: param-not-found
300+
value: $(params.notfound)
299301
retries: 5
300302
taskRef:
301303
name: unit-test-task
@@ -385,6 +387,8 @@ spec:
385387
value: test-pipeline
386388
- name: contextRetriesParam
387389
value: "5"
390+
- name: param-not-found
391+
value: $(params.notfound)
388392
retries: 5
389393
serviceAccountName: test-sa
390394
taskRef:

pkg/reconciler/pipelinerun/resources/apply.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ func filterMatrixContextVar(params v1.Params) v1.Params {
160160
// tasks.<pipelineTaskName>.matrix.length
161161
// tasks.<pipelineTaskName>.matrix.<resultName>.length
162162
subExpressions := strings.Split(expression, ".")
163-
if subExpressions[2] == "matrix" && subExpressions[len(subExpressions)-1] == "length" {
163+
if len(subExpressions) >= 4 && subExpressions[2] == "matrix" && subExpressions[len(subExpressions)-1] == "length" {
164164
filteredParams = append(filteredParams, param)
165165
}
166166
}

0 commit comments

Comments
 (0)