Skip to content

Commit be762f1

Browse files
committed
all: remove macstadium integration and monitoring
We no longer use this hosting provider. Removes builders depending on this host type, including Windows ARM builders. Fixes golang/go#57562 Updates golang/go#47019 Change-Id: I1b2d3dfb0540cdf1ebc1ce2cfabbcd7d56c30145 Reviewed-on: https://go-review.googlesource.com/c/build/+/460295 TryBot-Result: Gopher Robot <[email protected]> Run-TryBot: Jenny Rakoczy <[email protected]> Reviewed-by: Heschi Kreinick <[email protected]>
1 parent 7cd30c4 commit be762f1

22 files changed

+20
-1836
lines changed

cmd/buildlet/buildlet.go

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"os/exec"
3535
"path"
3636
"path/filepath"
37-
"regexp"
3837
"runtime"
3938
"strconv"
4039
"strings"
@@ -126,9 +125,6 @@ const (
126125

127126
func main() {
128127
builderEnv := os.Getenv("GO_BUILDER_ENV")
129-
if builderEnv == "macstadium_vm" {
130-
configureMacStadium()
131-
}
132128
onGCE := metadata.OnGCE()
133129
switch runtime.GOOS {
134130
case "plan9":
@@ -1737,103 +1733,6 @@ func killProcessTreeUnix(p *os.Process) error {
17371733
return p.Kill()
17381734
}
17391735

1740-
// configureMacStadium configures the buildlet flags for use on a Mac
1741-
// VM running on MacStadium under VMWare.
1742-
func configureMacStadium() {
1743-
*haltEntireOS = true
1744-
1745-
// TODO: setup RAM disk for tmp and set *workDir
1746-
1747-
disableMacScreensaver()
1748-
enableMacDeveloperMode()
1749-
1750-
version, err := exec.Command("sw_vers", "-productVersion").Output()
1751-
if err != nil {
1752-
log.Fatalf("failed to find sw_vers -productVersion: %v", err)
1753-
}
1754-
majorMinor := regexp.MustCompile(`^(\d+)\.(\d+)`)
1755-
m := majorMinor.FindStringSubmatch(string(version))
1756-
if m == nil {
1757-
log.Fatalf("unsupported sw_vers version %q", version)
1758-
}
1759-
major, minor := m[1], m[2] // "10", "12"
1760-
1761-
// As of macOS 11 (Big Sur), the major digits are used to indicate the version of
1762-
// macOS. This version also introduced support for multiple architectures. This
1763-
// takes into account the need to distinguish between versions and architectures for
1764-
// the later versions.
1765-
mj, err := strconv.Atoi(major)
1766-
if err != nil {
1767-
log.Fatalf("unable to parse major version %q", major)
1768-
}
1769-
if mj >= 13 {
1770-
*reverseType = fmt.Sprintf("host-darwin-%s-%s", runtime.GOARCH, major)
1771-
} else if mj >= 11 {
1772-
// The darwin-amd64-{11,12}_0 hosts have a "_0" suffix as a historical
1773-
// relic from when it distinguished macOS 10.15, 10.14 and older, as below.
1774-
*reverseType = fmt.Sprintf("host-darwin-%s-%s_0", runtime.GOARCH, major)
1775-
} else {
1776-
*reverseType = fmt.Sprintf("host-darwin-%s-%s_%s", runtime.GOARCH, major, minor)
1777-
}
1778-
*coordinator = "farmer.golang.org:443"
1779-
1780-
// guestName is set by cmd/makemac to something like
1781-
// "mac_10_10_host01b" or "mac_10_12_host01a", which encodes
1782-
// three things: the mac OS version of the guest VM, which
1783-
// physical machine it's on (1 to 10, currently) and which of
1784-
// two possible VMs on that host is running (a or b). For
1785-
// monitoring purposes, we want stable hostnames and don't
1786-
// care which OS version is currently running (which changes
1787-
// constantly), so normalize these to only have the host
1788-
// number and side (a or b), without the OS version. The
1789-
// buildlet will report the OS version to the coordinator
1790-
// anyway. We could in theory do this normalization in the
1791-
// coordinator, but we don't want to put buildlet-specific
1792-
// knowledge there, and this file already contains a bunch of
1793-
// buildlet host-specific configuration, so normalize it here.
1794-
guestName := vmwareGetInfo("guestinfo.name") // "mac_10_12_host01a"
1795-
hostPos := strings.Index(guestName, "_host")
1796-
if hostPos == -1 {
1797-
// Assume cmd/makemac changed its conventions.
1798-
// Maybe all this normalization belongs there anyway,
1799-
// but normalizing here is a safer first step.
1800-
*hostname = guestName
1801-
} else {
1802-
*hostname = "macstadium" + guestName[hostPos:] // "macstadium_host01a"
1803-
}
1804-
}
1805-
1806-
func disableMacScreensaver() {
1807-
err := exec.Command("defaults", "-currentHost", "write", "com.apple.screensaver", "idleTime", "0").Run()
1808-
if err != nil {
1809-
log.Printf("disabling screensaver: %v", err)
1810-
}
1811-
}
1812-
1813-
// enableMacDeveloperMode enables developer mode on macOS for the
1814-
// runtime tests. (Issue 31123)
1815-
//
1816-
// It is best effort; errors are logged but otherwise ignored.
1817-
func enableMacDeveloperMode() {
1818-
// Macs are configured with password-less sudo. Without sudo we get prompts
1819-
// that "SampleTools wants to make changes" that block the buildlet from starting.
1820-
// But oddly, not via gomote. Only during startup. The environment must be different
1821-
// enough that in one case macOS asks for permission (because it can use the GUI?)
1822-
// and in the gomote case (where the environment is largely scrubbed) it can't do
1823-
// the GUI dialog somehow and must just try to do it anyway and finds that passwordless
1824-
// sudo works. But using sudo seems to make it always work.
1825-
// For extra paranoia, use a context to not block start-up.
1826-
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
1827-
defer cancel()
1828-
1829-
out, err := exec.CommandContext(ctx, "/usr/bin/sudo", "/usr/sbin/DevToolsSecurity", "-enable").CombinedOutput()
1830-
if err != nil {
1831-
log.Printf("Error enabling developer mode: %v, %s", err, out)
1832-
return
1833-
}
1834-
log.Printf("DevToolsSecurity: %s", out)
1835-
}
1836-
18371736
func vmwareGetInfo(key string) string {
18381737
cmd := exec.Command("/Library/Application Support/VMware Tools/vmware-tools-daemon",
18391738
"--cmd",

cmd/buildlet/reverse.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,6 @@ func keyForMode(mode string) (string, error) {
3333
if isDevReverseMode() {
3434
return devBuilderKey(mode), nil
3535
}
36-
if os.Getenv("GO_BUILDER_ENV") == "macstadium_vm" {
37-
infoKey := "guestinfo.key-" + mode
38-
key := vmwareGetInfo(infoKey)
39-
if key == "" {
40-
return "", fmt.Errorf("no build key found for VMWare info-get key %q", infoKey)
41-
}
42-
return key, nil
43-
}
4436
keyPath := filepath.Join(homedir(), ".gobuildkey-"+mode)
4537
if v := os.Getenv("GO_BUILD_KEY_PATH"); v != "" {
4638
keyPath = v

cmd/buildlet/stage0/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
# The only reason we upload them to GCS is because that's where the
55
# automated VM/container creation scripts download them from.
66
#
7-
# The notable exception is our Mac VMs on MacStadium. In those cases,
8-
# the images actually do download the stage0 binary on start-up.
9-
#
107

118
GO=go1.19
129

cmd/buildlet/stage0/stage0.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import (
2626
"os/exec"
2727
"path/filepath"
2828
"runtime"
29-
"strings"
3029
"time"
3130

3231
"cloud.google.com/go/compute/metadata"
@@ -75,7 +74,6 @@ func main() {
7574
}
7675
log.Printf("bootstrap binary running")
7776

78-
var isMacStadiumVM bool
7977
switch osArch {
8078
case "linux/arm":
8179
if onGCE {
@@ -97,15 +95,6 @@ func main() {
9795
default:
9896
panic(fmt.Sprintf("unknown/unspecified $GO_BUILDER_ENV value %q", env))
9997
}
100-
case "darwin/amd64":
101-
// The MacStadium builders' baked-in stage0.sh
102-
// bootstrap file doesn't set GO_BUILDER_ENV
103-
// unfortunately, so use the filename it runs its
104-
// downloaded bootstrap URL to determine whether we're
105-
// in that environment.
106-
isMacStadiumVM = len(os.Args) > 0 && strings.HasSuffix(os.Args[0], "run-builder")
107-
log.Printf("isMacStadiumVM = %v", isMacStadiumVM)
108-
os.Setenv("GO_BUILDER_ENV", "macstadium_vm")
10998
}
11099

111100
if !awaitNetwork() {
@@ -115,7 +104,6 @@ func main() {
115104
netDelay := prettyDuration(timeNetwork.Sub(timeStart))
116105
log.Printf("network up after %v", netDelay)
117106

118-
Download:
119107
// Note: we name it ".exe" for Windows, but the name also
120108
// works fine on Linux, etc.
121109
target := filepath.FromSlash("./buildlet.exe")
@@ -202,15 +190,6 @@ Download:
202190
case "solaris/amd64", "illumos/amd64":
203191
hostType := buildEnv
204192
cmd.Args = append(cmd.Args, reverseHostTypeArgs(hostType)...)
205-
case "windows/arm64":
206-
switch buildEnv {
207-
case "host-windows-arm64-mini", "host-windows11-arm64-mini":
208-
cmd.Args = append(cmd.Args,
209-
"--halt=true",
210-
"--reverse-type="+buildEnv,
211-
"--coordinator=farmer.golang.org:443",
212-
)
213-
}
214193
}
215194
// Release the serial port (if we opened it) so the buildlet
216195
// process can open & write to it. At least on Windows, only
@@ -219,24 +198,6 @@ Download:
219198
closeSerialLogOutput()
220199
}
221200
err := cmd.Run()
222-
if isMacStadiumVM {
223-
if err != nil {
224-
log.Printf("error running buildlet: %v", err)
225-
log.Printf("restarting in 2 seconds.")
226-
time.Sleep(2 * time.Second) // in case we're spinning, slow it down
227-
} else {
228-
log.Printf("buildlet process exited; restarting.")
229-
}
230-
// Some of the MacStadium VM environments reuse their
231-
// environment. Re-download the buildlet (if it
232-
// changed-- httpdl does conditional downloading) and
233-
// then re-run. At least on Sierra we never get this
234-
// far because the buildlet will halt the machine
235-
// before we get here. (and then cmd/makemac will
236-
// recreate the VM)
237-
// But if we get here, restart the process.
238-
goto Download
239-
}
240201
if err != nil {
241202
if configureSerialLogOutput != nil {
242203
configureSerialLogOutput()

cmd/coordinator/coordinator.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,6 @@ func main() {
360360
mux.HandleFunc("/style.css", handleStyleCSS)
361361
mux.HandleFunc("/try", serveTryStatus(false))
362362
mux.HandleFunc("/try.json", serveTryStatus(true))
363-
mux.HandleFunc("/status/reverse.json", pool.ReversePool().ServeReverseStatusJSON)
364363
mux.HandleFunc("/status/post-submit-active.json", handlePostSubmitActiveJSON)
365364
mux.Handle("/dashboard", dashV2)
366365
mux.HandleFunc("/queues", handleQueues)

cmd/coordinator/coordinator_test.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -250,36 +250,36 @@ func TestIssue42084(t *testing.T) {
250250

251251
// First, determine builds without try messages. Our target SlowBot shouldn't be included.
252252
ts := newTrySet(work)
253-
hasWindowsARM64Builder := false
253+
hasLinuxArmBuilder := false
254254
for _, bs := range ts.builds {
255255
v := bs.NameAndBranch()
256-
if v == "windows-arm64-10" {
257-
hasWindowsARM64Builder = true
256+
if v == "linux-arm" {
257+
hasLinuxArmBuilder = true
258258
}
259259
}
260-
if hasWindowsARM64Builder {
261-
// This test relies on windows-arm64-10 builder not being a default
260+
if hasLinuxArmBuilder {
261+
// This test relies on linux-arm builder not being a default
262262
// TryBot to provide coverage for issue 42084. If the build policy
263263
// changes, need to pick another builder to use in this test.
264-
t.Fatal("windows-arm64-10 builder was included even without TRY= message")
264+
t.Fatal("linux-arm builder was included even without TRY= message")
265265
}
266266

267267
// Next, add try messages, and check that the SlowBot is now included.
268268
work.TryMessage = []*apipb.TryVoteMessage{
269-
{Message: "TRY=windows-amd64", AuthorId: 1234, Version: 1},
270-
{Message: "TRY=windows-arm64-10", AuthorId: 1234, Version: 1},
269+
{Message: "TRY=linux", AuthorId: 1234, Version: 1},
270+
{Message: "TRY=linux-arm", AuthorId: 1234, Version: 1},
271271
}
272272
ts = newTrySet(work)
273-
hasWindowsARM64Builder = false
273+
hasLinuxArmBuilder = false
274274
for i, bs := range ts.builds {
275275
v := bs.NameAndBranch()
276276
t.Logf("build[%d]: %s", i, v)
277-
if v == "windows-arm64-10" {
278-
hasWindowsARM64Builder = true
277+
if v == "linux-arm-aws" {
278+
hasLinuxArmBuilder = true
279279
}
280280
}
281-
if !hasWindowsARM64Builder {
282-
t.Error("windows-arm64-10 SlowBot was not included")
281+
if !hasLinuxArmBuilder {
282+
t.Error("linux-arm SlowBot was not included")
283283
}
284284
}
285285

cmd/coordinator/status.go

Lines changed: 0 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"bytes"
1414
"context"
1515
_ "embed"
16-
"encoding/json"
1716
"errors"
1817
"fmt"
1918
"html"
@@ -147,7 +146,6 @@ func addHealthChecker(mux *http.ServeMux, hc *healthChecker) {
147146
var basePinErr atomic.Value
148147

149148
func addHealthCheckers(ctx context.Context, mux *http.ServeMux, sc *secret.Client) {
150-
addHealthChecker(mux, newMacHealthChecker())
151149
addHealthChecker(mux, newMacOSARM64Checker())
152150
addHealthChecker(mux, newOSUPPC64leChecker())
153151
addHealthChecker(mux, newOSUPPC64lePower9Checker())
@@ -292,81 +290,6 @@ func newGitMirrorChecker() *healthChecker {
292290
}
293291
}
294292

295-
func newMacHealthChecker() *healthChecker {
296-
var hosts []string
297-
const numMacHosts = 8 // physical Mac Pros, not reverse buildlet connections. M1 Macs will be included in separate checks.
298-
for i := 1; i <= numMacHosts; i++ {
299-
for _, suf := range []string{"a", "b"} {
300-
name := fmt.Sprintf("macstadium_host%02d%s", i, suf)
301-
hosts = append(hosts, name)
302-
}
303-
}
304-
checkHosts := reverseHostChecker(hosts)
305-
306-
// And check that the makemac daemon is listening.
307-
var makeMac struct {
308-
sync.Mutex
309-
lastCheck time.Time // currently unused
310-
lastErrors []string
311-
lastWarns []string
312-
}
313-
setMakeMacStatus := func(errs, warns []string) {
314-
makeMac.Lock()
315-
defer makeMac.Unlock()
316-
makeMac.lastCheck = time.Now()
317-
makeMac.lastErrors = errs
318-
makeMac.lastWarns = warns
319-
}
320-
go func() {
321-
for {
322-
errs, warns := fetchMakeMacStatus()
323-
setMakeMacStatus(errs, warns)
324-
time.Sleep(15 * time.Second)
325-
}
326-
}()
327-
return &healthChecker{
328-
ID: "macs",
329-
Title: "MacStadium Mac VMs",
330-
DocURL: "https://github.com/golang/build/tree/master/env/darwin/macstadium",
331-
Check: func(w *checkWriter) {
332-
// Check hosts.
333-
checkHosts(w)
334-
// Check makemac daemon.
335-
makeMac.Lock()
336-
defer makeMac.Unlock()
337-
for _, v := range makeMac.lastWarns {
338-
w.warnf("makemac daemon: %v", v)
339-
}
340-
for _, v := range makeMac.lastErrors {
341-
w.errorf("makemac daemon: %v", v)
342-
}
343-
},
344-
}
345-
}
346-
347-
func fetchMakeMacStatus() (errs, warns []string) {
348-
c := &http.Client{Timeout: 15 * time.Second}
349-
res, err := c.Get("http://macstadiumd.golang.org:8713")
350-
if err != nil {
351-
return []string{fmt.Sprintf("failed to fetch status: %v", err)}, nil
352-
}
353-
defer res.Body.Close()
354-
if res.StatusCode != 200 {
355-
return []string{fmt.Sprintf("HTTP status %v", res.Status)}, nil
356-
}
357-
if res.Header.Get("Content-Type") != "application/json" {
358-
return []string{fmt.Sprintf("unexpected content-type %q; want JSON", res.Header.Get("Content-Type"))}, nil
359-
}
360-
var resj struct {
361-
Errors []string
362-
Warnings []string
363-
}
364-
if err := json.NewDecoder(res.Body).Decode(&resj); err != nil {
365-
return []string{fmt.Sprintf("reading status response body: %v", err)}, nil
366-
}
367-
return resj.Errors, resj.Warnings
368-
}
369-
370293
func newMacOSARM64Checker() *healthChecker {
371294
var expect int // Number of expected darwin/arm64 reverse builders based on x/build/dashboard.
372295
for hostType, hc := range dashboard.Hosts {

cmd/coordinator/status_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,6 @@ func TestHandleStatus_HealthFormatting(t *testing.T) {
9595
t.Fatalf("output didn't contain %q: %s", suf, got)
9696
}
9797
for _, sub := range []string{
98-
`<a href="/status/macs">MacStadium Mac VMs</a> [`,
99-
`<li>macstadium_host06a not yet connected</li>`,
10098
`<a href="/status/allgood">All Good Test</a>: ok`,
10199
`<li>test-info</li>`,
102100
`<li><span style='color: orange'>test-warn</span></li>`,

0 commit comments

Comments
 (0)