Skip to content

Commit

Permalink
fix ValidateStepResultsVariables to validate stepResults only
Browse files Browse the repository at this point in the history
  • Loading branch information
jkhelil committed Sep 17, 2024
1 parent cd8a41e commit e078cdd
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
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/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

0 comments on commit e078cdd

Please sign in to comment.