fix remote status on build completion
This commit is contained in:
parent
78bf2eca1c
commit
0f13620d66
1 changed files with 17 additions and 0 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
|
@ -386,6 +387,22 @@ func (s *RPC) Done(c context.Context, id string, state rpc.State) error {
|
||||||
if err := s.store.UpdateBuild(build); err != nil {
|
if err := s.store.UpdateBuild(build); err != nil {
|
||||||
log.Printf("error: done: cannot update build_id %d final state: %s", build.ID, err)
|
log.Printf("error: done: cannot update build_id %d final state: %s", build.ID, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update the status
|
||||||
|
user, err := s.store.GetUser(repo.UserID)
|
||||||
|
if err == nil {
|
||||||
|
if refresher, ok := s.remote.(remote.Refresher); ok {
|
||||||
|
ok, _ := refresher.Refresh(user)
|
||||||
|
if ok {
|
||||||
|
s.store.UpdateUser(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
uri := fmt.Sprintf("%s/%s/%d", s.host, repo.FullName, build.Number)
|
||||||
|
err = s.remote.Status(user, repo, build, uri)
|
||||||
|
if err != nil {
|
||||||
|
logrus.Errorf("error setting commit status for %s/%d", repo.FullName, build.Number)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.logger.Close(c, id); err != nil {
|
if err := s.logger.Close(c, id); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue