From 1e75162bc80bd826ab74d9b336bfdd38a01bef91 Mon Sep 17 00:00:00 2001 From: Scott Ferguson Date: Sun, 9 Feb 2014 19:06:16 -0600 Subject: [PATCH] Defer updateGitHubStatus so that it reports errors that occur before the build begins --- pkg/queue/queue.go | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/pkg/queue/queue.go b/pkg/queue/queue.go index a8e9cbc1..5d9a9e61 100644 --- a/pkg/queue/queue.go +++ b/pkg/queue/queue.go @@ -12,6 +12,7 @@ import ( "github.com/drone/drone/pkg/mail" . "github.com/drone/drone/pkg/model" "github.com/drone/go-github/github" + "log" "path/filepath" "time" ) @@ -134,6 +135,15 @@ func (b *BuildTask) execute() error { builder.Key = []byte(b.Repo.PrivateKey) builder.Stdout = buf builder.Timeout = 300 * time.Minute + + defer func() { + // update the status of the commit using the + // GitHub status API. + if err := updateGitHubStatus(b.Repo, b.Commit); err != nil { + log.Printf("error updating github status: %s\n", err.Error()) + } + }() + buildErr := builder.Run() b.Build.Finished = time.Now().UTC() @@ -181,12 +191,6 @@ func (b *BuildTask) execute() error { b.Script.Notifications.Send(context) } - // update the status of the commit using the - // GitHub status API. - if err := updateGitHubStatus(b.Repo, b.Commit); err != nil { - return err - } - return nil }