dashboard, cmd/coordinator: remove Joyent builders

Joyent.com is shutting down their public cloud, so we no longer
have our GOOS=solaris or GOOS=illumos builders there.

Maybe somebody will find a new place to run them. Or maybe the ports
will be abandoned. We'll see.

Updates golang/go#15581

Change-Id: I0590227ce61b6b298b6aa4554e5e3bc9e4c464b5
Reviewed-on: https://go-review.googlesource.com/c/build/+/200219
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/buildlet/buildlet.go b/cmd/buildlet/buildlet.go
index 734334b..bb9a783 100644
--- a/cmd/buildlet/buildlet.go
+++ b/cmd/buildlet/buildlet.go
@@ -144,13 +144,6 @@
 		startAndroidEmulator()
 	}
 
-	if *reverse == "solaris-amd64-smartosbuildlet" {
-		// These machines were setup without GO_BUILDER_ENV
-		// set in their base image, so do init work here after
-		// flag parsing instead of at top.
-		*rebootOnHalt = true
-	}
-
 	// Optimize emphemeral filesystems. Prefer speed over safety,
 	// since these VMs only last for the duration of one build.
 	switch runtime.GOOS {
@@ -269,21 +262,6 @@
 	// Default if not otherwise configured in dashboard/builders.go:
 	os.Setenv("GOROOT_BOOTSTRAP", filepath.Join(*workDir, "go1.4"))
 
-	if runtime.GOOS == "solaris" && runtime.GOARCH == "amd64" {
-		gbenv := os.Getenv("GO_BUILDER_ENV")
-		if strings.Contains(gbenv, "oracle") {
-			// Oracle Solaris; not OpenSolaris-based or
-			// Illumos-based.  Do nothing.
-			return
-		}
-
-		// Assume this is an OpenSolaris-based machine or a
-		// SmartOS/Illumos machine before GOOS=="illumos" split.  For
-		// these machines, the old Joyent builders need to get the
-		// bootstrap and some config fixed.
-		os.Setenv("PATH", os.Getenv("PATH")+":/opt/local/bin")
-		downloadBootstrapGoroot("/root/go-solaris-amd64-bootstrap", "https://storage.googleapis.com/go-builder-data/gobootstrap-solaris-amd64.tar.gz")
-	}
 	if runtime.GOOS == "linux" && runtime.GOARCH == "ppc64" {
 		downloadBootstrapGoroot("/usr/local/go-bootstrap", "https://storage.googleapis.com/go-builder-data/gobootstrap-linux-ppc64.tar.gz")
 	}
diff --git a/cmd/buildlet/stage0/stage0.go b/cmd/buildlet/stage0/stage0.go
index f964a0b..efcdc8d 100644
--- a/cmd/buildlet/stage0/stage0.go
+++ b/cmd/buildlet/stage0/stage0.go
@@ -195,17 +195,8 @@
 		// Assume OSU (osuosl.org) host type for now. If we get more, use
 		// GO_BUILD_HOST_TYPE (see above) and check that.
 		cmd.Args = append(cmd.Args, reverseHostTypeArgs("host-linux-ppc64le-osu")...)
-	case "solaris/amd64":
+	case "solaris/amd64", "illumos/amd64":
 		hostType := buildEnv
-		if hostType == "" {
-			hostType = "host-solaris-amd64"
-		}
-		cmd.Args = append(cmd.Args, reverseHostTypeArgs(hostType)...)
-	case "illumos/amd64":
-		hostType := buildEnv
-		if hostType == "" {
-			hostType = "host-illumos-amd64-joyent"
-		}
 		cmd.Args = append(cmd.Args, reverseHostTypeArgs(hostType)...)
 	}
 	// Release the serial port (if we opened it) so the buildlet
diff --git a/cmd/coordinator/status.go b/cmd/coordinator/status.go
index cd252eb..6d4cbc8 100644
--- a/cmd/coordinator/status.go
+++ b/cmd/coordinator/status.go
@@ -141,8 +141,6 @@
 	addHealthChecker(newPacketHealthChecker())
 	addHealthChecker(newOSUPPC64Checker())
 	addHealthChecker(newOSUPPC64leChecker())
-	addHealthChecker(newJoyentSolarisChecker())
-	addHealthChecker(newJoyentIllumosChecker())
 	addHealthChecker(newBasepinChecker())
 	addHealthChecker(newGitMirrorChecker())
 	addHealthChecker(newTipGolangOrgChecker(ctx))
@@ -371,24 +369,6 @@
 	return resj.Errors, resj.Warnings
 }
 
-func newJoyentSolarisChecker() *healthChecker {
-	return &healthChecker{
-		ID:     "joyent-solaris",
-		Title:  "Joyent solaris/amd64 machines",
-		DocURL: "https://github.com/golang/build/tree/master/env/solaris-amd64/joyent",
-		Check:  hostTypeChecker("host-solaris-amd64"),
-	}
-}
-
-func newJoyentIllumosChecker() *healthChecker {
-	return &healthChecker{
-		ID:     "joyent-illumos",
-		Title:  "Joyent illumos/amd64 machines",
-		DocURL: "https://github.com/golang/build/tree/master/env/illumos-amd64-joyent",
-		Check:  hostTypeChecker("host-illumos-amd64-joyent"),
-	}
-}
-
 func hostTypeChecker(hostType string) func(cw *checkWriter) {
 	want := expectedHosts(hostType)
 	return func(cw *checkWriter) {
diff --git a/dashboard/builders.go b/dashboard/builders.go
index d28f563..56bc623 100644
--- a/dashboard/builders.go
+++ b/dashboard/builders.go
@@ -441,23 +441,6 @@
 		env:             []string{"GOROOT_BOOTSTRAP=/usr/local/go-bootstrap"},
 		SSHUsername:     "root",
 	},
-	"host-solaris-amd64": &HostConfig{
-		Notes:          "run by Go team on Joyent, on a SmartOS 'infrastructure container'",
-		IsReverse:      true,
-		ExpectNum:      5,
-		env:            []string{"GOROOT_BOOTSTRAP=/root/go-solaris-amd64-bootstrap", "HOME=/root"},
-		ReverseAliases: []string{"solaris-amd64-smartosbuildlet"},
-	},
-	"host-illumos-amd64-joyent": &HostConfig{
-		Notes:     "run by Go team on Joyent, on a SmartOS 'infrastructure container'",
-		IsReverse: true,
-		ExpectNum: 1,
-		env: []string{
-			"GOROOT_BOOTSTRAP=/root/goboot",
-			"HOME=/root",
-			"PATH=/usr/sbin:/usr/bin:/opt/local/bin", // gcc is in /opt/local/bin
-		},
-	},
 	"host-solaris-oracle-amd64-oraclerel": &HostConfig{
 		Notes:       "Oracle Solaris amd64 Release System",
 		Owner:       "", // TODO: find current owner
@@ -2041,24 +2024,6 @@
 		Notes:    "Oracle Solaris release version",
 	})
 	addBuilder(BuildConfig{
-		Name:     "solaris-amd64-smartosbuildlet",
-		HostType: "host-solaris-amd64",
-	})
-	addBuilder(BuildConfig{
-		Name:             "illumos-amd64-joyent",
-		HostType:         "host-illumos-amd64-joyent",
-		MinimumGoVersion: types.MajorMinor{1, 13},
-		buildsRepo: func(repo, branch, goBranch string) bool {
-			if repo == "review" {
-				// '.git/hooks/pre-commit' cannot be executed on this builder,
-				// which causes the x/review tests to fail.
-				// (https://golang.org/issue/32836)
-				return false
-			}
-			return defaultBuildsRepoPolicy(repo, branch, goBranch)
-		},
-	})
-	addBuilder(BuildConfig{
 		Name:     "linux-ppc64-buildlet",
 		HostType: "host-linux-ppc64-osu",
 		FlakyNet: true,
@@ -2304,7 +2269,9 @@
 func onlyGo(repo, branch, goBranch string) bool { return repo == "go" }
 
 // onlyMaster is a common buildsRepo policy value that only builds things on the master branch.
-func onlyMaster(repo, branch, goBranch string) bool { return branch == "master" && goBranch == "master" }
+func onlyMaster(repo, branch, goBranch string) bool {
+	return branch == "master" && goBranch == "master"
+}
 
 // disabledBuilder is a buildsRepo policy function that always return false.
 func disabledBuilder(repo, branch, goBranch string) bool { return false }
diff --git a/dashboard/builders_test.go b/dashboard/builders_test.go
index edd2ef9..53649f4 100644
--- a/dashboard/builders_test.go
+++ b/dashboard/builders_test.go
@@ -368,16 +368,6 @@
 		{b("aix-ppc64@go1.11", "net"), none},
 		{b("aix-ppc64@go1.11", "mobile"), none},
 
-		// Illumos starts at Go 1.13
-		{b("illumos-amd64-joyent", "go"), onlyPost},
-		{b("illumos-amd64-joyent", "net"), onlyPost},
-		{b("illumos-amd64-joyent", "sys"), onlyPost},
-		{b("illumos-amd64-joyent@1.13", "go"), onlyPost},
-		{b("illumos-amd64-joyent@1.12", "go"), none},
-		{b("illumos-amd64-joyent@1.12", "sys"), none},
-		{b("illumos-amd64-joyent@1.11", "go"), none},
-		{b("illumos-amd64-joyent@1.11", "sys"), none},
-
 		{b("linux-amd64-nocgo", "mobile"), none},
 
 		// Virtual mobiledevices
diff --git a/env/illumos-amd64-joyent/README.md b/env/illumos-amd64-joyent/README.md
deleted file mode 100644
index cf61a11..0000000
--- a/env/illumos-amd64-joyent/README.md
+++ /dev/null
@@ -1,77 +0,0 @@
-# Illumos Builder
-
-This instructions for the Illumos builder that the Go team runs on Joyent.
-
-# Prep files from Linux
-
-```
-bradfitz@go:~/go/src$ GOOS=illumos GOARCH=amd64 BOOTSTRAP_FORMAT=mintgz ./bootstrap.bash
-...
-...
-Writing gobootstrap-illumos-amd64-e883d000f4.tar.gz ...
--rw-r--r-- 1 bradfitz bradfitz 51647155 May 29 17:24 /home/bradfitz/gobootstrap-illumos-amd64-e883d000f4.tar.gz
-
-bradfitz@go:~/go/src$ go install golang.org/x/build/cmd/upload
-bradfitz@go:~/go/src$ upload --file=/home/bradfitz/gobootstrap-illumos-amd64-e883d000f4.tar.gz --public go-builder-data/gobootstrap-illumos-amd64-e883d000f4.tar.gz
-
-$ cd $GOPATH/src/golang.org/x/build/cmd/buildlet
-$ make buildlet.illumos-amd64
-$ cd $GOPATH/src/golang.org/x/build/cmd/buildlet/stage0
-$ make buildlet-stage0.illumos-amd64
-
-```
-
-# Create VM on Joyent
-
-* at least 2 CPUs, at least 1 GB ram. (I used `g4-highcpu-4G` somewhat arbitrarily)
-
-# Prep VM
-
-```
-bradfitz@go:~$ ssh -i ~/.ssh/id_rsa_golang2 root@$IP
-...
-# curl -O https://storage.googleapis.com/go-builder-data/gobootstrap-illumos-amd64-e883d000f4.tar.gz
-# mkdir goboot
-# cd goboot
-# tar -zxvf ../gobootstrap-illumos-amd64-e883d000f4.tar.gz
-# pkgin in gcc47
-# rm /opt/local/sbin/mysqld
-# rm /opt/local/sbin/httpd
-# cat > /root/.gobuildkey-host-illumos-amd64-joyent
-xxxx
-^D
-# curl -o /opt/buildlet-stage0 https://storage.googleapis.com/go-builder-data/buildlet-stage0.illumos-amd64
-# chmod +x /opt/buildlet-stage0
-# curl -O https://raw.githubusercontent.com/golang/build/master/env/solaris-amd64/joyent/buildlet.xml
-# svccfg import buildlet.xml
-```
-
-The service should be running now. Shut down the machine and create an
-image from the Joyent web console.
-
-If you need to debug, you can check status with:
-
-```
-svcs -x buildlet.xml
-```
-
-This will also give you the location to the log file.
-
-If you need to change an environment variable, place this inside the start
-exec_method element:
-
-```
-<method_context>
-    <method_environment>
-       <envvar name="EXAMPLE" value="foo"/>
-    </method_environment>
-</method_context>
-```
-
-To debug an instance once it's running, you can ssh as:
-
-```
-$ ssh -i ~/.ssh/id_rsa_golang2 root@$IP
-```
-
-The key is at http://go/id_rsa_golang2
diff --git a/env/solaris-amd64/joyent/README b/env/solaris-amd64/joyent/README
deleted file mode 100644
index f32925e..0000000
--- a/env/solaris-amd64/joyent/README
+++ /dev/null
@@ -1,56 +0,0 @@
-This is currently how we run the "solaris-amd64" builder but it's
-really illumos and once we have GOOS=illumos vs GOOS=solaris split
-(https://golang.org/issue/52630), then this will need work to rebuild
-the images.
-
-This runs on Joyent:
-
-   Username: gobuild
-   Password: http://go/golang-joyent
-
-To create a working image:
-
-* Create a new Infrastructure Container instance from the "base-64" image
-* ssh in as root (account will have key info)
-* Copy the build key to the machine at /root/.gobuildkey
-* Download the stage0:
-
-  cd /opt
-  /opt/local/bin/curl -f -R \
-    -z buildlet-stage0 \
-    -o buildlet-stage0 \
-    https://storage.googleapis.com/go-builder-data/buildlet-stage0.solaris-amd64
-  chmod +x /opt/buildlet-stage0
-
-* Install gcc:
-
-  pkgin in gcc47
-
-* Copy buildlet.xml to the machine anywhere
-* Run as root:
-  svccfg import buildlet.xml
-
-Service should be running now.  Shut down the machine and create an image from
-the Joyent web console.
-
-If you need to debug, you can check status with:
-
-svcs -x buildlet.xml
-
-This will also give you the location to the log file.
-
-If you need to change an environment variable, place this inside the start
-exec_method element:
-
-<method_context>
-        <method_environment>
-                <envvar name="EXAMPLE" value="foo"/>
-        </method_environment>
-</method_context>
-
-
-To debug an instance once it's running, you can ssh as:
-
-$ ssh -i ~/.ssh/id_rsa_golang2 root@$IP
-
-The key is at http://go/id_rsa_golang2
diff --git a/env/solaris-amd64/joyent/buildlet.xml b/env/solaris-amd64/joyent/buildlet.xml
deleted file mode 100644
index 3055140..0000000
--- a/env/solaris-amd64/joyent/buildlet.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
-	<service_bundle type="manifest" name="buildlet">
-	<service name="network/buildlet" type="service" version="1">
-		<create_default_instance enabled="true"/>
-		<single_instance/>
-		<dependency name="network" grouping="require_all" restart_on="error" type="service">
-			<service_fmri value="svc:/milestone/network:default"/>
-		</dependency>
-		<dependency name="filesystem" grouping="require_all" restart_on="error" type="service">
-			<service_fmri value="svc:/system/filesystem/local"/>
-		</dependency>
-
-
-		<exec_method type="method" name="start" exec="/opt/buildlet-stage0" timeout_seconds="60"/>
-		<exec_method type="method" name="stop" exec=":kill" timeout_seconds="60"/>
-		<property_group name="startd" type="framework">
-			<propval name="duration" type="astring" value="child"/>
-			<propval name="ignore_error" type="astring" value="core,signal"/>
-		</property_group>
-
-		<property_group name="application" type="application">	
-		</property_group>
-		<stability value="Evolving"/>
-		<template>
-			<common_name>
-				<loctext xml:lang="C">
-					Go Buildlet
-				</loctext>
-			</common_name>
-		</template>
-	</service>
-</service_bundle>
diff --git a/env/solaris-amd64/make.bash b/env/solaris-amd64/make.bash
deleted file mode 100644
index db1f183..0000000
--- a/env/solaris-amd64/make.bash
+++ /dev/null
@@ -1,144 +0,0 @@
-#!/bin/bash
-# Copyright 2016 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-# The following variables need to be configured either
-# below or externally.
-
-if [ -z ${GOBUILDKEY+x} ]; then
-    GOBUILDKEY="" # FILL ME IN
-fi
-
-if [ -z ${COORDINATOR+x} ]; then
-    COORDINATOR="" # FILL ME IN
-fi
-
-if [ -z ${BUILDLET_NAME+x} ]; then
-    BUILDLET_NAME="" # FILL ME IN
-fi
-
-######################################################
-
-readonly BUILDLET_URL="https://storage.googleapis.com/go-builder-data/buildlet.solaris-amd64"
-readonly BOOTSTRAP_URL="https://storage.googleapis.com/go-builder-data/gobootstrap-solaris-amd64.tar.gz"
-
-# We need git to grab the source files and gcc for cgo.
-pkg update
-pkg install git gcc
-
-# Get the bootstrapper.
-mkdir -p /usr/local/go-bootstrap
-(cd /usr/local/go-bootstrap && curl --silent $BOOTSTRAP_URL | tar xf -)
-chown -R root:root /usr/local/go-bootstrap
-
-# Set up the key.
-echo $GOBUILDKEY > /root/.gobuildkey
-
-# Write the startup script.
-cat > /lib/svc/method/svc-buildlet <<EOF
-#!/usr/sbin/sh
-#
-# Start method script for the go buildlet service.
-#
-
-. /lib/svc/share/smf_include.sh
-
-if /usr/bin/pgrep -x -u 0 -z \`smf_zonename\` buildlet >/dev/null 2>&1; then
-    echo "\$0: buildlet is already running"
-    exit \$SMF_EXIT_ERR_NOSMF
-fi
-
-while true; do
-    # Get the buildlet
-    /usr/bin/curl --silent $BUILDLET_URL > /root/buildlet
-    chmod +x /root/buildlet
-    /root/buildlet -coordinator=$COORDINATOR:443 -reverse=$BUILDLET_NAME -halt=false 2>/dev/null
-done &
-
-exit \$SMF_EXIT_OK
-EOF
-
-# Make executable
-chmod +x /lib/svc/method/svc-buildlet
-
-# Write the service manifest.
-cat > /lib/svc/manifest/site/buildlet.xml <<EOF
-<?xml version="1.0"?>
-<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
-
-<service_bundle type='manifest' name='golang-buildlet:buildlet'>
-
-<service
-    name='site/buildlet'
-    type='service'
-    version='1'>
-
-    <create_default_instance enabled='true' />
-
-    <single_instance/>
-
-    <dependency
-        name='usr'
-        grouping='require_all'
-        restart_on='none'
-        type='service'>
-        <service_fmri value='svc:/system/filesystem/minimal' />
-    </dependency>
-
-    <dependency
-        name='network'
-        grouping='require_all'
-        restart_on='none'
-        type='service'>
-        <service_fmri value='svc:/milestone/network' />
-    </dependency>
-
-    <dependency
-         name='rds_single'
-         grouping='require_all'
-         restart_on='none'
-        type='service'>
-        <service_fmri value='svc:/milestone/single-user' />
-    </dependency>
-
-    <method_context>
-        <method_credential
-            user='root'
-            group='root'
-            privileges='basic,net_icmpaccess,net_rawaccess' />
-    </method_context>
-
-    <exec_method
-        type='method'
-        name='start'
-        exec='/lib/svc/method/svc-buildlet'
-        timeout_seconds='60' >
-    </exec_method>
-
-    <exec_method
-        type='method'
-        name='stop'
-        exec=':kill'
-        timeout_seconds='60' >
-    </exec_method>
-
-    <property_group name="startd" type="framework">
-        <propval name="ignore_error" type="astring" value="core,signal" />
-    </property_group>
-
-    <stability value='Evolving' />
-
-    <template>
-        <common_name>
-            <loctext xml:lang='C'> Go Buildlet Service
-            </loctext>
-        </common_name>
-    </template>
-</service>
-
-</service_bundle>
-EOF
-
-# Install the service.
-svcadm restart manifest-import
\ No newline at end of file