dashboard: make FreeBSD 11.4 and 12.2 builders the default

With this change:
- The default FreeBSD builders used on master are 11.4 and 12.2.
- The FreeBSD 12.0 builders have been removed.
- The FreeBSD 11.2 builders have been set to run on at most Go 1.16.
  They will continue to be used for Go 1.16.x and 1.15.x minor releases.
- The freebsd-amd64-race builder has been updated to use the FreeBSD
  12.2 host.
- The slowbot aliases for FreeBSD have been updated to use 12.2.

Fixes golang/go#44431
Update golang/go#45727
Update golang/go#40561

Change-Id: Ib558fca65c2de1916b4633711d3e320c390bd2b2
Reviewed-on: https://go-review.googlesource.com/c/build/+/313070
Trust: Carlos Amedee <carlos@golang.org>
Run-TryBot: Carlos Amedee <carlos@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/dashboard/builders.go b/dashboard/builders.go
index 0a08178..767bafe 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -43,9 +43,9 @@
 	"darwin-arm64":         "darwin-arm64-11_0-toothrot",
 	"ios-arm64":            "ios-arm64-corellium",
 	"dragonfly":            "dragonfly-amd64",
-	"freebsd":              "freebsd-amd64-12_0",
-	"freebsd-386":          "freebsd-386-12_0",
-	"freebsd-amd64":        "freebsd-amd64-12_0",
+	"freebsd":              "freebsd-amd64-12_2",
+	"freebsd-386":          "freebsd-386-12_2",
+	"freebsd-amd64":        "freebsd-amd64-12_2",
 	"freebsd-arm":          "freebsd-arm-paulzhol",
 	"freebsd-arm64":        "freebsd-arm64-dmgk",
 	"illumos":              "illumos-amd64",
@@ -315,14 +315,6 @@
 		goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-freebsd-amd64.tar.gz",
 		SSHUsername:        "gopher",
 	},
-	"host-freebsd-12_0": &HostConfig{
-		VMImage:            "freebsd-amd64-120-v1",
-		Notes:              "FreeBSD 12.0; GCE VM is built from script in build/env/freebsd-amd64",
-		machineType:        "n1-highcpu-4",
-		buildletURLTmpl:    "https://storage.googleapis.com/$BUCKET/buildlet.freebsd-amd64",
-		goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-freebsd-amd64.tar.gz",
-		SSHUsername:        "gopher",
-	},
 	"host-freebsd-12_2": &HostConfig{
 		VMImage:            "freebsd-amd64-122",
 		Notes:              "FreeBSD 12.2; GCE VM is built from script in build/env/freebsd-amd64",
@@ -331,9 +323,9 @@
 		goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-freebsd-amd64.tar.gz",
 		SSHUsername:        "gopher",
 	},
-	"host-freebsd-12_0-big": &HostConfig{
-		VMImage:            "freebsd-amd64-120-v1",
-		Notes:              "Same as host-freebsd-12_0, but on n1-highcpu-16",
+	"host-freebsd-12_2-big": &HostConfig{
+		VMImage:            "freebsd-amd64-122",
+		Notes:              "Same as host-freebsd-12_2, but on n1-highcpu-16",
 		machineType:        "n1-highcpu-16", // 16 vCPUs, 14.4 GB mem
 		buildletURLTmpl:    "https://storage.googleapis.com/$BUCKET/buildlet.freebsd-amd64",
 		goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-freebsd-amd64.tar.gz",
@@ -1493,45 +1485,38 @@
 		tryBot:            explicitTrySet("sys"),
 		distTestAdjust:    fasterTrybots,
 		numTryTestHelpers: 4,
+		buildsRepo: func(repo, branch, goBranch string) bool {
+			// This builder is still used by Go 1.16 and 1.15,
+			// so keep it around a bit longer. See golang.org/issue/45727.
+			// Test relevant Go versions so that we're better informed.
+			return atMostGo1(goBranch, 16) && buildRepoByDefault(repo)
+		},
 	})
 	addBuilder(BuildConfig{
 		Name:              "freebsd-amd64-11_4",
 		HostType:          "host-freebsd-11_4",
+		tryBot:            explicitTrySet("sys"),
+		distTestAdjust:    fasterTrybots,
 		numTryTestHelpers: 4,
-		KnownIssue:        44431,
 	})
 	addBuilder(BuildConfig{
-		Name:             "freebsd-amd64-12_0",
-		HostType:         "host-freebsd-12_0",
-		MinimumGoVersion: types.MajorMinor{1, 11},
-		tryBot:           defaultTrySet("sys"),
+		Name:     "freebsd-amd64-12_2",
+		HostType: "host-freebsd-12_2",
+		tryBot:   defaultTrySet("sys"),
 
 		distTestAdjust:    fasterTrybots, // If changing this policy, update TestShouldRunDistTest accordingly.
 		numTryTestHelpers: 4,
 	})
 	addBuilder(BuildConfig{
-		Name:              "freebsd-amd64-12_2",
-		HostType:          "host-freebsd-12_2",
-		numTryTestHelpers: 4,
-		KnownIssue:        44431,
-	})
-	addBuilder(BuildConfig{
-		Name:              "freebsd-386-12_0",
-		HostType:          "host-freebsd-12_0",
-		env:               []string{"GOARCH=386", "GOHOSTARCH=386"},
-		distTestAdjust:    fasterTrybots,
-		numTryTestHelpers: 4,
-	})
-	addBuilder(BuildConfig{
 		Name:              "freebsd-386-12_2",
 		HostType:          "host-freebsd-12_2",
 		env:               []string{"GOARCH=386", "GOHOSTARCH=386"},
+		distTestAdjust:    fasterTrybots,
 		numTryTestHelpers: 4,
-		KnownIssue:        44431,
 	})
 	addBuilder(BuildConfig{
 		Name:     "freebsd-amd64-race",
-		HostType: "host-freebsd-12_0-big",
+		HostType: "host-freebsd-12_2-big",
 	})
 	addBuilder(BuildConfig{
 		Name:           "freebsd-386-11_2",
@@ -1539,13 +1524,19 @@
 		distTestAdjust: noTestDirAndNoReboot,
 		tryBot:         explicitTrySet("sys"),
 		env:            []string{"GOARCH=386", "GOHOSTARCH=386"},
+		buildsRepo: func(repo, branch, goBranch string) bool {
+			// This builder is still used by Go 1.16 and 1.15,
+			// so keep it around a bit longer. See golang.org/issue/45727.
+			// Test relevant Go versions so that we're better informed.
+			return atMostGo1(goBranch, 16) && buildRepoByDefault(repo)
+		},
 	})
 	addBuilder(BuildConfig{
 		Name:           "freebsd-386-11_4",
 		HostType:       "host-freebsd-11_4",
 		distTestAdjust: noTestDirAndNoReboot,
+		tryBot:         explicitTrySet("sys"),
 		env:            []string{"GOARCH=386", "GOHOSTARCH=386"},
-		KnownIssue:     44431,
 	})
 	addBuilder(BuildConfig{
 		Name:           "linux-386",
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index eac4a70..13cdb55 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -92,7 +92,7 @@
 			branch: "master",
 			want: []string{
 				"android-amd64-emu",
-				"freebsd-amd64-12_0",
+				"freebsd-amd64-12_2",
 				"js-wasm",
 				"linux-386",
 				"linux-amd64",
@@ -120,7 +120,7 @@
 			branch: "dev.link",
 			want: []string{
 				"android-amd64-emu",
-				"freebsd-amd64-12_0",
+				"freebsd-amd64-12_2",
 				"js-wasm",
 				"linux-386",
 				"linux-amd64",
@@ -148,7 +148,7 @@
 			branch: "release-branch.go1.16",
 			want: []string{
 				"android-amd64-emu",
-				"freebsd-amd64-12_0",
+				"freebsd-amd64-12_2",
 				"js-wasm",
 				"linux-386",
 				"linux-amd64",
@@ -181,7 +181,7 @@
 			branch: "release-branch.go1.15",
 			want: []string{
 				"android-amd64-emu",
-				"freebsd-amd64-12_0",
+				"freebsd-amd64-12_2",
 				"js-wasm",
 				"linux-386",
 				"linux-amd64",
@@ -221,9 +221,9 @@
 			branch: "master",
 			want: []string{
 				"android-amd64-emu",
-				"freebsd-386-11_2",
-				"freebsd-amd64-11_2",
-				"freebsd-amd64-12_0",
+				"freebsd-386-11_4",
+				"freebsd-amd64-11_4",
+				"freebsd-amd64-12_2",
 				"linux-386",
 				"linux-amd64",
 				"linux-amd64-race",
@@ -416,13 +416,24 @@
 		{b("openbsd-amd64-62@go1.15", "go"), onlyPost},
 		{b("openbsd-amd64-62@go1.14", "go"), onlyPost},
 
-		// FreeBSD 12.0
-		{b("freebsd-amd64-12_0", "go"), both},
-		{b("freebsd-amd64-12_0", "net"), both},
-		{b("freebsd-amd64-12_0", "mobile"), none},
-		{b("freebsd-386-12_0", "go"), onlyPost},
-		{b("freebsd-386-12_0", "net"), onlyPost},
-		{b("freebsd-386-12_0", "mobile"), none},
+		// FreeBSD 12.2
+		{b("freebsd-amd64-12_2", "go"), both},
+		{b("freebsd-amd64-12_2", "net"), both},
+		{b("freebsd-amd64-12_2", "mobile"), none},
+		{b("freebsd-386-12_2", "go"), onlyPost},
+		{b("freebsd-386-12_2", "net"), onlyPost},
+		{b("freebsd-386-12_2", "mobile"), none},
+
+		// FreeBSD 11.2
+		// See golang.org/issue/45727
+		{b("freebsd-amd64-11_2@go1.15", "go"), isBuilder},
+		{b("freebsd-amd64-11_2@go1.15", "net"), onlyPost},
+		{b("freebsd-amd64-11_2@go1.15", "sys"), both},
+		{b("freebsd-amd64-11_2", "go"), none},
+		{b("freebsd-386-11_2@go1.16", "go"), isBuilder},
+		{b("freebsd-386-11_2@go1.16", "net"), onlyPost},
+		{b("freebsd-386-11_2@go1.16", "sys"), both},
+		{b("freebsd-386-11_2", "go"), none},
 
 		// NetBSD
 		{b("netbsd-amd64-9_0", "go"), onlyPost},
@@ -516,10 +527,10 @@
 		{b("darwin-amd64-10_15", "exp"), onlyPost},
 		// ... but not on most others:
 		{b("darwin-amd64-10_12", "exp"), none},
-		{b("freebsd-386-11_2", "exp"), none},
-		{b("freebsd-386-12_0", "exp"), none},
-		{b("freebsd-amd64-11_2", "exp"), none},
-		{b("freebsd-amd64-12_0", "exp"), none},
+		{b("freebsd-386-11_4", "exp"), none},
+		{b("freebsd-386-12_2", "exp"), none},
+		{b("freebsd-amd64-11_4", "exp"), none},
+		{b("freebsd-amd64-12_2", "exp"), none},
 		{b("openbsd-amd64-64", "exp"), none},
 		{b("openbsd-amd64-68", "exp"), none},
 		{b("js-wasm", "exp"), none},
@@ -671,8 +682,8 @@
 	}{
 		{"linux-amd64", "api", postSubmit, true},
 		{"linux-amd64", "api", tryMode, true},
-		{"freebsd-amd64-12_0", "api", postSubmit, true}, // freebsd-amd64-12_0 uses fasterTrybots policy, should still build.
-		{"freebsd-amd64-12_0", "api", tryMode, false},   // freebsd-amd64-12_0 uses fasterTrybots policy, should skip in try mode.
+		{"freebsd-amd64-12_2", "api", postSubmit, true}, // freebsd-amd64-12_2 uses fasterTrybots policy, should still build.
+		{"freebsd-amd64-12_2", "api", tryMode, false},   // freebsd-amd64-12_2 uses fasterTrybots policy, should skip in try mode.
 
 		{"linux-amd64", "reboot", tryMode, true},
 		{"linux-amd64-race", "reboot", tryMode, false},