Skip to content

Commit

Permalink
Port TaskResults and TaskRunResults to v1alpha2 🎋
Browse files Browse the repository at this point in the history
Signed-off-by: Vincent Demeester <vdemeest@redhat.com>
  • Loading branch information
vdemeester authored and tekton-robot committed Jan 27, 2020
1 parent 70b58e2 commit d6dd94e
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 31 deletions.
9 changes: 1 addition & 8 deletions pkg/apis/pipeline/v1alpha1/task_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,7 @@ type TaskSpec struct {
}

// TaskResult used to describe the results of a task
type TaskResult struct {
// Name the given name
Name string `json:"name"`

// Description is a human-readable description of the result
// +optional
Description string `json:"description"`
}
type TaskResult = v1alpha2.TaskResult

// Step embeds the Container type, which allows it to include fields not
// provided by Container.
Expand Down
18 changes: 1 addition & 17 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.

13 changes: 13 additions & 0 deletions pkg/apis/pipeline/v1alpha2/task_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@ type TaskSpec struct {

// Workspaces are the volumes that this Task requires.
Workspaces []WorkspaceDeclaration

// Results are values that this Task can output
Results []TaskResult `json:"results,omitempty"`
}

// TaskResult used to describe the results of a task
type TaskResult struct {
// Name the given name
Name string `json:"name"`

// Description is a human-readable description of the result
// +optional
Description string `json:"description"`
}

// Step embeds the Container type, which allows it to include fields not
Expand Down
24 changes: 23 additions & 1 deletion pkg/apis/pipeline/v1alpha2/taskrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,14 @@ var taskRunCondSet = apis.NewBatchConditionSet()
type TaskRunStatus struct {
duckv1beta1.Status `json:",inline"`

// TaskRunStatusFields inlines the status fields.
TaskRunStatusFields `json:",inline"`
}

// TaskRunStatusFields holds the fields of TaskRun's status. This is defined
// separately and inlined so that other types can readily consume these fields
// via duck typing.
type TaskRunStatusFields struct {
// PodName is the name of the pod responsible for executing this task's steps.
PodName string `json:"podName"`

Expand All @@ -121,16 +129,30 @@ type TaskRunStatus struct {
// All TaskRunStatus stored in RetriesStatus will have no date within the RetriesStatus as is redundant.
// +optional
RetriesStatus []TaskRunStatus `json:"retriesStatus,omitempty"`

// Results from Resources built during the taskRun. currently includes
// the digest of build container images
// optional
// +optional
ResourcesResult []PipelineResourceResult `json:"resourcesResult,omitempty"`

// TaskRunResults are the list of results written out by the task's containers
// +optional
TaskRunResults []TaskRunResult `json:"taskResults,omitempty"`

// The list has one entry per sidecar in the manifest. Each entry is
// represents the imageid of the corresponding sidecar.
Sidecars []SidecarState `json:"sidecars,omitempty"`
}

// TaskRunResult used to describe the results of a task
type TaskRunResult struct {
// Name the given name
Name string `json:"name"`

// Value the given value of the result
Value string `json:"value"`
}

// GetCondition returns the Condition matching the given type.
func (tr *TaskRunStatus) GetCondition(t apis.ConditionType) *apis.Condition {
return taskRunCondSet.Manage(tr).GetCondition(t)
Expand Down
8 changes: 6 additions & 2 deletions pkg/apis/pipeline/v1alpha2/taskrun_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,17 @@ func TestTaskRunHasStarted(t *testing.T) {
}, {
name: "trWithStartTime",
trStatus: v1alpha2.TaskRunStatus{
StartTime: &metav1.Time{Time: time.Now()},
TaskRunStatusFields: v1alpha2.TaskRunStatusFields{
StartTime: &metav1.Time{Time: time.Now()},
},
},
expectedValue: true,
}, {
name: "trWithZeroStartTime",
trStatus: v1alpha2.TaskRunStatus{
StartTime: &metav1.Time{},
TaskRunStatusFields: v1alpha2.TaskRunStatusFields{
StartTime: &metav1.Time{},
},
},
expectedValue: false,
}}
Expand Down
65 changes: 62 additions & 3 deletions pkg/apis/pipeline/v1alpha2/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 d6dd94e

Please sign in to comment.