Skip to content

Commit

Permalink
Skip validation for deletion of v1 task
Browse files Browse the repository at this point in the history
This commit bypasses v1 Task validation if the Task is being deleted.
This allows Tasks to be deleted if a new version of Tekton Pipelines is applied
that makes them invalid.
  • Loading branch information
lbernick authored and tekton-robot committed Jul 31, 2022
1 parent b2a4b28 commit cc649a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1/task_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ var objectVariableNameFormatRegex = regexp.MustCompile(objectVariableNameFormat)

// Validate implements apis.Validatable
func (t *Task) Validate(ctx context.Context) *apis.FieldError {
errs := validate.ObjectMetadata(t.GetObjectMeta()).ViaField("metadata")
if apis.IsInDelete(ctx) {
return nil
}
errs := validate.ObjectMetadata(t.GetObjectMeta()).ViaField("metadata")
return errs.Also(t.Spec.Validate(apis.WithinSpec(ctx)).ViaField("spec"))
}

Expand Down

0 comments on commit cc649a6

Please sign in to comment.