Skip to content
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

Support Array and Strings for Matrix param validation #5925

Closed
Tracked by #5265
nschad opened this issue Dec 28, 2022 · 9 comments
Closed
Tracked by #5265

Support Array and Strings for Matrix param validation #5925

nschad opened this issue Dec 28, 2022 · 9 comments
Assignees

Comments

@nschad
Copy link

nschad commented Dec 28, 2022

Hey,

Currently validation for the matrix alpha feature is partly done in this code:

func validateParametersInTaskMatrix(matrix *Matrix) (errs *apis.FieldError) {
	if matrix != nil {
		for _, param := range matrix.Params {
			if param.Value.Type != ParamTypeArray {
				errs = errs.Also(apis.ErrInvalidValue("parameters of type array only are allowed in matrix", "").ViaFieldKey("matrix", param.Name))
			}
		}
	}
	return errs
}

Unfortunately this doesn't yet support passing in Tekton Arrays as kubernetes type String as described here in TEP-0090

For example the following is not currently supported

tasks:
...
- name: task-5
  taskRef:
    name: task-5
  matrix:
  - name: values
    value: (tasks.task-4.results.foo) # array

Err:

for: "pipeline/pipeline-test.yaml": error when patching "pipeline/pipeline-test.yaml": admission webhook "validation.webhook.pipeline.tekton.dev" denied the request: validation failed: invalid value: parameters of type array only are allowed in matrix: spec.tasks[1].matrix[k8s-versions], spec.tasks[1].matrix[machine-versions]

Is that something that is being worked on?

@jerop jerop mentioned this issue Jan 17, 2023
7 tasks
@abayer abayer self-assigned this Jan 26, 2023
abayer added a commit to abayer/tektoncd-pipeline that referenced this issue Jan 26, 2023
fixes tektoncd#5925

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
abayer added a commit to abayer/tektoncd-pipeline that referenced this issue Jan 27, 2023
fixes tektoncd#5925

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
abayer added a commit to abayer/tektoncd-pipeline that referenced this issue Jan 27, 2023
fixes tektoncd#5925

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
abayer added a commit to abayer/tektoncd-pipeline that referenced this issue Jan 27, 2023
fixes tektoncd#5925

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>
@pritidesai
Copy link
Member

What is the expectation here when array is empty? An empty array could mean 0 iterations (may be skip the entire task?) but what happens when matrix has multiple params specified and one of them is an empty array. This has to be considered while implementing this feature request.

@abayer
Copy link
Contributor

abayer commented Jan 27, 2023

I can tell you exactly what happens, thanks to #6056 (comment) - if one of the matrix params is an empty slice, everything breaks. =)

@pritidesai
Copy link
Member

Yup, I thought so 🤣 while watching PR #6056, that's why raising this concern here 😄. Along with the way how we address such empty slice, its important to understand whether it's even possible for us to support it from the pipeline perspective.

@lbernick lbernick added this to the Pipelines v0.47 milestone Apr 6, 2023
@EmmaMunley
Copy link
Contributor

/assign

@EmmaMunley
Copy link
Contributor

This issue has been closed by this PR: #6516

@EmmaMunley
Copy link
Contributor

/close

@tekton-robot
Copy link
Collaborator

@EmmaMunley: You can't close an active issue/PR unless you authored it or you are a collaborator.

In response to this:

/close

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.

@jerop
Copy link
Member

jerop commented Apr 28, 2023

Thank you @EmmaMunley!

@jerop jerop closed this as completed Apr 28, 2023
@jerop jerop reopened this Apr 28, 2023
@jerop jerop closed this as completed Apr 28, 2023
@jerop
Copy link
Member

jerop commented Apr 28, 2023

Opened #6602 tracking support of array results

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

7 participants