Skip to content

Commit

Permalink
updating example of a matrix feature
Browse files Browse the repository at this point in the history
Fixing a bug with InvalidMatrixParameterType when a parameter is not
part of a matrix but defined as a task parameter of type string,
pipelineRun results in a failure.

Adding two new validation:

* onError with matrix: when a task fan out for a given number of instances,
pipeline controller must apply the onError to each running instance.

* retry with matrix: when a task has specified retry, that specification
must apply to all the instances of fanned out task.

Being consistent with the rest of the reasons, dropping "Reason" from
"ReasonInvalidMatrixParameterTypes".

Updated the error reported in "ValidateParameterTypesInMatrix" to include
name of the pipelineTask.

Co-authored-by: EmmaMunley <emmamunley@google.com>

Signed-off-by: Priti Desai <pdesai@us.ibm.com>
  • Loading branch information
pritidesai committed Sep 1, 2023
1 parent 8c6bd54 commit 06faa10
Show file tree
Hide file tree
Showing 6 changed files with 442 additions and 9 deletions.
40 changes: 40 additions & 0 deletions examples/v1/pipelineruns/alpha/pipelinerun-with-matrix.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,46 @@ spec:
- name: echo
image: ubuntu
script: exit 1
- name: matrix-with-task-using-onerror
matrix:
params:
- name: version
value:
- "1"
- "2"
taskSpec:
params:
- name: version
steps:
- name: echo
image: ubuntu
onError: continue
script: exit 1
- name: matrix-with-task-retries
retries: 1
params:
- name: pipelineTask-retries
value: $(context.pipelineTask.retries)
matrix:
params:
- name: version
value:
- "1"
- "2"
taskSpec:
params:
- name: version
- name: pipelineTask-retries
steps:
- image: alpine
script: |
#!/usr/bin/env sh
if [ "$(context.task.retry-count)" == "$(params.pipelineTask-retries)" ]; then
echo "This is the last retry."
exit 0;
fi
echo "The PipelineTask has retried $(context.task.retry-count) times."
exit 1
finally:
- name: matrix-params-with-empty-array-skipped-in-finally
matrix:
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const (
// all of the running TaskRuns as timed out failed.
ReasonCouldntTimeOut = "PipelineRunCouldntTimeOut"
// ReasonInvalidMatrixParameterTypes indicates a matrix contains invalid parameter types
ReasonInvalidMatrixParameterTypes = "ReasonInvalidMatrixParameterTypes"
ReasonInvalidMatrixParameterTypes = "InvalidMatrixParameterTypes"
// ReasonInvalidTaskResultReference indicates a task result was declared
// but was not initialized by that task
ReasonInvalidTaskResultReference = "InvalidTaskResultReference"
Expand Down
Loading

0 comments on commit 06faa10

Please sign in to comment.