Skip to content

Commit

Permalink
Merge pull request #674 from ImJasonH/deprecate
Browse files Browse the repository at this point in the history
Deprecate .status.succeeded and .status.reason
  • Loading branch information
openshift-merge-robot authored Mar 19, 2021
2 parents c3cbe9d + 14bbf84 commit 33cf526
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pkg/apis/build/v1alpha1/buildrun_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,19 +45,27 @@ type BuildRunSpec struct {

// BuildRunStatus defines the observed state of BuildRun
type BuildRunStatus struct {

// Conditions
// Conditions holds the latest available observations of a resource's current state.
Conditions Conditions `json:"conditions,omitempty"`

// The Succeeded status of the TaskRun
//
// Deprecated: Use Conditions instead. This will be removed in a future release.
//
// +optional
Succeeded corev1.ConditionStatus `json:"succeeded,omitempty"`

// The Succeeded reason of the TaskRun
//
// Deprecated: Use Conditions instead. This will be removed in a future release.
//
// +optional
Reason string `json:"reason,omitempty"`

// PodName is the name of the pod responsible for executing this task's steps.
// LatestTaskRunRef is the name of the TaskRun responsible for executing this BuildRun.
//
// TODO: This should be called something like "TaskRunName"
//
// +optional
LatestTaskRunRef *string `json:"latestTaskRunRef,omitempty"`

Expand Down
5 changes: 5 additions & 0 deletions pkg/reconciler/buildrun/buildrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,13 @@ func (r *ReconcileBuildRun) Reconcile(request reconcile.Request) (reconcile.Resu
}
}

//lint:ignore SA1019 should be set until removed
buildRun.Status.Succeeded = taskRunStatus
if taskRunStatus == corev1.ConditionFalse {
//lint:ignore SA1019 should be set until removed
buildRun.Status.Reason = trCondition.Message
} else {
//lint:ignore SA1019 should be set until removed
buildRun.Status.Reason = trCondition.Reason
}

Expand Down Expand Up @@ -380,7 +383,9 @@ func (r *ReconcileBuildRun) createTaskRun(ctx context.Context, build *buildv1alp
// updateBuildRunErrorStatus updates buildRun status fields
func (r *ReconcileBuildRun) updateBuildRunErrorStatus(ctx context.Context, buildRun *buildv1alpha1.BuildRun, errorMessage string) error {
// these two fields are deprecated and will be removed soon
//lint:ignore SA1019 should be set until removed
buildRun.Status.Succeeded = corev1.ConditionFalse
//lint:ignore SA1019 should be set until removed
buildRun.Status.Reason = errorMessage

now := metav1.Now()
Expand Down

0 comments on commit 33cf526

Please sign in to comment.