Skip to content

Commit

Permalink
feat: add WORKFLOW_VALIDATION_PATTERN
Browse files Browse the repository at this point in the history
Signed-off-by: Tianchu Zhao <[email protected]>
  • Loading branch information
tczhao committed Nov 24, 2024
1 parent 8c1cee2 commit e138ec7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions workflow/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package validate
import (
"encoding/json"
"fmt"
"os"
"reflect"
"regexp"
"strconv"
Expand Down Expand Up @@ -138,6 +139,15 @@ func validateHooks(hooks wfv1.LifecycleHooks, hookBaseName string) error {

// ValidateWorkflow accepts a workflow and performs validation against it.
func ValidateWorkflow(wftmplGetter templateresolution.WorkflowTemplateNamespacedGetter, cwftmplGetter templateresolution.ClusterWorkflowTemplateGetter, wf *wfv1.Workflow, opts ValidateOpts) error {
// TRANSIENT_ERROR_PATTERN will only validate workflow with name that matches pattern
pattern, _ := os.LookupEnv("WORKFLOW_VALIDATION_PATTERN")
if pattern != "" {
match, _ := regexp.MatchString(pattern, wf.Name)
if !match {
return nil
}
}

ctx := newTemplateValidationCtx(wf, opts)
tmplCtx := templateresolution.NewContext(wftmplGetter, cwftmplGetter, wf, wf)
var wfSpecHolder wfv1.WorkflowSpecHolder
Expand Down

0 comments on commit e138ec7

Please sign in to comment.