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

fix ValidateStepResultsVariables to validate stepResults only #8264

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/apis/pipeline/v1/task_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -859,6 +859,5 @@ func ValidateStepResultsVariables(ctx context.Context, results []StepResult, scr
resultsNames.Insert(r.Name)
}
errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(script, "step.results", resultsNames).ViaField("script"))
errs = errs.Also(substitution.ValidateNoReferencesToUnknownVariables(script, "results", resultsNames).ViaField("script"))
return errs
}
13 changes: 0 additions & 13 deletions pkg/apis/pipeline/v1alpha1/stepaction_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,19 +613,6 @@ func TestStepActionSpecValidateError(t *testing.T) {
Message: `windows script support requires "enable-api-fields" feature gate to be "alpha" but it is "beta"`,
Paths: []string{},
},
}, {
name: "step script refers to nonexistent result",
fields: fields{
Image: "my-image",
Script: `
#!/usr/bin/env bash
date | tee $(results.non-exist.path)`,
Results: []v1.StepResult{{Name: "a-result"}},
},
expectedError: apis.FieldError{
Message: `non-existent variable in "\n\t\t\t#!/usr/bin/env bash\n\t\t\tdate | tee $(results.non-exist.path)"`,
Paths: []string{"script"},
},
}, {
name: "step script refers to nonexistent stepresult",
fields: fields{
Expand Down
13 changes: 0 additions & 13 deletions pkg/apis/pipeline/v1beta1/stepaction_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -613,19 +613,6 @@ func TestStepActionSpecValidateError(t *testing.T) {
Message: `windows script support requires "enable-api-fields" feature gate to be "alpha" but it is "beta"`,
Paths: []string{},
},
}, {
name: "step script refers to nonexistent result",
fields: fields{
Image: "my-image",
Script: `
#!/usr/bin/env bash
date | tee $(results.non-exist.path)`,
Results: []v1.StepResult{{Name: "a-result"}},
},
expectedError: apis.FieldError{
Message: `non-existent variable in "\n\t\t\t#!/usr/bin/env bash\n\t\t\tdate | tee $(results.non-exist.path)"`,
Paths: []string{"script"},
},
}, {
name: "step script refers to nonexistent stepresult",
fields: fields{
Expand Down