Fix Makefile rule to build bot
parent
3f44d470eb
commit
3d547a937f
6
Makefile
6
Makefile
|
@ -747,9 +747,9 @@ site: site/themes/docsy/assets/vendor/bootstrap/package.js out/hugo/hugo ## Serv
|
|||
out/mkcmp:
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/mkcmp/main.go
|
||||
|
||||
.PHONY: out/performance-monitor
|
||||
out/performance-monitor:
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/monitor/monitor.go
|
||||
.PHONY: out/performance-bot
|
||||
out/performance-bot:
|
||||
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $@ cmd/performance/pr-bot/bot.go
|
||||
|
||||
.PHONY: compare
|
||||
compare: out/mkcmp out/minikube
|
||||
|
|
|
@ -20,10 +20,10 @@ import (
|
|||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"k8s.io/minikube/pkg/perf/monitor"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
@ -41,20 +41,15 @@ func main() {
|
|||
// 2. running mkcmp against those PRs
|
||||
// 3. commenting results on those PRs
|
||||
func analyzePerformance(ctx context.Context) error {
|
||||
logsFile := "/home/performance-monitor/logs.txt"
|
||||
if _, err := os.Stat(logsFile); err != nil {
|
||||
return err
|
||||
}
|
||||
client := monitor.NewClient(context.Background(), "kubernetes", "minikube")
|
||||
prs, err := client.ListOpenPRsWithLabel("")
|
||||
client := monitor.NewClient(ctx, monitor.GithubOwner, monitor.GithubRepo)
|
||||
prs, err := client.ListOpenPRsWithLabel(monitor.OkToTestLabel)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "listing open prs")
|
||||
}
|
||||
log.Print("got prs:", prs)
|
||||
// TODO: priyawadhwa@ for each PR we should comment the error if we get one?
|
||||
for _, pr := range prs {
|
||||
log.Printf("~~~ Analyzing PR %d ~~~", pr)
|
||||
newCommitsExist, err := client.NewCommitsExist(pr, "minikube-pr-bot")
|
||||
newCommitsExist, err := client.NewCommitsExist(pr, monitor.BotName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -62,13 +57,12 @@ func analyzePerformance(ctx context.Context) error {
|
|||
log.Println("New commits don't exist, skipping rerun...")
|
||||
continue
|
||||
}
|
||||
// TODO: priyawadhwa@ we should download mkcmp for each run?
|
||||
var message string
|
||||
message, err = monitor.RunMkcmp(ctx, pr)
|
||||
if err != nil {
|
||||
message = fmt.Sprintf("Error: %v\n%s", err, message)
|
||||
}
|
||||
log.Printf("got message for pr %d:\n%s\n", pr, message)
|
||||
log.Printf("message for pr %d:\n%s\n", pr, message)
|
||||
if err := client.CommentOnPR(pr, message); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
|
@ -21,4 +21,5 @@ const (
|
|||
OkToTestLabel = "ok-to-test"
|
||||
GithubOwner = "kubernetes"
|
||||
GithubRepo = "minikube"
|
||||
BotName = "minikube-pr-bot"
|
||||
)
|
||||
|
|
|
@ -78,7 +78,7 @@ func (g *Client) ListOpenPRsWithLabel(label string) ([]int, error) {
|
|||
return nil, errors.Wrap(err, "listing pull requests")
|
||||
}
|
||||
for _, pr := range prs {
|
||||
if prContainsLabel(pr.Labels, "ok-to-test") {
|
||||
if prContainsLabel(pr.Labels, label) {
|
||||
validPrs = append(validPrs, pr.GetNumber())
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue