Skip to content

Commit

Permalink
Merge pull request #28 from scottferg/master
Browse files Browse the repository at this point in the history
Fixes for Github status reporting
  • Loading branch information
bradrydzewski committed Feb 10, 2014
2 parents 78839ec + 1e75162 commit 4e87075
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 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 Expand Up @@ -218,7 +222,7 @@ func updateGitHubStatus(repo *Repo, commit *Commit) error {
// get the user from the database
// since we need his / her GitHub token
user, err := database.GetUser(repo.UserID)
if err == nil {
if err != nil {
return err
}

Expand Down

0 comments on commit 4e87075

Please sign in to comment.