Skip to content

Commit

Permalink
Remove Runs & Tests from PipelineRun Results #121
Browse files Browse the repository at this point in the history
Its not clear yet how runs and tests will be used, so removing them for
now. Might not be the best place to add them anyways.

Also updated examples with new fields in PipelineRun

Signed-off-by: Nader Ziada <[email protected]>
  • Loading branch information
nader-ziada committed Nov 30, 2018
1 parent 2ba145b commit ec91ca6
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 67 deletions.
6 changes: 6 additions & 0 deletions examples/run/output-pipeline-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ spec:
name: output-pipeline
triggerRef:
type: manual
serviceAccount: 'default'
results:
logs:
name: 'logBucket'
type: 'gcs'
url: 'gcs://somebucket/results/logs'
resources:
- name: first-create-file
inputs:
Expand Down
8 changes: 6 additions & 2 deletions examples/run/pipeline-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@ metadata:
spec:
pipelineRef:
name: demo-pipeline
pipelineParamsRef:
name: pipelineparams-sample
triggerRef:
type: manual
serviceAccount: 'default'
results:
logs:
name: 'logBucket'
type: 'gcs'
url: 'gcs://somebucket/results/logs'
resources:
- name: build-skaffold-web
inputs:
Expand Down
7 changes: 0 additions & 7 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,8 @@ const (

// Results tells a pipeline where to persist the results of runnign the pipeline.
type Results struct {
// Runs is used to store the yaml/json of TaskRuns and PipelineRuns.
Runs ResultTarget `json:"runs"`

// Logs will store all logs output from running a task.
Logs ResultTarget `json:"logs"`

// Tests will store test results, if a task provides them.
// +optional
Tests *ResultTarget `json:"tests,omitempty"`
}

// ResultTarget is used to identify an endpoint where results can be uploaded. The
Expand Down
18 changes: 0 additions & 18 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,31 +45,13 @@ func (ps *PipelineRunSpec) Validate() *apis.FieldError {
}

if ps.Results != nil {
// Results.Runs should have a valid URL and ResultTargetType
if err := validateURL(ps.Results.Runs.URL, "pipelinerun.spec.Results.Runs.URL"); err != nil {
return err
}
if err := validateResultTargetType(ps.Results.Runs.Type, "pipelinerun.spec.Results.Runs.Type"); err != nil {
return err
}

// Results.Logs should have a valid URL and ResultTargetType
if err := validateURL(ps.Results.Logs.URL, "pipelinerun.spec.Results.Logs.URL"); err != nil {
return err
}
if err := validateResultTargetType(ps.Results.Logs.Type, "pipelinerun.spec.Results.Logs.Type"); err != nil {
return err
}

// If Results.Tests exists, it should have a valid URL and ResultTargetType
if ps.Results.Tests != nil {
if err := validateURL(ps.Results.Tests.URL, "pipelinerun.spec.Results.Tests.URL"); err != nil {
return err
}
if err := validateResultTargetType(ps.Results.Tests.Type, "pipelinerun.spec.Results.Tests.Type"); err != nil {
return err
}
}
}

return nil
Expand Down
6 changes: 2 additions & 4 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,15 @@ func TestPipelineRun_Invalidate(t *testing.T) {
Type: PipelineTriggerTypeManual,
},
Results: &Results{
Runs: ResultTarget{
Logs: ResultTarget{
Name: "runs",
URL: "badurl",
Type: "gcs",
},
Logs: validResultTarget("logs"),
},
},
},
want: apis.ErrInvalidValue("badurl", "pipelinerun.spec.Results.Runs.URL"),
want: apis.ErrInvalidValue("badurl", "pipelinerun.spec.Results.Logs.URL"),
},
}

Expand All @@ -137,7 +136,6 @@ func TestPipelineRun_Validate(t *testing.T) {
Type: "manual",
},
Results: &Results{
Runs: validResultTarget("runs"),
Logs: validResultTarget("logs"),
},
},
Expand Down
6 changes: 0 additions & 6 deletions pkg/apis/pipeline/v1alpha1/taskrun_validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,6 @@ func (r *Results) Validate(path string) *apis.FieldError {
if err := r.Logs.Validate(fmt.Sprintf("%s.logs", path)); err != nil {
return err
}
if err := r.Runs.Validate(fmt.Sprintf("%s.runs", path)); err != nil {
return err
}
if r.Tests != nil {
return r.Tests.Validate(fmt.Sprintf("%s.tests", path))
}
return nil
}

Expand Down
26 changes: 8 additions & 18 deletions pkg/apis/pipeline/v1alpha1/taskrun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,43 +310,43 @@ func TestResult_Invalidate(t *testing.T) {
{
name: "invalid task type result",
result: &Results{
Runs: ResultTarget{
Logs: ResultTarget{
Name: "resultlogs",
Type: "wrongtype",
},
},
wantErr: apis.ErrInvalidValue("wrongtype", "spec.results.runs.Type"),
wantErr: apis.ErrInvalidValue("wrongtype", "spec.results.logs.Type"),
},
{
name: "invalid task type result name",
result: &Results{
Runs: ResultTarget{
Logs: ResultTarget{
Name: "",
Type: ResultTargetTypeGCS,
},
},
wantErr: apis.ErrMissingField("spec.results.runs.name"),
wantErr: apis.ErrMissingField("spec.results.logs.name"),
},
{
name: "invalid task type result url",
result: &Results{
Runs: ResultTarget{
Logs: ResultTarget{
Name: "resultrunname",
Type: ResultTargetTypeGCS,
URL: "",
},
},
wantErr: apis.ErrMissingField("spec.results.runs.URL"),
wantErr: apis.ErrMissingField("spec.results.logs.URL"),
},
{
name: "invalid task type result url",
result: &Results{
Tests: &ResultTarget{
Logs: ResultTarget{
Name: "resultrunname",
Type: "badtype",
},
},
wantErr: apis.ErrInvalidValue("badtype", "spec.results.tests.Type"),
wantErr: apis.ErrInvalidValue("badtype", "spec.results.logs.Type"),
},
}

Expand All @@ -362,21 +362,11 @@ func TestResult_Invalidate(t *testing.T) {

func TestResultTarget_Validate(t *testing.T) {
rs := &Results{
Runs: ResultTarget{
Name: "testname",
Type: ResultTargetTypeGCS,
URL: "http://github.com",
},
Logs: ResultTarget{
Name: "testname",
Type: ResultTargetTypeGCS,
URL: "http://github.com",
},
Tests: &ResultTarget{
Name: "testname",
Type: ResultTargetTypeGCS,
URL: "http://github.com",
},
}
if err := rs.Validate("spec.results"); err != nil {
t.Errorf("ResultTarget.Validate() error = %v", err)
Expand Down
14 changes: 2 additions & 12 deletions 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 ec91ca6

Please sign in to comment.