mirror of
https://github.com/golang/go
synced 2024-11-13 16:00:21 -07:00
builder: send commit time to dashboard
R=golang-dev, bradfitz CC=golang-dev https://golang.org/cl/5489084
This commit is contained in:
parent
0b28de9a05
commit
9b3799aa89
@ -8,10 +8,12 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type obj map[string]interface{}
|
type obj map[string]interface{}
|
||||||
@ -147,20 +149,19 @@ func (b *Builder) updatePackage(pkg string, ok bool, buildLog, info string) erro
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
func postCommit(key, pkg string, l *HgLog) bool {
|
func postCommit(key, pkg string, l *HgLog) error {
|
||||||
err := dash("POST", "commit", url.Values{"key": {key}}, obj{
|
t, err := time.Parse(time.RFC3339, l.Date)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("parsing %q: %v", l.Date, t)
|
||||||
|
}
|
||||||
|
return dash("POST", "commit", url.Values{"key": {key}}, obj{
|
||||||
"PackagePath": pkg,
|
"PackagePath": pkg,
|
||||||
"Hash": l.Hash,
|
"Hash": l.Hash,
|
||||||
"ParentHash": l.Parent,
|
"ParentHash": l.Parent,
|
||||||
// TODO(adg): l.Date as int64 unix epoch secs in Time field
|
"Time": t.Unix() * 1e6, // in microseconds, yuck!
|
||||||
"User": l.Author,
|
"User": l.Author,
|
||||||
"Desc": l.Desc,
|
"Desc": l.Desc,
|
||||||
}, nil)
|
}, nil)
|
||||||
if err != nil {
|
|
||||||
log.Printf("failed to add %s to dashboard: %v", key, err)
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func dashboardCommit(pkg, hash string) bool {
|
func dashboardCommit(pkg, hash string) bool {
|
||||||
|
@ -536,7 +536,7 @@ const xmlLogTemplate = `
|
|||||||
<hash>{node|escape}</hash>
|
<hash>{node|escape}</hash>
|
||||||
<parent>{parent|escape}</parent>
|
<parent>{parent|escape}</parent>
|
||||||
<author>{author|escape}</author>
|
<author>{author|escape}</author>
|
||||||
<date>{date}</date>
|
<date>{date|rfc3339date}</date>
|
||||||
<desc>{desc|escape}</desc>
|
<desc>{desc|escape}</desc>
|
||||||
</log>
|
</log>
|
||||||
`
|
`
|
||||||
@ -652,7 +652,11 @@ func addCommit(pkg, hash, key string) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create commit.
|
// Create commit.
|
||||||
return postCommit(key, pkg, l)
|
if err := postCommit(key, pkg, l); err != nil {
|
||||||
|
log.Printf("failed to add %s to dashboard: %v", key, err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// fullHash returns the full hash for the given Mercurial revision.
|
// fullHash returns the full hash for the given Mercurial revision.
|
||||||
|
Loading…
Reference in New Issue
Block a user