From ba0b133ffa01b24dd8f8fecce28705c1bd464ffd Mon Sep 17 00:00:00 2001 From: Yawen Luo Date: Tue, 17 May 2022 15:22:42 -0400 Subject: [PATCH 1/3] align param reference as a whole in 0076 and 0075 to address https://github.com/tektoncd/pipeline/issues/4879 --- teps/0076-array-result-types.md | 36 +++++++++++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/teps/0076-array-result-types.md b/teps/0076-array-result-types.md index 042c8a0e5..4919d6f2f 100644 --- a/teps/0076-array-result-types.md +++ b/teps/0076-array-result-types.md @@ -452,8 +452,27 @@ tasks: Additionally, array results can be passed directly to Tasks which take arrays as parameters using [the `[*]` variable replacement syntax](https://github.com/tektoncd/pipeline/blob/main/docs/tasks.md#substituting-array-parameters). -For example: - +For example, when params `update-all-environments` in array type is substituted with another array type `tasks.get-environments.results.environments`: +```yaml +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +... +spec: +tasks: + - name: update-all-environments + params: + - name: environments + value: $(tasks.get-environments.results.environments[*]) +``` +What we will get will be: +``` +params: + - name: environments + value: + - 'value1' + - 'value2' +``` +Another example will be thw following if `tasks.get-environments.results.environments` and `environments` are both arrays of strings: ```yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline @@ -465,6 +484,19 @@ tasks: - name: environments value: '$(tasks.get-environments.results.environments[*])' ``` +A third way for variable replacements can be: +```yaml +apiVersion: tekton.dev/v1beta1 +kind: Pipeline +... +spec: +tasks: + - name: update-all-environments + params: + - name: environments + value: + - '$(tasks.get-environments.results.environments[*])' +``` ## Test Plan From ee70b4ea7fc8975a34fe5abfc37d0a75e910f53f Mon Sep 17 00:00:00 2001 From: ywluogg <69618391+ywluogg@users.noreply.github.com> Date: Tue, 17 May 2022 15:44:03 -0400 Subject: [PATCH 2/3] Update teps/0076-array-result-types.md Co-authored-by: Yongxuan Zhang <44033547+Yongxuanzhang@users.noreply.github.com> --- teps/0076-array-result-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teps/0076-array-result-types.md b/teps/0076-array-result-types.md index 4919d6f2f..ec59f73c4 100644 --- a/teps/0076-array-result-types.md +++ b/teps/0076-array-result-types.md @@ -472,7 +472,7 @@ params: - 'value1' - 'value2' ``` -Another example will be thw following if `tasks.get-environments.results.environments` and `environments` are both arrays of strings: +Another example will be the following if `tasks.get-environments.results.environments` and `environments` are both arrays of strings: ```yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline From 29d2d9d7ba09a6f2e9b37073a3367ccce81e8c8e Mon Sep 17 00:00:00 2001 From: Yawen Luo Date: Wed, 18 May 2022 12:13:54 -0400 Subject: [PATCH 3/3] fix param naming --- teps/0076-array-result-types.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/teps/0076-array-result-types.md b/teps/0076-array-result-types.md index ec59f73c4..0402696fd 100644 --- a/teps/0076-array-result-types.md +++ b/teps/0076-array-result-types.md @@ -452,7 +452,7 @@ tasks: Additionally, array results can be passed directly to Tasks which take arrays as parameters using [the `[*]` variable replacement syntax](https://github.com/tektoncd/pipeline/blob/main/docs/tasks.md#substituting-array-parameters). -For example, when params `update-all-environments` in array type is substituted with another array type `tasks.get-environments.results.environments`: +For example, when params `environments` in array type is substituted with another array type `tasks.get-environments.results.environments`: ```yaml apiVersion: tekton.dev/v1beta1 kind: Pipeline