27 lines
496 B
Go
27 lines
496 B
Go
package commands
|
|
|
|
import (
|
|
"errors"
|
|
"log"
|
|
workflow "runner/internal/workflow"
|
|
)
|
|
|
|
func ValidateWorkflow(configuration Configuration, workflowPath string) error {
|
|
workflow, err := workflow.FromYamlFile(workflowPath)
|
|
|
|
if err != nil {
|
|
log.Fatalf("%#v", err)
|
|
}
|
|
|
|
validationErrors := workflow.Validate()
|
|
|
|
if len(validationErrors) > 0 {
|
|
for _, err := range validationErrors {
|
|
log.Printf("Validation error:: %#v", err)
|
|
}
|
|
|
|
return errors.New("Jobs encountered errors.")
|
|
}
|
|
|
|
return nil
|
|
}
|