forked from tektoncd/pipeline
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for using PipelineRun parameters as matrix parameter values
This commit adds support for using PipelineRun parameters as matrix parameter values by moving the validation for checking matrix parameter types to after parameter substitution. This is necessary for allowing whole array substitutions using the syntax $(params.foo[*]), rather than an explicit YAML array, to be used as a matrix parameter. Prior to this, validation fails because a string referencing an array type was considered a string type and this was done before the applying array replacements. Note: Whole array replacements for matrix results has not yet been implemented and will be added in a subsequent PR. This issue is described in more detail here: tektoncd#6056
- Loading branch information
1 parent
8e8c163
commit 05763fa
Showing
14 changed files
with
876 additions
and
432 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
examples/v1beta1/pipelineruns/alpha/pipelinerun-with-matrix-array-references.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Task | ||
metadata: | ||
name: platform-browsers | ||
annotations: | ||
description: | | ||
A task that does something cool with platforms and browsers | ||
spec: | ||
params: | ||
- name: platform | ||
default: "" | ||
- name: browser | ||
default: "" | ||
steps: | ||
- name: echo | ||
image: alpine | ||
script: | | ||
echo "$(params.platform) and $(params.browser)" | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: PipelineRun | ||
metadata: | ||
generateName: matrixed-pr- | ||
spec: | ||
serviceAccountName: "default" | ||
params: | ||
- name: platforms | ||
value: | ||
- linux | ||
- mac | ||
- windows | ||
- name: browsers | ||
value: | ||
- chrome | ||
- safari | ||
- firefox | ||
pipelineRef: | ||
name: matrixed-pipeline | ||
--- | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: Pipeline | ||
metadata: | ||
name: matrixed-pipeline | ||
spec: | ||
params: | ||
- name: platforms | ||
type: array | ||
- name: browsers | ||
type: array | ||
tasks: | ||
- name: platforms-and-browsers | ||
matrix: | ||
params: | ||
- name: platform | ||
value: $(params.platforms[*]) | ||
- name: browser | ||
value: $(params.browsers[*]) | ||
taskRef: | ||
name: platform-browsers | ||
finally: | ||
- name: platforms-and-browsers-in-finally | ||
matrix: | ||
params: | ||
- name: platform | ||
value: $(params.platforms[*]) | ||
- name: browser | ||
value: $(params.browsers[*]) | ||
taskRef: | ||
name: platform-browsers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.