Skip to content

Commit

Permalink
Remove name field from Results
Browse files Browse the repository at this point in the history
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 tektoncd#138
  • Loading branch information
bobcatfish committed Dec 1, 2018
1 parent 0391a5d commit c711fc1
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 25 deletions.
1 change: 0 additions & 1 deletion examples/run/output-pipeline-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ spec:
type: manual
serviceAccount: 'default'
results:
name: 'logBucket'
type: 'gcs'
url: 'gcs://somebucket/results/logs'
resources:
Expand Down
1 change: 0 additions & 1 deletion examples/run/pipeline-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ spec:
type: manual
serviceAccount: 'default'
results:
name: 'logBucket'
type: 'gcs'
url: 'gcs://somebucket/results/logs'
resources:
Expand Down
1 change: 0 additions & 1 deletion examples/run/task-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ spec:
triggerRef:
type: manual
results:
name: 'logBucket'
type: 'gcs'
url: 'gcs://somebucket/results/logs'
inputs:
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ func TestPipelineRun_Validate(t *testing.T) {
},
Results: &Results{
URL: validURL,
Name: "logs",
Type: "gcs",
},
},
Expand Down
6 changes: 0 additions & 6 deletions pkg/apis/pipeline/v1alpha1/result_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand All @@ -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))
}
Expand Down
14 changes: 0 additions & 14 deletions pkg/apis/pipeline/v1alpha1/result_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
func TestValidate(t *testing.T) {
results := Results{
URL: "http://google.com",
Name: "logs",
Type: "gcs",
}
err := results.Validate("somepath")
Expand All @@ -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: "",
},
Expand All @@ -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",
},
Expand All @@ -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",
},
Expand Down
10 changes: 9 additions & 1 deletion pkg/apis/pipeline/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c711fc1

Please sign in to comment.