From c711fc1d2f8e72135b86d8eb3c3da9f18aa440f0 Mon Sep 17 00:00:00 2001 From: Christie Wilson Date: Sat, 1 Dec 2018 10:07:17 -0800 Subject: [PATCH] Remove `name` field from `Results` In the interests in keeping our spec as lean and simple as it can possibly be, at the moment there is no reason why our Results config needs to have a name, so let's remove it. This is the last unnecessary field we have in our yamls that I'm aware of, so this fixes #138 --- examples/run/output-pipeline-run.yaml | 1 - examples/run/pipeline-run.yaml | 1 - examples/run/task-run.yaml | 1 - .../v1alpha1/pipelinerun_validation_test.go | 1 - pkg/apis/pipeline/v1alpha1/result_types.go | 6 ------ pkg/apis/pipeline/v1alpha1/result_types_test.go | 14 -------------- .../pipeline/v1alpha1/zz_generated.deepcopy.go | 10 +++++++++- 7 files changed, 9 insertions(+), 25 deletions(-) diff --git a/examples/run/output-pipeline-run.yaml b/examples/run/output-pipeline-run.yaml index d0b8a30c148..c288ce3fe31 100644 --- a/examples/run/output-pipeline-run.yaml +++ b/examples/run/output-pipeline-run.yaml @@ -10,7 +10,6 @@ spec: type: manual serviceAccount: 'default' results: - name: 'logBucket' type: 'gcs' url: 'gcs://somebucket/results/logs' resources: diff --git a/examples/run/pipeline-run.yaml b/examples/run/pipeline-run.yaml index 50afab27e77..842508dcc41 100644 --- a/examples/run/pipeline-run.yaml +++ b/examples/run/pipeline-run.yaml @@ -10,7 +10,6 @@ spec: type: manual serviceAccount: 'default' results: - name: 'logBucket' type: 'gcs' url: 'gcs://somebucket/results/logs' resources: diff --git a/examples/run/task-run.yaml b/examples/run/task-run.yaml index fbf9639fd4c..51fdc42c17b 100644 --- a/examples/run/task-run.yaml +++ b/examples/run/task-run.yaml @@ -9,7 +9,6 @@ spec: triggerRef: type: manual results: - name: 'logBucket' type: 'gcs' url: 'gcs://somebucket/results/logs' inputs: diff --git a/pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go b/pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go index adc13f0608f..c4209d41ee1 100644 --- a/pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go +++ b/pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go @@ -107,7 +107,6 @@ func TestPipelineRun_Validate(t *testing.T) { }, Results: &Results{ URL: validURL, - Name: "logs", Type: "gcs", }, }, diff --git a/pkg/apis/pipeline/v1alpha1/result_types.go b/pkg/apis/pipeline/v1alpha1/result_types.go index c0e361f05c2..88dced1d8b9 100644 --- a/pkg/apis/pipeline/v1alpha1/result_types.go +++ b/pkg/apis/pipeline/v1alpha1/result_types.go @@ -38,7 +38,6 @@ const ( // Results is used to identify an endpoint where results can be uploaded. The // serviceaccount used for the pipeline must have access to this endpoint. type Results struct { - Name string `json:"name"` Type ResultTargetType `json:"type"` URL string `json:"url"` } @@ -47,11 +46,6 @@ type Results struct { // we found this instance of `Results` (since it is probably a member of another // structure) and will be used to report any errors. func (r *Results) Validate(path string) *apis.FieldError { - // If set then verify all variables pass the validation - if r.Name == "" { - return apis.ErrMissingField(fmt.Sprintf("%s.name", path)) - } - if r.Type != ResultTargetTypeGCS { return apis.ErrInvalidValue(string(r.Type), fmt.Sprintf("%s.Type", path)) } diff --git a/pkg/apis/pipeline/v1alpha1/result_types_test.go b/pkg/apis/pipeline/v1alpha1/result_types_test.go index 0b15758295f..65f1ce47d25 100644 --- a/pkg/apis/pipeline/v1alpha1/result_types_test.go +++ b/pkg/apis/pipeline/v1alpha1/result_types_test.go @@ -26,7 +26,6 @@ import ( func TestValidate(t *testing.T) { results := Results{ URL: "http://google.com", - Name: "logs", Type: "gcs", } err := results.Validate("somepath") @@ -44,25 +43,14 @@ func TestValidate_Invalid(t *testing.T) { { name: "invalid task type result", results: &Results{ - Name: "resultlogs", URL: "http://www.google.com", Type: "wrongtype", }, want: apis.ErrInvalidValue("wrongtype", "spec.results.Type"), }, - { - name: "invalid task type results name", - results: &Results{ - Name: "", - URL: "http://www.google.com", - Type: ResultTargetTypeGCS, - }, - want: apis.ErrMissingField("spec.results.name"), - }, { name: "invalid task type results missing url", results: &Results{ - Name: "resultsrunname", Type: ResultTargetTypeGCS, URL: "", }, @@ -71,7 +59,6 @@ func TestValidate_Invalid(t *testing.T) { { name: "invalid task type results bad url", results: &Results{ - Name: "resultsrunname", Type: ResultTargetTypeGCS, URL: "badurl", }, @@ -80,7 +67,6 @@ func TestValidate_Invalid(t *testing.T) { { name: "invalid task type results type", results: &Results{ - Name: "resultsrunname", Type: "badtype", URL: "http://www.google.com", }, diff --git a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go index eb2fa586ccd..ee2061dd558 100644 --- a/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go @@ -959,7 +959,15 @@ func (in *TaskRunSpec) DeepCopyInto(out *TaskRunSpec) { out.Trigger = in.Trigger in.Inputs.DeepCopyInto(&out.Inputs) in.Outputs.DeepCopyInto(&out.Outputs) - out.Results = in.Results + if in.Results != nil { + in, out := &in.Results, &out.Results + if *in == nil { + *out = nil + } else { + *out = new(Results) + **out = **in + } + } if in.TaskRef != nil { in, out := &in.TaskRef, &out.TaskRef if *in == nil {