Skip to content

Commit 8f5f111

Browse files
committed
Relax result type validation to avoid nightly build failure
This commit fixes the string result type validation, PR tektoncd#4779 adds result type and asumes that the default type should be string via mutating webhook. PR tektoncd#4818 adds the validation for this. However, resources that did already exist in etcd didn't get the default. So this commit relaxes this validation.
1 parent 7d7d96f commit 8f5f111

File tree

3 files changed

+1
-20
lines changed

3 files changed

+1
-20
lines changed

pkg/apis/pipeline/v1beta1/result_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ type TaskResult struct {
2525

2626
// Description is a human-readable description of the result
2727
// +optional
28-
Description string `json:"description"`
28+
Description string `json:"description,omitempty"`
2929
}
3030

3131
// TaskRunResult used to describe the results of a task

pkg/apis/pipeline/v1beta1/result_validation.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,5 @@ func (tr TaskResult) Validate(ctx context.Context) (errs *apis.FieldError) {
3131
return errs.Also(ValidateEnabledAPIFields(ctx, "results type", config.AlphaAPIFields))
3232
}
3333

34-
if tr.Type != ResultsTypeString {
35-
return apis.ErrInvalidValue(tr.Type, "type", fmt.Sprintf("type must be string"))
36-
}
37-
3834
return nil
3935
}

pkg/apis/pipeline/v1beta1/task_validation_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1226,21 +1226,6 @@ func TestTaskSpecValidateError(t *testing.T) {
12261226
Paths: []string{"results[0].name"},
12271227
Details: "Name must consist of alphanumeric characters, '-', '_', and must start and end with an alphanumeric character (e.g. 'MyName', or 'my-name', or 'my_name', regex used for validation is '^([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9]$')",
12281228
},
1229-
}, {
1230-
name: "result type not validate",
1231-
fields: fields{
1232-
Steps: validSteps,
1233-
Results: []v1beta1.TaskResult{{
1234-
Name: "MY-RESULT",
1235-
Type: "wrong",
1236-
Description: "my great result",
1237-
}},
1238-
},
1239-
expectedError: apis.FieldError{
1240-
Message: `invalid value: wrong`,
1241-
Paths: []string{"results[0].type"},
1242-
Details: "type must be string",
1243-
},
12441229
}, {
12451230
name: "context not validate",
12461231
fields: fields{

0 commit comments

Comments
 (0)