dashboard/coordinator: clean up trailer handling

This got lost before in my git stash stack.

Change-Id: Id73cdb89e73ab83c26971c6c1c4e0fc74d91018f
Reviewed-on: https://go-review.googlesource.com/2521
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Brad Fitzpatrick 2015-01-07 19:49:00 -08:00
parent 47646d42a2
commit d77725735e
1 changed files with 13 additions and 12 deletions

View File

@ -1013,26 +1013,27 @@ OpLoop:
return fmt.Errorf("error copying response: %v", err)
}
st.logEventTime("done")
state := res.Trailer.Get("Process-State")
// Don't record to the dashboard unless we heard the trailer from
// the buildlet, otherwise it was probably some unrelated error
// (like the VM being killed, or the buildlet crashing due to
// e.g. https://golang.org/issue/9309, since we require a tip
// build of the buildlet to get Trailers support)
if state != "" {
conf := builders[st.name]
var log string
if state != "ok" {
log = st.logs()
}
if err := conf.recordResult(state == "ok", st.rev, log, time.Since(execStartTime)); err != nil {
return fmt.Errorf("Status was %q but failed to report it to the dashboard: %v", state, err)
}
state := res.Trailer.Get("Process-State")
if state == "" {
return errors.New("missing Process-State trailer from HTTP response; buildlet built with old (<= 1.4) Go?")
}
conf := builders[st.name]
var log string
if state != "ok" {
log = st.logs()
}
if err := conf.recordResult(state == "ok", st.rev, log, time.Since(execStartTime)); err != nil {
return fmt.Errorf("Status was %q but failed to report it to the dashboard: %v", state, err)
}
if state != "ok" {
return fmt.Errorf("got Trailer process state %q", state)
return fmt.Errorf("%s failed: %v", cmd, state)
}
return nil
}