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

Validate ArchiveLocation Artifacts #1167

Merged
merged 1 commit into from
Jan 14, 2019
Merged
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
10 changes: 8 additions & 2 deletions workflow/validate/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ func (ctx *wfValidationCtx) validateTemplate(tmpl *wfv1.Template, args wfv1.Argu
if err != nil {
return err
}
if tmpl.ArchiveLocation != nil {
err = validateArtifactLocation("templates.archiveLocation", *tmpl.ArchiveLocation)
if err != nil {
return err
}
}
return nil
}

Expand Down Expand Up @@ -184,15 +190,15 @@ func validateInputs(tmpl *wfv1.Template) (map[string]interface{}, error) {
return nil, errors.Errorf(errors.CodeBadRequest, "templates.%s.%s.from not valid in inputs", tmpl.Name, artRef)
}
errPrefix := fmt.Sprintf("templates.%s.%s", tmpl.Name, artRef)
err = validateArtifactLocation(errPrefix, art)
err = validateArtifactLocation(errPrefix, art.ArtifactLocation)
if err != nil {
return nil, err
}
}
return scope, nil
}

func validateArtifactLocation(errPrefix string, art wfv1.Artifact) error {
func validateArtifactLocation(errPrefix string, art wfv1.ArtifactLocation) error {
if art.Git != nil {
if art.Git.Repo == "" {
return errors.Errorf(errors.CodeBadRequest, "%s.git.repo is required", errPrefix)
Expand Down