From d852d1df6607478821cb9789d248e1dcbb8ad6d4 Mon Sep 17 00:00:00 2001 From: Priti Desai Date: Wed, 23 Aug 2023 14:08:07 -0700 Subject: [PATCH] updating example of a matrix feature 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. Signed-off-by: Priti Desai --- .../alpha/pipelinerun-with-matrix.yaml | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/examples/v1/pipelineruns/alpha/pipelinerun-with-matrix.yaml b/examples/v1/pipelineruns/alpha/pipelinerun-with-matrix.yaml index 6105430834d..c9a70f9c121 100644 --- a/examples/v1/pipelineruns/alpha/pipelinerun-with-matrix.yaml +++ b/examples/v1/pipelineruns/alpha/pipelinerun-with-matrix.yaml @@ -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: