Skip to content

Commit

Permalink
Set "startAt" in skip case
Browse files Browse the repository at this point in the history
Fix issue: #2416

The root cause is in skipped case, entrypoint do not write startedAt to Termination file.
That's means when reconcile of taskrun try to update startedAt, they found nothing, and the result is the startedAt will keep as the startedAt in pod.
  • Loading branch information
vincent-pli authored and tekton-robot committed Apr 20, 2020
1 parent fd71f69 commit 9344e4f
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions pkg/entrypoint/entrypointer.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,15 +82,25 @@ type PostWriter interface {
func (e Entrypointer) Go() error {
prod, _ := zap.NewProduction()
logger := prod.Sugar()

output := []v1alpha1.PipelineResourceResult{}
defer func() {
if wErr := termination.WriteMessage(e.TerminationPath, output); wErr != nil {
logger.Fatalf("Error while writing message: %s", wErr)
}
_ = logger.Sync()
}()
output := []v1alpha1.PipelineResourceResult{}

for _, f := range e.WaitFiles {
if err := e.Waiter.Wait(f, e.WaitFileContent); err != nil {
// An error happened while waiting, so we bail
// *but* we write postfile to make next steps bail too.
e.WritePostFile(e.PostFile, err)
output = append(output, v1alpha1.PipelineResourceResult{
Key: "StartedAt",
Value: time.Now().Format(time.RFC3339),
})

return err
}
}
Expand All @@ -115,9 +125,7 @@ func (e Entrypointer) Go() error {
logger.Fatalf("Error while handling results: %s", err)
}
}
if wErr := termination.WriteMessage(e.TerminationPath, output); wErr != nil {
logger.Fatalf("Error while writing message: %s", wErr)
}

return err
}

Expand Down

0 comments on commit 9344e4f

Please sign in to comment.