Skip to content

Commit

Permalink
fix build uncorrect status
Browse files Browse the repository at this point in the history
Signed-off-by: Zou Nengren <[email protected]>
  • Loading branch information
zouyee authored and tekton-robot committed May 13, 2019
1 parent e0cfab8 commit 75d6dab
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pkg/reconciler/v1alpha1/pipelinerun/pipelinerun.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ type configStore interface {
// Reconciler implements controller.Reconciler for Configuration resources.
type Reconciler struct {
*reconciler.Base

// listers index properties about resources
pipelineRunLister listers.PipelineRunLister
pipelineLister listers.PipelineLister
Expand Down Expand Up @@ -170,6 +169,11 @@ func (c *Reconciler) Reconcile(ctx context.Context, key string) error {
pr := original.DeepCopy()
if !pr.HasStarted() {
pr.Status.InitializeConditions()
// In case node time was not synchronized, when controller has been scheduled to other nodes.
if pr.Status.StartTime.Sub(pr.CreationTimestamp.Time) < 0 {
c.Logger.Warnf("PipelineRun %s createTimestamp %s is after the pipelineRun started %s", pr.GetRunKey(), pr.CreationTimestamp, pr.Status.StartTime)
pr.Status.StartTime = &pr.CreationTimestamp
}
// start goroutine to track pipelinerun timeout only startTime is not set
go c.timeoutHandler.WaitPipelineRun(pr, pr.Status.StartTime)
} else {
Expand Down
5 changes: 5 additions & 0 deletions pkg/reconciler/v1alpha1/taskrun/taskrun.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,11 @@ func (c *Reconciler) Reconcile(ctx context.Context, key string) error {
// If the TaskRun is just starting, this will also set the starttime,
// from which the timeout will immediately begin counting down.
tr.Status.InitializeConditions()
// In case node time was not synchronized, when controller has been scheduled to other nodes.
if tr.Status.StartTime.Sub(tr.CreationTimestamp.Time) < 0 {
c.Logger.Warnf("TaskRun %s createTimestamp %s is after the taskRun started %s", tr.GetRunKey(), tr.CreationTimestamp, tr.Status.StartTime)
tr.Status.StartTime = &tr.CreationTimestamp
}

if tr.IsDone() {
c.timeoutHandler.Release(tr)
Expand Down

0 comments on commit 75d6dab

Please sign in to comment.