Skip to content

Commit

Permalink
FIX: Prevent panic on parameter evaluation
Browse files Browse the repository at this point in the history
Signed-off-by: Joao Pedro Silva <[email protected]>
  • Loading branch information
joaosilva15 authored and tekton-robot committed Dec 14, 2023
1 parent 123a690 commit 5c47c88
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions pkg/reconciler/pipelinerun/pipelinerun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,8 @@ spec:
value: $(context.pipeline.name)
- name: contextRetriesParam
value: $(context.pipelineTask.retries)
- name: param-not-found
value: $(params.notfound)
retries: 5
taskRef:
name: unit-test-task
Expand Down Expand Up @@ -385,6 +387,8 @@ spec:
value: test-pipeline
- name: contextRetriesParam
value: "5"
- name: param-not-found
value: $(params.notfound)
retries: 5
serviceAccountName: test-sa
taskRef:
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/pipelinerun/resources/apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ func filterMatrixContextVar(params v1.Params) v1.Params {
// tasks.<pipelineTaskName>.matrix.length
// tasks.<pipelineTaskName>.matrix.<resultName>.length
subExpressions := strings.Split(expression, ".")
if subExpressions[2] == "matrix" && subExpressions[len(subExpressions)-1] == "length" {
if len(subExpressions) >= 4 && subExpressions[2] == "matrix" && subExpressions[len(subExpressions)-1] == "length" {
filteredParams = append(filteredParams, param)
}
}
Expand Down

0 comments on commit 5c47c88

Please sign in to comment.