Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for Github status reporting #28

Merged
merged 2 commits into from
Feb 10, 2014
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Defer updateGitHubStatus so that it reports errors that occur before …
…the build begins
  • Loading branch information
scottferg committed Feb 10, 2014
commit 1e75162bc80bd826ab74d9b336bfdd38a01bef91
16 changes: 10 additions & 6 deletions pkg/queue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
}

Expand Down