Skip to content

Commit a3d9d89

Browse files
dmitshurgopherbot
authored andcommitted
dashboard, cmd/makemac: drop macOS 10.12 builder
Go 1.16 was the last Go release to support macOS 10.12, so that builder has become unused and its capacity can be reallocated to other builders. While here, also update makemac to support parsing host types without a "_0" suffix, so we can start using "host-darwin-amd64-13" instead of "host-darwin-amd64-13_0", similar to the new arm64 host type names. For golang/go#23011. Updates golang/go#49149. Change-Id: I6bc0948e716ee62f4b5519cb069aa0f06a2ec1af Reviewed-on: https://go-review.googlesource.com/c/build/+/419194 TryBot-Result: Gopher Robot <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Carlos Amedee <[email protected]> Run-TryBot: Dmitri Shuralyov <[email protected]> Auto-Submit: Dmitri Shuralyov <[email protected]>
1 parent 6b9a04b commit a3d9d89

File tree

4 files changed

+48
-62
lines changed

4 files changed

+48
-62
lines changed

Diff for: cmd/makemac/makemac.go

+29-27
Original file line numberDiff line numberDiff line change
@@ -642,8 +642,7 @@ func autoAdjust() {
642642
}
643643
}()
644644

645-
req, _ := http.NewRequest("GET", "https://farmer.golang.org/status/reverse.json", nil)
646-
req = req.WithContext(ctx)
645+
req, _ := http.NewRequestWithContext(ctx, "GET", "https://farmer.golang.org/status/reverse.json", nil)
647646
res, err := http.DefaultClient.Do(req)
648647
if err != nil {
649648
errors = append(errors, fmt.Sprintf("getting /status/reverse.json from coordinator: %v", err))
@@ -739,40 +738,45 @@ func (v Version) String() string {
739738
}
740739

741740
// hostTypeToVersion determines the version of macOS from the host type.
742-
// Sample host types would be: host-darwin-10_12 and host-darwin-arm64-11_0.
741+
// Sample host types would be: host-darwin-10_15 and host-darwin-arm64-11_0.
743742
func hostTypeToVersion(hostType string) (*Version, error) {
744743
v := &Version{}
745744
var err error
746745
if !strings.HasPrefix(hostType, "host-darwin-") {
747746
return nil, errors.New("unrecognized version")
748747
}
749748
htv := strings.TrimPrefix(hostType, "host-darwin-")
750-
vs := strings.Split(htv, "-")
751-
if len(vs) > 2 {
752-
return nil, errors.New("unrecognized version")
753-
}
754749
var majorMinor string
755-
if len(vs) == 2 {
750+
switch vs := strings.Split(htv, "-"); len(vs) {
751+
case 2:
756752
if vs[0] != "amd64" && vs[0] != "arm64" {
757753
return nil, errors.New("unrecognized version")
758754
}
759755
v.Arch = vs[0]
760756
majorMinor = vs[1]
761-
} else {
757+
case 1:
762758
v.Arch = "amd64"
763759
majorMinor = vs[0]
764-
}
765-
mms := strings.Split(majorMinor, "_")
766-
if len(mms) != 2 {
760+
default:
767761
return nil, errors.New("unrecognized version")
768762
}
769-
v.Major, err = strconv.Atoi(mms[0])
770-
if err != nil {
771-
return nil, err
772-
}
773-
v.Minor, err = strconv.Atoi(mms[1])
774-
if err != nil {
775-
return nil, err
763+
switch mms := strings.Split(majorMinor, "_"); len(mms) {
764+
case 1:
765+
v.Major, err = strconv.Atoi(mms[0])
766+
if err != nil {
767+
return nil, err
768+
}
769+
case 2:
770+
v.Major, err = strconv.Atoi(mms[0])
771+
if err != nil {
772+
return nil, err
773+
}
774+
v.Minor, err = strconv.Atoi(mms[1])
775+
if err != nil {
776+
return nil, err
777+
}
778+
default:
779+
return nil, errors.New("unrecognized version")
776780
}
777781
return v, nil
778782
}
@@ -781,10 +785,10 @@ func hostTypeToVersion(hostType string) (*Version, error) {
781785
// or nil to not make anything. It gets the latest reverse buildlet
782786
// status from the coordinator.
783787
func wantedMacVersionNext(st *State, rstat *types.ReverseBuilderStatus) *Version {
784-
// TODO: improve this logic now that the coordinator has a
785-
// proper scheduler. Instead, don't create anything
786-
// proactively until there's demand from it from the
787-
// scheduler. (will need to add that to the coordinator's
788+
// TODO(go.dev/issue/35698): improve this logic now that
789+
// the coordinator has a proper scheduler. Instead, don't
790+
// create anything proactively until there's demand from it
791+
// from the scheduler. (will need to add that to the coordinator's
788792
// status JSON) And maybe add a streaming endpoint to the
789793
// coordinator so we don't need to poll every N seconds. Or
790794
// just poll every few seconds, perhaps at a lighter endpoint
@@ -893,8 +897,7 @@ var (
893897
)
894898

895899
func getLatestMacBuildlet(ctx context.Context) (bin []byte, err error) {
896-
req, _ := http.NewRequest("HEAD", "https://storage.googleapis.com/go-builder-data/buildlet.darwin-amd64", nil)
897-
req = req.WithContext(ctx)
900+
req, _ := http.NewRequestWithContext(ctx, "HEAD", "https://storage.googleapis.com/go-builder-data/buildlet.darwin-amd64", nil)
898901
res, err := http.DefaultClient.Do(req)
899902
if err != nil {
900903
return nil, err
@@ -917,8 +920,7 @@ func getLatestMacBuildlet(ctx context.Context) (bin []byte, err error) {
917920
buildletMu.Unlock()
918921

919922
log.Printf("fetching buildlet from GCS...")
920-
req, _ = http.NewRequest("GET", "https://storage.googleapis.com/go-builder-data/buildlet.darwin-amd64", nil)
921-
req = req.WithContext(ctx)
923+
req, _ = http.NewRequestWithContext(ctx, "GET", "https://storage.googleapis.com/go-builder-data/buildlet.darwin-amd64", nil)
922924
res, err = http.DefaultClient.Do(req)
923925
if err != nil {
924926
return nil, err

Diff for: cmd/makemac/makemac_test.go

+13-4
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ func TestHostTypeToVersion(t *testing.T) {
1818
}{
1919
{
2020
desc: "valid original darwin host type",
21-
hostType: "host-darwin-10_11",
21+
hostType: "host-darwin-10_14",
2222
wantVersion: &Version{
2323
Major: 10,
24-
Minor: 11,
24+
Minor: 14,
2525
Arch: "amd64",
2626
},
2727
},
2828
{
2929
desc: "valid original darwin host type",
30-
hostType: "host-darwin-10_12",
30+
hostType: "host-darwin-10_15",
3131
wantVersion: &Version{
3232
Major: 10,
33-
Minor: 12,
33+
Minor: 15,
3434
Arch: "amd64",
3535
},
3636
},
@@ -52,6 +52,15 @@ func TestHostTypeToVersion(t *testing.T) {
5252
Arch: "amd64",
5353
},
5454
},
55+
{
56+
desc: "valid newer darwin host AMD64",
57+
hostType: "host-darwin-amd64-13",
58+
wantVersion: &Version{
59+
Major: 13,
60+
Minor: 0,
61+
Arch: "amd64",
62+
},
63+
},
5564
}
5665
for _, tc := range testCases {
5766
t.Run(tc.desc, func(t *testing.T) {

Diff for: dashboard/builders.go

+2-21
Original file line numberDiff line numberDiff line change
@@ -468,19 +468,9 @@ var Hosts = map[string]*HostConfig{
468468
IsReverse: true,
469469
ExpectNum: 5,
470470
},
471-
"host-darwin-10_12": &HostConfig{
472-
IsReverse: true,
473-
ExpectNum: 2,
474-
Notes: "MacStadium OS X 10.12 VM under VMWare ESXi",
475-
env: []string{
476-
"GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
477-
},
478-
SSHUsername: "gopher",
479-
HermeticReverse: true, // we destroy the VM when done & let cmd/makemac recreate
480-
},
481471
"host-darwin-10_14": &HostConfig{
482472
IsReverse: true,
483-
ExpectNum: 2,
473+
ExpectNum: 3,
484474
Notes: "MacStadium macOS Mojave (10.14) VM under VMWare ESXi",
485475
env: []string{
486476
"GOROOT_BOOTSTRAP=/Users/gopher/goboot", // Go 1.12.1
@@ -500,7 +490,7 @@ var Hosts = map[string]*HostConfig{
500490
},
501491
"host-darwin-amd64-11_0": &HostConfig{
502492
IsReverse: true,
503-
ExpectNum: 4,
493+
ExpectNum: 5,
504494
Notes: "MacStadium macOS Big Sur (11.0) VM under VMWare ESXi",
505495
env: []string{
506496
"GOROOT_BOOTSTRAP=/Users/gopher/goboot", // Go 1.13.4
@@ -2421,15 +2411,6 @@ func init() {
24212411
},
24222412
KnownIssues: []int{51019},
24232413
})
2424-
addBuilder(BuildConfig{
2425-
Name: "darwin-amd64-10_12",
2426-
HostType: "host-darwin-10_12",
2427-
distTestAdjust: macTestPolicy,
2428-
buildsRepo: func(repo, branch, goBranch string) bool {
2429-
// macOS 10.12 not supported after Go 1.16
2430-
return atMostGo1(goBranch, 16) && buildRepoByDefault(repo)
2431-
},
2432-
})
24332414
addBuilder(BuildConfig{
24342415
Name: "darwin-amd64-10_14",
24352416
HostType: "host-darwin-10_14",

Diff for: dashboard/builders_test.go

+4-10
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,6 @@ func TestBuilderConfig(t *testing.T) {
543543
{b("darwin-amd64-10_14", "exp"), onlyPost},
544544
{b("darwin-amd64-10_15", "exp"), onlyPost},
545545
// ... but not on most others:
546-
{b("darwin-amd64-10_12", "exp"), none},
547546
{b("freebsd-386-11_4", "exp"), none},
548547
{b("freebsd-386-12_3", "exp"), none},
549548
{b("freebsd-amd64-11_4", "exp"), none},
@@ -560,7 +559,6 @@ func TestBuilderConfig(t *testing.T) {
560559
{b("linux-amd64", "build"), both},
561560
{b("linux-amd64-longtest", "build"), onlyPost},
562561
{b("windows-amd64-2016", "build"), both},
563-
{b("darwin-amd64-10_12", "build"), none},
564562
{b("darwin-amd64-10_14", "build"), none},
565563
{b("darwin-amd64-10_15", "build"), onlyPost},
566564
{b("openbsd-amd64-68", "build"), none},
@@ -582,14 +580,10 @@ func TestBuilderConfig(t *testing.T) {
582580
{b("android-amd64-emu", "build"), none},
583581

584582
// Only use latest macOS for subrepos, and only amd64:
585-
{b("[email protected]", "net"), onlyPost},
586-
{b("darwin-amd64-10_12", "net"), none},
587583
{b("darwin-amd64-10_14", "net"), onlyPost},
588584

589585
{b("darwin-amd64-10_15", "go"), onlyPost},
590586
{b("darwin-amd64-10_14", "go"), onlyPost},
591-
{b("darwin-amd64-10_12", "go"), none},
592-
{b("[email protected]", "go"), onlyPost},
593587

594588
// plan9 only lived at master. We didn't support any past releases.
595589
// But it's off for now as it's always failing.
@@ -739,7 +733,6 @@ func TestShouldRunDistTest(t *testing.T) {
739733
{"linux-amd64", "reboot", tryMode, true},
740734
{"linux-amd64-race", "reboot", tryMode, false},
741735

742-
{"darwin-amd64-10_12", "test:foo", postSubmit, false},
743736
{"darwin-amd64-10_14", "test:foo", postSubmit, false},
744737
{"darwin-amd64-10_14", "reboot", postSubmit, false},
745738
{"darwin-amd64-10_14", "api", postSubmit, false},
@@ -944,9 +937,10 @@ func TestMiscCompileLinuxGOARM5(t *testing.T) {
944937
}
945938
}
946939

947-
// TestExpectedMacstadiumVMCount ensures that only 20 instances of macOS virtual machines
948-
// are expected at MacStadium.
949-
// TODO: remove once the scheduler allocates VMs based on demand https://golang.org/issue/35698
940+
// TestExpectedMacstadiumVMCount ensures that the right number of
941+
// instances of macOS virtual machines are expected at MacStadium.
942+
//
943+
// TODO(go.dev/issue/35698): remove once the scheduler allocates VMs based on demand.
950944
func TestExpectedMacstadiumVMCount(t *testing.T) {
951945
got := 0
952946
for host, config := range Hosts {

0 commit comments

Comments
 (0)