aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitri Shuralyov <dmitshur@golang.org>2023-08-25 15:34:18 -0400
committerGopher Robot <gobot@golang.org>2023-08-25 20:23:13 +0000
commita7f03fb75ac9ca173ff7d2d453bc09f3fb975220 (patch)
tree1d142215b9eabdb5ade76e0ab91813be1524cb89
parentfbc0ad724bc7391431d6b4c69eec7d842a604850 (diff)
downloadgo-x-review-a7f03fb75ac9ca173ff7d2d453bc09f3fb975220.tar.xz
git-codereview: add GIT_CODEREVIEW_TRYBOT env var to control CI system
The mail command has a -trybot flag, useful to start TryBots on the CL being mailed. The new LUCI trybots are almost ready, and we'll soon be asking contributors to consider them the new default. Prepare for that by adding a temporary GIT_CODEREVIEW_TRYBOT environment variable which will make it possible to override the CI system invoked by the -trybot flag. This CL keeps the default as the old CI system (farmer.golang.org), and the next CL switches it to the new one (ci.chromium.org/p/golang). The environment variable will eventually be removed once it has no use. Change-Id: Ia20bb0cad1fee387b2d94a8438e8a3be3ec87e6b Reviewed-on: https://go-review.googlesource.com/c/review/+/523095 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
-rw-r--r--git-codereview/doc.go3
-rw-r--r--git-codereview/mail.go20
2 files changed, 21 insertions, 2 deletions
diff --git a/git-codereview/doc.go b/git-codereview/doc.go
index 4be0c0d..0754479 100644
--- a/git-codereview/doc.go
+++ b/git-codereview/doc.go
@@ -256,6 +256,9 @@ is needed is when checking in test cases for cryptography libraries.)
The -trybot flag sets a Run-TryBot+1 vote on any uploaded changes.
The Go project uses this vote to start running integration tests on the CL.
+During the transition between two CI systems, the environment variable
+GIT_CODEREVIEW_TRYBOT can be set to one of "luci", "farmer", or "both"
+to explicitly override where the -trybot flag starts integration tests.
The -autosubmit flag sets a Auto-Submit+1 vote on any uploaded changes.
diff --git a/git-codereview/mail.go b/git-codereview/mail.go
index 5d385f9..4bcd85c 100644
--- a/git-codereview/mail.go
+++ b/git-codereview/mail.go
@@ -6,6 +6,7 @@ package main
import (
"fmt"
+ "os"
"regexp"
"sort"
"strings"
@@ -47,6 +48,19 @@ func cmdMail(args []string) {
exit(2)
}
+ var trybotVotes []string
+ switch os.Getenv("GIT_CODEREVIEW_TRYBOT") {
+ case "luci":
+ trybotVotes = []string{"Commit-Queue+1"}
+ case "", "farmer":
+ trybotVotes = []string{"Run-TryBot"}
+ case "both":
+ trybotVotes = []string{"Commit-Queue+1", "Run-TryBot"}
+ default:
+ fmt.Fprintf(stderr(), "GIT_CODEREVIEW_TRYBOT must be unset, blank, or one of 'luci', 'farmer', or 'both'\n")
+ exit(2)
+ }
+
b := CurrentBranch()
var c *Commit
@@ -142,8 +156,10 @@ func cmdMail(args []string) {
start = ","
}
if *trybot {
- refSpec += start + "l=Run-TryBot"
- start = ","
+ for _, v := range trybotVotes {
+ refSpec += start + "l=" + v
+ start = ","
+ }
}
if *wip {
refSpec += start + "wip"