dashboard: include longtest builders for trybots on release branches

The goal of this test policy change is to decrease the chance of a
Go repository release branch from getting into a state where some
longtest post-submit builders are failing, as this will interfere
with the ability to issue releases after golang/go#29252 is fixed.

There are not that many CLs sent to release branches, so the extra
latency caused by slower longtest builders being a part of trybots
should not be very disruptive.

For golang/go#37827.
For golang/go#29252.

Change-Id: I819b120bb7b763df4acf4583375cdb840793d323
Reviewed-on: https://go-review.googlesource.com/c/build/+/235338
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
Reviewed-by: Carlos Amedee <carlos@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index fc41bb4..755b780 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -1759,6 +1759,10 @@
 		Name:     "linux-amd64-longtest",
 		HostType: "host-linux-stretch-morecpu",
 		Notes:    "Debian Stretch with go test -short=false",
+		tryBot: func(repo, branch, goBranch string) bool {
+			onReleaseBranch := strings.HasPrefix(branch, "release-branch.")
+			return repo == "go" && onReleaseBranch // See issue 37827.
+		},
 		buildsRepo: func(repo, branch, goBranch string) bool {
 			return repo == "go" || (branch == "master" && goBranch == "master")
 		},
@@ -1771,6 +1775,10 @@
 		Name:     "linux-386-longtest",
 		HostType: "host-linux-stretch-morecpu",
 		Notes:    "Debian Stretch with go test -short=false; to get 32-bit coverage",
+		tryBot: func(repo, branch, goBranch string) bool {
+			onReleaseBranch := strings.HasPrefix(branch, "release-branch.")
+			return repo == "go" && onReleaseBranch // See issue 37827.
+		},
 		buildsRepo: func(repo, branch, goBranch string) bool {
 			if repo == "build" {
 				return false
@@ -2074,6 +2082,10 @@
 		Name:     "windows-amd64-longtest",
 		HostType: "host-windows-amd64-2016-big",
 		Notes:    "Windows Server 2016 with go test -short=false",
+		tryBot: func(repo, branch, goBranch string) bool {
+			onReleaseBranch := strings.HasPrefix(branch, "release-branch.")
+			return repo == "go" && onReleaseBranch // See issue 37827.
+		},
 		buildsRepo: func(repo, branch, goBranch string) bool {
 			if !defaultPlusExpBuild(repo, branch, goBranch) {
 				return false
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index 0bb611b..1e64fa4 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -158,6 +158,11 @@
 				"openbsd-amd64-64",
 				"windows-386-2008",
 				"windows-amd64-2016",
+
+				// Include longtest builders on Go repo release branches. See issue 37827.
+				"linux-386-longtest",
+				"linux-amd64-longtest",
+				"windows-amd64-longtest",
 			},
 		},
 		{
@@ -459,10 +464,10 @@
 		// Long test.
 		{b("linux-amd64-longtest", "go"), onlyPost},
 		{b("linux-amd64-longtest", "net"), onlyPost},
-		{b("linux-amd64-longtest@go1.14", "go"), onlyPost},
+		{b("linux-amd64-longtest@go1.14", "go"), both},
 		{b("linux-amd64-longtest@go1.14", "net"), none},
 		{b("windows-amd64-longtest", "go"), onlyPost},
-		{b("windows-amd64-longtest@go1.14", "go"), onlyPost},
+		{b("windows-amd64-longtest@go1.14", "go"), both},
 		{b("windows-amd64-longtest", "net"), onlyPost},
 		{b("windows-amd64-longtest", "exp"), onlyPost},
 		{b("windows-amd64-longtest", "mobile"), none},