Skip to content

Commit

Permalink
WIP add buildrun results list under status
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1queee committed May 26, 2021
1 parent 100d81d commit 78c7a32
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 8 deletions.
20 changes: 12 additions & 8 deletions deploy/crds/shipwright.io_buildruns.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -361,18 +361,22 @@ spec:
for executing this BuildRun. \n TODO: This should be called something
like \"TaskRunName\""
type: string
reason:
description: "The Succeeded reason of the TaskRun \n Deprecated: Use
Conditions instead. This will be removed in a future release."
type: string
results:
items:
properties:
name:
type: string
value:
type: string
required:
- name
- value
type: object
type: array
startTime:
description: StartTime is the time the build is actually started.
format: date-time
type: string
succeeded:
description: "The Succeeded status of the TaskRun \n Deprecated: Use
Conditions instead. This will be removed in a future release."
type: string
type: object
type: object
served: true
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/build/v1alpha1/buildrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ type BuildRunStatus struct {
// +optional
LatestTaskRunRef *string `json:"latestTaskRunRef,omitempty"`

BuildResults []BuildResult `json:"results,omitempty"`

// StartTime is the time the build is actually started.
// +optional
StartTime *metav1.Time `json:"startTime,omitempty"`
Expand All @@ -71,6 +73,11 @@ type BuildRunStatus struct {
FailedAt *FailedAt `json:"failedAt,omitempty"`
}

type BuildResult struct {
Name string `json:"name"`
Value string `json:"value"`
}

// FailedAt describes the location where the failure happened
type FailedAt struct {
Pod string `json:"pod,omitempty"`
Expand Down
21 changes: 21 additions & 0 deletions pkg/apis/build/v1alpha1/zz_generated.deepcopy.go

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

7 changes: 7 additions & 0 deletions pkg/reconciler/buildrun/buildrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,13 @@ func (r *ReconcileBuildRun) Reconcile(request reconcile.Request) (reconcile.Resu
} else if apierrors.IsNotFound(err) {
return reconcile.Result{}, nil
}
// TODO: quick test
for _, r := range lastTaskRun.Status.TaskRunResults {
buildRun.Status.BuildResults = append(buildRun.Status.BuildResults, buildv1alpha1.BuildResult{
Name: r.Name,
Value: r.Value,
})
}

// Check if the BuildRun is already finished, this happens if the build controller is restarted.
// It then reconciles all TaskRuns. This is valuable if the build controller was down while the TaskRun
Expand Down

0 comments on commit 78c7a32

Please sign in to comment.