Skip to content

Commit

Permalink
dashboard, cmd/makemac: drop macOS 10.12 builder
Browse files Browse the repository at this point in the history
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 <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Carlos Amedee <carlos@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
  • Loading branch information
dmitshur authored and gopherbot committed Jul 25, 2022
1 parent 6b9a04b commit a3d9d89
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 62 deletions.
56 changes: 29 additions & 27 deletions cmd/makemac/makemac.go
Expand Up @@ -642,8 +642,7 @@ func autoAdjust() {
}
}()

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

// hostTypeToVersion determines the version of macOS from the host type.
// Sample host types would be: host-darwin-10_12 and host-darwin-arm64-11_0.
// Sample host types would be: host-darwin-10_15 and host-darwin-arm64-11_0.
func hostTypeToVersion(hostType string) (*Version, error) {
v := &Version{}
var err error
if !strings.HasPrefix(hostType, "host-darwin-") {
return nil, errors.New("unrecognized version")
}
htv := strings.TrimPrefix(hostType, "host-darwin-")
vs := strings.Split(htv, "-")
if len(vs) > 2 {
return nil, errors.New("unrecognized version")
}
var majorMinor string
if len(vs) == 2 {
switch vs := strings.Split(htv, "-"); len(vs) {
case 2:
if vs[0] != "amd64" && vs[0] != "arm64" {
return nil, errors.New("unrecognized version")
}
v.Arch = vs[0]
majorMinor = vs[1]
} else {
case 1:
v.Arch = "amd64"
majorMinor = vs[0]
}
mms := strings.Split(majorMinor, "_")
if len(mms) != 2 {
default:
return nil, errors.New("unrecognized version")
}
v.Major, err = strconv.Atoi(mms[0])
if err != nil {
return nil, err
}
v.Minor, err = strconv.Atoi(mms[1])
if err != nil {
return nil, err
switch mms := strings.Split(majorMinor, "_"); len(mms) {
case 1:
v.Major, err = strconv.Atoi(mms[0])
if err != nil {
return nil, err
}
case 2:
v.Major, err = strconv.Atoi(mms[0])
if err != nil {
return nil, err
}
v.Minor, err = strconv.Atoi(mms[1])
if err != nil {
return nil, err
}
default:
return nil, errors.New("unrecognized version")
}
return v, nil
}
Expand All @@ -781,10 +785,10 @@ func hostTypeToVersion(hostType string) (*Version, error) {
// or nil to not make anything. It gets the latest reverse buildlet
// status from the coordinator.
func wantedMacVersionNext(st *State, rstat *types.ReverseBuilderStatus) *Version {
// TODO: improve this logic now that the coordinator has a
// proper scheduler. Instead, don't create anything
// proactively until there's demand from it from the
// scheduler. (will need to add that to the coordinator's
// TODO(go.dev/issue/35698): improve this logic now that
// the coordinator has a proper scheduler. Instead, don't
// create anything proactively until there's demand from it
// from the scheduler. (will need to add that to the coordinator's
// status JSON) And maybe add a streaming endpoint to the
// coordinator so we don't need to poll every N seconds. Or
// just poll every few seconds, perhaps at a lighter endpoint
Expand Down Expand Up @@ -893,8 +897,7 @@ var (
)

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

log.Printf("fetching buildlet from GCS...")
req, _ = http.NewRequest("GET", "https://storage.googleapis.com/go-builder-data/buildlet.darwin-amd64", nil)
req = req.WithContext(ctx)
req, _ = http.NewRequestWithContext(ctx, "GET", "https://storage.googleapis.com/go-builder-data/buildlet.darwin-amd64", nil)
res, err = http.DefaultClient.Do(req)
if err != nil {
return nil, err
Expand Down
17 changes: 13 additions & 4 deletions cmd/makemac/makemac_test.go
Expand Up @@ -18,19 +18,19 @@ func TestHostTypeToVersion(t *testing.T) {
}{
{
desc: "valid original darwin host type",
hostType: "host-darwin-10_11",
hostType: "host-darwin-10_14",
wantVersion: &Version{
Major: 10,
Minor: 11,
Minor: 14,
Arch: "amd64",
},
},
{
desc: "valid original darwin host type",
hostType: "host-darwin-10_12",
hostType: "host-darwin-10_15",
wantVersion: &Version{
Major: 10,
Minor: 12,
Minor: 15,
Arch: "amd64",
},
},
Expand All @@ -52,6 +52,15 @@ func TestHostTypeToVersion(t *testing.T) {
Arch: "amd64",
},
},
{
desc: "valid newer darwin host AMD64",
hostType: "host-darwin-amd64-13",
wantVersion: &Version{
Major: 13,
Minor: 0,
Arch: "amd64",
},
},
}
for _, tc := range testCases {
t.Run(tc.desc, func(t *testing.T) {
Expand Down
23 changes: 2 additions & 21 deletions dashboard/builders.go
Expand Up @@ -468,19 +468,9 @@ var Hosts = map[string]*HostConfig{
IsReverse: true,
ExpectNum: 5,
},
"host-darwin-10_12": &HostConfig{
IsReverse: true,
ExpectNum: 2,
Notes: "MacStadium OS X 10.12 VM under VMWare ESXi",
env: []string{
"GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
},
SSHUsername: "gopher",
HermeticReverse: true, // we destroy the VM when done & let cmd/makemac recreate
},
"host-darwin-10_14": &HostConfig{
IsReverse: true,
ExpectNum: 2,
ExpectNum: 3,
Notes: "MacStadium macOS Mojave (10.14) VM under VMWare ESXi",
env: []string{
"GOROOT_BOOTSTRAP=/Users/gopher/goboot", // Go 1.12.1
Expand All @@ -500,7 +490,7 @@ var Hosts = map[string]*HostConfig{
},
"host-darwin-amd64-11_0": &HostConfig{
IsReverse: true,
ExpectNum: 4,
ExpectNum: 5,
Notes: "MacStadium macOS Big Sur (11.0) VM under VMWare ESXi",
env: []string{
"GOROOT_BOOTSTRAP=/Users/gopher/goboot", // Go 1.13.4
Expand Down Expand Up @@ -2421,15 +2411,6 @@ func init() {
},
KnownIssues: []int{51019},
})
addBuilder(BuildConfig{
Name: "darwin-amd64-10_12",
HostType: "host-darwin-10_12",
distTestAdjust: macTestPolicy,
buildsRepo: func(repo, branch, goBranch string) bool {
// macOS 10.12 not supported after Go 1.16
return atMostGo1(goBranch, 16) && buildRepoByDefault(repo)
},
})
addBuilder(BuildConfig{
Name: "darwin-amd64-10_14",
HostType: "host-darwin-10_14",
Expand Down
14 changes: 4 additions & 10 deletions dashboard/builders_test.go
Expand Up @@ -543,7 +543,6 @@ func TestBuilderConfig(t *testing.T) {
{b("darwin-amd64-10_14", "exp"), onlyPost},
{b("darwin-amd64-10_15", "exp"), onlyPost},
// ... but not on most others:
{b("darwin-amd64-10_12", "exp"), none},
{b("freebsd-386-11_4", "exp"), none},
{b("freebsd-386-12_3", "exp"), none},
{b("freebsd-amd64-11_4", "exp"), none},
Expand All @@ -560,7 +559,6 @@ func TestBuilderConfig(t *testing.T) {
{b("linux-amd64", "build"), both},
{b("linux-amd64-longtest", "build"), onlyPost},
{b("windows-amd64-2016", "build"), both},
{b("darwin-amd64-10_12", "build"), none},
{b("darwin-amd64-10_14", "build"), none},
{b("darwin-amd64-10_15", "build"), onlyPost},
{b("openbsd-amd64-68", "build"), none},
Expand All @@ -582,14 +580,10 @@ func TestBuilderConfig(t *testing.T) {
{b("android-amd64-emu", "build"), none},

// Only use latest macOS for subrepos, and only amd64:
{b("darwin-amd64-10_12@go1.16", "net"), onlyPost},
{b("darwin-amd64-10_12", "net"), none},
{b("darwin-amd64-10_14", "net"), onlyPost},

{b("darwin-amd64-10_15", "go"), onlyPost},
{b("darwin-amd64-10_14", "go"), onlyPost},
{b("darwin-amd64-10_12", "go"), none},
{b("darwin-amd64-10_12@go1.16", "go"), onlyPost},

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

{"darwin-amd64-10_12", "test:foo", postSubmit, false},
{"darwin-amd64-10_14", "test:foo", postSubmit, false},
{"darwin-amd64-10_14", "reboot", postSubmit, false},
{"darwin-amd64-10_14", "api", postSubmit, false},
Expand Down Expand Up @@ -944,9 +937,10 @@ func TestMiscCompileLinuxGOARM5(t *testing.T) {
}
}

// TestExpectedMacstadiumVMCount ensures that only 20 instances of macOS virtual machines
// are expected at MacStadium.
// TODO: remove once the scheduler allocates VMs based on demand https://golang.org/issue/35698
// TestExpectedMacstadiumVMCount ensures that the right number of
// instances of macOS virtual machines are expected at MacStadium.
//
// TODO(go.dev/issue/35698): remove once the scheduler allocates VMs based on demand.
func TestExpectedMacstadiumVMCount(t *testing.T) {
got := 0
for host, config := range Hosts {
Expand Down

0 comments on commit a3d9d89

Please sign in to comment.