Skip to content

Commit

Permalink
use helper functions - MarkResource*
Browse files Browse the repository at this point in the history
Replace updating the conditions directly with the helper functions -
MarkResourceRunning and MarkRunning.

No functional change expected.
  • Loading branch information
pritidesai authored and tekton-robot committed Feb 16, 2022
1 parent 9e8e9ee commit 4ad8f33
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions pkg/reconciler/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,12 +324,7 @@ func (c *Reconciler) reconcile(ctx context.Context, pr *v1beta1.PipelineRun, get

// When pipeline run is pending, return to avoid creating the task
if pr.IsPending() {
pr.Status.SetCondition(&apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
Reason: ReasonPending,
Message: fmt.Sprintf("PipelineRun %q is pending", pr.Name),
})
pr.Status.MarkRunning(ReasonPending, fmt.Sprintf("PipelineRun %q is pending", pr.Name))
return nil
}

Expand Down Expand Up @@ -734,10 +729,7 @@ func (c *Reconciler) createTaskRun(ctx context.Context, rprt *resources.Resolved
// is a retry
addRetryHistory(tr)
clearStatus(tr)
tr.Status.SetCondition(&apis.Condition{
Type: apis.ConditionSucceeded,
Status: corev1.ConditionUnknown,
})
tr.Status.MarkResourceOngoing("", "")
logger.Infof("Updating taskrun %s with cleared status and retry history (length: %d).", tr.GetName(), len(tr.Status.RetriesStatus))
return c.PipelineClientSet.TektonV1beta1().TaskRuns(pr.Namespace).UpdateStatus(ctx, tr, metav1.UpdateOptions{})
}
Expand Down

0 comments on commit 4ad8f33

Please sign in to comment.