maintner/maintnerd: return TRY= comment directives in Run-TryBot votes

For slowbots support.

Updates golang/go#34501

Change-Id: I6f8a8b187c3ce4531498f106d62e29e1d1f421d8
Reviewed-on: https://go-review.googlesource.com/c/build/+/201204
Reviewed-by: Ian Lance Taylor <iant@golang.org>
This commit is contained in:
Brad Fitzpatrick 2019-10-15 19:25:05 +00:00
Родитель 4e9e211aa5
Коммит e7b8bbcf25
4 изменённых файлов: 217 добавлений и 66 удалений

Просмотреть файл

@ -15,6 +15,7 @@ It has these top-level messages:
GoFindTryWorkRequest
GoFindTryWorkResponse
GerritTryWorkItem
TryVoteMessage
MajorMinor
ListGoReleasesRequest
ListGoReleasesResponse
@ -184,6 +185,7 @@ type GerritTryWorkItem struct {
Branch string `protobuf:"bytes,2,opt,name=branch" json:"branch,omitempty"`
ChangeId string `protobuf:"bytes,3,opt,name=change_id,json=changeId" json:"change_id,omitempty"`
Commit string `protobuf:"bytes,4,opt,name=commit" json:"commit,omitempty"`
Version int32 `protobuf:"varint,9,opt,name=version" json:"version,omitempty"`
// go_commit is set for subrepos and is the Go commit(s) to test against.
// go_branch is a branch name of go_commit, for showing to users when
// a try set fails.
@ -193,6 +195,8 @@ type GerritTryWorkItem struct {
// For Go repo, it contains exactly one element.
// For subrepos, it contains elements that correspond to go_commit.
GoVersion []*MajorMinor `protobuf:"bytes,7,rep,name=go_version,json=goVersion" json:"go_version,omitempty"`
// try_message is the list of TRY=xxxx messages associated with Run-TryBot votes.
TryMessage []*TryVoteMessage `protobuf:"bytes,8,rep,name=try_message,json=tryMessage" json:"try_message,omitempty"`
}
func (m *GerritTryWorkItem) Reset() { *m = GerritTryWorkItem{} }
@ -228,6 +232,13 @@ func (m *GerritTryWorkItem) GetCommit() string {
return ""
}
func (m *GerritTryWorkItem) GetVersion() int32 {
if m != nil {
return m.Version
}
return 0
}
func (m *GerritTryWorkItem) GetGoCommit() []string {
if m != nil {
return m.GoCommit
@ -249,6 +260,45 @@ func (m *GerritTryWorkItem) GetGoVersion() []*MajorMinor {
return nil
}
func (m *GerritTryWorkItem) GetTryMessage() []*TryVoteMessage {
if m != nil {
return m.TryMessage
}
return nil
}
type TryVoteMessage struct {
Message string `protobuf:"bytes,1,opt,name=message" json:"message,omitempty"`
AuthorId int64 `protobuf:"varint,2,opt,name=author_id,json=authorId" json:"author_id,omitempty"`
Version int32 `protobuf:"varint,3,opt,name=version" json:"version,omitempty"`
}
func (m *TryVoteMessage) Reset() { *m = TryVoteMessage{} }
func (m *TryVoteMessage) String() string { return proto.CompactTextString(m) }
func (*TryVoteMessage) ProtoMessage() {}
func (*TryVoteMessage) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (m *TryVoteMessage) GetMessage() string {
if m != nil {
return m.Message
}
return ""
}
func (m *TryVoteMessage) GetAuthorId() int64 {
if m != nil {
return m.AuthorId
}
return 0
}
func (m *TryVoteMessage) GetVersion() int32 {
if m != nil {
return m.Version
}
return 0
}
type MajorMinor struct {
Major int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"`
Minor int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"`
@ -257,7 +307,7 @@ type MajorMinor struct {
func (m *MajorMinor) Reset() { *m = MajorMinor{} }
func (m *MajorMinor) String() string { return proto.CompactTextString(m) }
func (*MajorMinor) ProtoMessage() {}
func (*MajorMinor) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
func (*MajorMinor) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (m *MajorMinor) GetMajor() int32 {
if m != nil {
@ -279,7 +329,7 @@ type ListGoReleasesRequest struct {
func (m *ListGoReleasesRequest) Reset() { *m = ListGoReleasesRequest{} }
func (m *ListGoReleasesRequest) String() string { return proto.CompactTextString(m) }
func (*ListGoReleasesRequest) ProtoMessage() {}
func (*ListGoReleasesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} }
func (*ListGoReleasesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
type ListGoReleasesResponse struct {
Releases []*GoRelease `protobuf:"bytes,1,rep,name=releases" json:"releases,omitempty"`
@ -288,7 +338,7 @@ type ListGoReleasesResponse struct {
func (m *ListGoReleasesResponse) Reset() { *m = ListGoReleasesResponse{} }
func (m *ListGoReleasesResponse) String() string { return proto.CompactTextString(m) }
func (*ListGoReleasesResponse) ProtoMessage() {}
func (*ListGoReleasesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} }
func (*ListGoReleasesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (m *ListGoReleasesResponse) GetReleases() []*GoRelease {
if m != nil {
@ -311,7 +361,7 @@ type GoRelease struct {
func (m *GoRelease) Reset() { *m = GoRelease{} }
func (m *GoRelease) String() string { return proto.CompactTextString(m) }
func (*GoRelease) ProtoMessage() {}
func (*GoRelease) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} }
func (*GoRelease) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func (m *GoRelease) GetMajor() int32 {
if m != nil {
@ -370,6 +420,7 @@ func init() {
proto.RegisterType((*GoFindTryWorkRequest)(nil), "apipb.GoFindTryWorkRequest")
proto.RegisterType((*GoFindTryWorkResponse)(nil), "apipb.GoFindTryWorkResponse")
proto.RegisterType((*GerritTryWorkItem)(nil), "apipb.GerritTryWorkItem")
proto.RegisterType((*TryVoteMessage)(nil), "apipb.TryVoteMessage")
proto.RegisterType((*MajorMinor)(nil), "apipb.MajorMinor")
proto.RegisterType((*ListGoReleasesRequest)(nil), "apipb.ListGoReleasesRequest")
proto.RegisterType((*ListGoReleasesResponse)(nil), "apipb.ListGoReleasesResponse")
@ -578,44 +629,49 @@ var _MaintnerService_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("api.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{
// 624 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdf, 0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b4, 0xa7, 0x2e, 0x3b, 0x5e, 0xb9, 0x85, 0xa2, 0xdb, 0x7b, 0xe8, 0xcf,
0x5c, 0x0c, 0x59, 0xaf, 0xb7, 0x71, 0xf7, 0x00, 0xe3, 0x47, 0xf7, 0x93, 0x18, 0x6b, 0x04, 0x0b,
0xb3, 0x4b, 0x27, 0x41, 0x7f, 0xef, 0x23, 0x89, 0x37, 0xfe, 0xc2, 0xfa, 0x70, 0x27, 0x6d, 0xf7,
0x57, 0x7d, 0xf1, 0x27, 0x00, 0x00, 0xff, 0xff, 0xad, 0x6d, 0xbd, 0x4e, 0x62, 0x05, 0x00, 0x00,
// 700 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdb, 0x4e, 0x1b, 0x31,
0x10, 0x55, 0x92, 0xe6, 0x36, 0x21, 0x29, 0xb8, 0x84, 0x2e, 0xa1, 0x08, 0xba, 0xa8, 0x15, 0x0f,
0x15, 0xaa, 0xa8, 0x7a, 0x79, 0xed, 0x45, 0x04, 0xda, 0xa6, 0xaa, 0x16, 0x44, 0x1f, 0x57, 0x26,
0x71, 0x36, 0x0b, 0xac, 0xbd, 0xb5, 0x1d, 0x50, 0x3e, 0xa9, 0x7f, 0xd0, 0x9f, 0xe8, 0x3f, 0x55,
0xb6, 0xc7, 0x4b, 0x02, 0xf4, 0xa1, 0x6f, 0x3b, 0xe7, 0xcc, 0x1c, 0x8f, 0xc7, 0xc7, 0x5e, 0x68,
0xd2, 0x3c, 0xdd, 0xcb, 0xa5, 0xd0, 0x82, 0x54, 0x69, 0x9e, 0xe6, 0x67, 0xe1, 0x21, 0x90, 0x43,
0xaa, 0xde, 0xf3, 0x21, 0x53, 0x5a, 0xc8, 0x88, 0xfd, 0x9c, 0x32, 0xa5, 0xc9, 0x1a, 0xd4, 0x86,
0x22, 0xcb, 0x52, 0x1d, 0x94, 0xb6, 0x4b, 0xbb, 0xcd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, 0x92, 0xde, 0xe6, 0x3f, 0x58, 0x27, 0x77, 0x56, 0xb3, 0xbf, 0x82, 0x57, 0x7f, 0x03,
0x00, 0x00, 0xff, 0xff, 0x0d, 0x79, 0xa6, 0xa3, 0x17, 0x06, 0x00, 0x00,
}

Просмотреть файл

@ -55,6 +55,8 @@ message GerritTryWorkItem {
string change_id = 3; // "I1a27695838409259d1586a0adfa9f92bccf7ceba"
string commit = 4; // "ecf3dffc81dc21408fb02159af352651882a8383"
int32 version = 9; // which Gerrit revision number commit is
// go_commit is set for subrepos and is the Go commit(s) to test against.
// go_branch is a branch name of go_commit, for showing to users when
// a try set fails.
@ -65,6 +67,15 @@ message GerritTryWorkItem {
// For Go repo, it contains exactly one element.
// For subrepos, it contains elements that correspond to go_commit.
repeated MajorMinor go_version = 7;
// try_message is the list of TRY=xxxx messages associated with Run-TryBot votes.
repeated TryVoteMessage try_message = 8;
}
message TryVoteMessage {
string message = 1; // just the part after "TRY=" until end of line, without \n
int64 author_id = 2; // Gerrit-internal ID
int32 version = 3; // revision number comment was for
}
message MajorMinor {

Просмотреть файл

@ -10,7 +10,9 @@ import (
"errors"
"fmt"
"log"
"regexp"
"sort"
"strconv"
"strings"
"sync"
"time"
@ -95,13 +97,63 @@ func tryBotStatus(cl *maintner.GerritCL, forStaging bool) (try, done bool) {
return
}
func tryWorkItem(cl *maintner.GerritCL) *apipb.GerritTryWorkItem {
return &apipb.GerritTryWorkItem{
var (
tryCommentRx = regexp.MustCompile(`(?m)^TRY=(.*)$`)
patchSetRx = regexp.MustCompile(`^Patch Set (\d{1,4}):`)
)
func tryWorkItem(cl *maintner.GerritCL, ci *gerrit.ChangeInfo) *apipb.GerritTryWorkItem {
work := &apipb.GerritTryWorkItem{
Project: cl.Project.Project(),
Branch: strings.TrimPrefix(cl.Branch(), "refs/heads/"),
ChangeId: cl.ChangeID(),
Commit: cl.Commit.Hash.String(),
}
if ci != nil {
if ci.CurrentRevision != "" {
// In case maintner is behind.
work.Commit = ci.CurrentRevision
work.Version = int32(ci.Revisions[ci.CurrentRevision].PatchSetNumber)
}
// Also include any "TRY=foo" comments (just the "foo"
// aprt) from messages that accompany Run-TryBot+1
// votes.
for _, m := range ci.Messages {
// msg is like:
// "Patch Set 2: Run-TryBot+1\n\nTRY=foo2"
// "Patch Set 2: Run-TryBot+1 Code-Review-2"
// "Uploaded patch set 2."
// "Removed Run-TryBot+1 by Brad Fitzpatrick <bradfitz@golang.org>\n"
// "Patch Set 1: Run-TryBot+1\n\nTRY=baz"
msg := m.Message
if !strings.Contains(msg, "\n\nTRY=") ||
!strings.HasPrefix(msg, "Patch Set ") ||
!strings.Contains(firstLine(msg), "Run-TryBot+1") {
continue
}
pm := patchSetRx.FindStringSubmatch(msg)
var patchSet int
if pm != nil {
patchSet, _ = strconv.Atoi(pm[1])
}
if tm := tryCommentRx.FindStringSubmatch(msg); tm != nil && patchSet > 0 {
work.TryMessage = append(work.TryMessage, &apipb.TryVoteMessage{
Message: tm[1],
AuthorId: m.Author.NumericID,
Version: int32(patchSet),
})
}
}
}
return work
}
func firstLine(s string) string {
if nl := strings.Index(s, "\n"); nl < 0 {
return s
} else {
return s[:nl]
}
}
func (s apiService) GetRef(ctx context.Context, req *apipb.GetRefRequest) (*apipb.GetRefResponse, error) {
@ -160,16 +212,32 @@ func (s apiService) GoFindTryWork(ctx context.Context, req *apipb.GoFindTryWorkR
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
res, err := goFindTryWork(ctx, tryBotGerrit, s.c)
if err != nil {
log.Printf("maintnerd: goFindTryWork: %v", err)
return nil, err
}
tryCache.val = res
tryCache.forNumChanges = sumChanges
log.Printf("maintnerd: GetTryWork: for label changes of %d, cached %d trywork items.",
sumChanges, len(res.Waiting))
return res, nil
}
func goFindTryWork(ctx context.Context, gerritc *gerrit.Client, maintc *maintner.Corpus) (*apipb.GoFindTryWorkResponse, error) {
const query = "label:Run-TryBot=1 label:TryBot-Result=0 status:open"
cis, err := tryBotGerrit.QueryChanges(ctx, query, gerrit.QueryChangesOpt{
Fields: []string{"CURRENT_REVISION", "CURRENT_COMMIT"},
cis, err := gerritc.QueryChanges(ctx, query, gerrit.QueryChangesOpt{
Fields: []string{"CURRENT_REVISION", "CURRENT_COMMIT", "MESSAGES"},
})
if err != nil {
return nil, err
}
tryCache.forNumChanges = sumChanges
goProj := s.c.Gerrit().Project("go.googlesource.com", "go")
goProj := maintc.Gerrit().Project("go.googlesource.com", "go")
supportedReleases, err := supportedGoReleases(goProj)
if err != nil {
return nil, err
@ -177,16 +245,12 @@ func (s apiService) GoFindTryWork(ctx context.Context, req *apipb.GoFindTryWorkR
res := new(apipb.GoFindTryWorkResponse)
for _, ci := range cis {
cl := s.c.Gerrit().Project("go.googlesource.com", ci.Project).CL(int32(ci.ChangeNumber))
cl := maintc.Gerrit().Project("go.googlesource.com", ci.Project).CL(int32(ci.ChangeNumber))
if cl == nil {
log.Printf("nil Gerrit CL %v", ci.ChangeNumber)
continue
}
work := tryWorkItem(cl)
if ci.CurrentRevision != "" {
// In case maintner is behind.
work.Commit = ci.CurrentRevision
}
work := tryWorkItem(cl, ci)
if work.Project == "go" {
// Trybot on Go repo. Set the GoVersion field based on branch name.
if work.Branch == "master" {
@ -229,11 +293,6 @@ func (s apiService) GoFindTryWork(ctx context.Context, req *apipb.GoFindTryWorkR
sort.Slice(res.Waiting, func(i, j int) bool {
return res.Waiting[i].Commit < res.Waiting[j].Commit
})
tryCache.val = res
log.Printf("maintnerd: GetTryWork: for label changes of %d, cached %d trywork items.",
sumChanges, len(res.Waiting))
return res, nil
}

Просмотреть файл

@ -14,6 +14,7 @@ import (
"time"
"github.com/google/go-cmp/cmp"
"golang.org/x/build/gerrit"
"golang.org/x/build/maintner"
"golang.org/x/build/maintner/godata"
"golang.org/x/build/maintner/maintnerd/apipb"
@ -122,13 +123,37 @@ func TestTryWorkItem(t *testing.T) {
tests := []struct {
proj string
clnum int32
ci *gerrit.ChangeInfo
want string
}{
// Same Change-Id, different branch:
{"go", 51430, `project:"go" branch:"master" change_id:"I0bcae339624e7d61037d9ea0885b7bd07491bbb6" commit:"45a4609c0ae214e448612e0bc0846e2f2682f1b2" `},
{"go", 51450, `project:"go" branch:"release-branch.go1.9" change_id:"I0bcae339624e7d61037d9ea0885b7bd07491bbb6" commit:"7320506bc58d3a55eff2c67b2ec65cfa94f7b0a7" `},
{"go", 51430, nil, `project:"go" branch:"master" change_id:"I0bcae339624e7d61037d9ea0885b7bd07491bbb6" commit:"45a4609c0ae214e448612e0bc0846e2f2682f1b2" `},
{"go", 51450, nil, `project:"go" branch:"release-branch.go1.9" change_id:"I0bcae339624e7d61037d9ea0885b7bd07491bbb6" commit:"7320506bc58d3a55eff2c67b2ec65cfa94f7b0a7" `},
// Different project:
{"build", 51432, `project:"build" branch:"master" change_id:"I1f71836da7008e58d3e76e2cc3170e96cd57ddf6" commit:"9251bc9950baff61d95da0761e2e4bfab61ed210" `},
{"build", 51432, nil, `project:"build" branch:"master" change_id:"I1f71836da7008e58d3e76e2cc3170e96cd57ddf6" commit:"9251bc9950baff61d95da0761e2e4bfab61ed210" `},
// With comments:
{
proj: "go",
clnum: 201203,
ci: &gerrit.ChangeInfo{
CurrentRevision: "f99d33e72efdea68fce39765bc94479b5ebed0a9",
Revisions: map[string]gerrit.RevisionInfo{
"f99d33e72efdea68fce39765bc94479b5ebed0a9": {PatchSetNumber: 88},
},
Messages: []gerrit.ChangeMessageInfo{
{
Author: &gerrit.AccountInfo{NumericID: 1234},
Message: "Patch Set 1: Run-TryBot+1\n\nTRY=foo",
},
{
Author: &gerrit.AccountInfo{NumericID: 5678},
Message: "Patch Set 2: Foo-2 Run-TryBot+1\n\nTRY=bar",
},
},
},
want: `project:"go" branch:"master" change_id:"I358eb7b11768df8c80fb7e805abd4cd01d52bb9b" commit:"f99d33e72efdea68fce39765bc94479b5ebed0a9" version:88 try_message:<message:"foo" author_id:1234 version:1 > try_message:<message:"bar" author_id:5678 version:2 > `,
},
}
for _, tt := range tests {
cl := c.Gerrit().Project("go.googlesource.com", tt.proj).CL(tt.clnum)
@ -136,9 +161,9 @@ func TestTryWorkItem(t *testing.T) {
t.Errorf("CL %d in %s not found", tt.clnum, tt.proj)
continue
}
got := fmt.Sprint(tryWorkItem(cl))
got := fmt.Sprint(tryWorkItem(cl, tt.ci))
if got != tt.want {
t.Errorf("tryWorkItem(%q, %v) = %#q; want %#q", tt.proj, tt.clnum, got, tt.want)
t.Errorf("tryWorkItem(%q, %v) mismatch:\n got: %#q\nwant: %#q", tt.proj, tt.clnum, got, tt.want)
}
}
}