-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Task "script" blocks do not support array types for parameters #2374
Comments
/type feature |
Thanks for the report! We do document this though it's a little bit buried: https://github.com/tektoncd/pipeline/blob/master/docs/tasks.md#substituting-array-parameters
The |
@sbwsg That makes sense, I didn't immediately make the connection when going through that line. I will open a PR to call out the script field explicitly in the docs, if that's ok. This will be good to have if it can be implemented safely. As a workaround for my current task, I've create a space separated string type, which is almost equivalent since I'd guess the array expansion would be into a space separated string anyway. |
Interestingly this is one of the reasons that we don't support array expansion in strings - different use-cases expect different joining strings. In some cases space-separated is good, in others comma-separated would be preferable. If you do decide to pursue this then I'd recommend soliciting feedback in one of our Working Group meetings. Also, paging @skaegi here as well who looked into implementing JSONPath for our variable interpolation, which might have built-in syntax for this or otherwise provide a longer-term solution to this problem? |
See #1463 -- sorry this is a pretty typical use-case and I'm really late on getting back to working on this after the beta. |
Rotten issues close after 30d of inactivity. /close Send feedback to tektoncd/plumbing. |
Stale issues rot after 30d of inactivity. /lifecycle rotten Send feedback to tektoncd/plumbing. |
Issues go stale after 90d of inactivity. /lifecycle stale Send feedback to tektoncd/plumbing. |
@tekton-robot: Closing this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
/remove-lifecycle rotten |
@vdemeester: Reopened this issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
As @sbwsg explained this was by design (#2374 (comment)) if we want to change this, maybe we can open a separate issue to explore it? |
I found a workaround for anyone that stumbles on this. You can pass the array in the args section and then use the args in the script. In the above case, it would look something like
As per tekton documentation
|
Nice solution by may not be suitable in some cases. |
Expected Behavior
$params.arrayVar[*] is expanded when referenced in the script
Actual Behavior
Error from server (BadRequest): error when creating "my-task.yaml": admission webhook "validation.webhook.pipeline.tekton.dev" denied the request: validation failed: variable type invalid in "\echo \"$(params.arrayVar[*])\"\n" for step script: taskspec.steps.script
Steps to Reproduce the Problem
Task
TaskRun
The text was updated successfully, but these errors were encountered: