blob: d9fedb46a3b35669c4a41342e3460152aff62bca [file] [log] [blame]
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -08001// Copyright 2015 The Go Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style
3// license that can be found in the LICENSE file.
4
5// Package dashboard contains shared configuration and logic used by various
6// pieces of the Go continuous build system.
7package dashboard
8
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -07009import (
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +000010 "fmt"
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -070011 "strconv"
12 "strings"
Evan Browna7311512016-02-14 15:59:59 -080013
14 "golang.org/x/build/buildenv"
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -070015)
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080016
17// Builders are the different build configurations.
18// The keys are like "darwin-amd64" or "linux-386-387".
19// This map should not be modified by other packages.
20var Builders = map[string]BuildConfig{}
21
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +000022// Hosts contains the names and configs of all the types of
23// buildlets. They can be VMs, containers, or dedicated machines.
24var Hosts = map[string]*HostConfig{
25 "host-linux-kubestd": &HostConfig{
26 Notes: "Kubernetes container on GKE.",
Brad Fitzpatrickc87bb982016-10-12 14:59:20 +000027 KubeImage: "linux-x86-std-kube:latest",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +000028 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
29 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
30 },
Brad Fitzpatrick46ecb432016-09-23 20:44:43 +000031 "host-linux-armhf-cross": &HostConfig{
32 Notes: "Kubernetes container on GKE built from env/crosscompile/linux-armhf-jessie",
33 KubeImage: "linux-armhf-jessie:latest",
34 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
35 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
36 },
37
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +000038 "host-nacl-kube": &HostConfig{
39 Notes: "Kubernetes container on GKE.",
40 KubeImage: "linux-x86-nacl:latest",
41 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
42 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
43 },
44 "host-s390x-cross-kube": &HostConfig{
45 Notes: "Kubernetes container on GKE.",
46 KubeImage: "linux-s390x-stretch:latest",
47 buildletURLTmpl: "https://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
48 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
49 },
50 "host-linux-clang": &HostConfig{
51 Notes: "GCE VM with clang.",
52 VMImage: "linux-buildlet-clang",
53 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
54 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
55 },
56 "host-linux-sid": &HostConfig{
57 Notes: "GCE VM with Debian sid.",
58 VMImage: "linux-buildlet-sid",
59 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.linux-amd64",
60 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
61 },
62 "host-linux-arm": &HostConfig{
63 IsReverse: true,
64 env: []string{"GOROOT_BOOTSTRAP=/usr/local/go"},
65 ReverseAliases: []string{"linux-arm", "linux-arm-arm5"},
66 },
Brad Fitzpatrick47762722016-12-10 19:10:49 +000067 "host-openbsd-amd64-60": &HostConfig{
68 VMImage: "openbsd-amd64-60",
69 machineType: "n1-highcpu-4",
70 buildletURLTmpl: "https://storage.googleapis.com/$BUCKET/buildlet.openbsd-amd64",
71 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/gobootstrap-openbsd-amd64-60.tar.gz",
72 Notes: "OpenBSD 6.0; GCE VM is built from script in build/env/openbsd-amd64",
73 },
Brad Fitzpatrickd6215412016-12-14 22:41:25 +000074 "host-openbsd-386-60": &HostConfig{
75 VMImage: "openbsd-386-60",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +000076 machineType: "n1-highcpu-4",
77 buildletURLTmpl: "https://storage.googleapis.com/$BUCKET/buildlet.openbsd-386",
Brad Fitzpatrickd6215412016-12-14 22:41:25 +000078 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/gobootstrap-openbsd-386-60.tar.gz",
79 Notes: "OpenBSD 6.0; GCE VM is built from script in build/env/openbsd-386",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +000080 },
81 "host-freebsd-93-gce": &HostConfig{
82 VMImage: "freebsd-amd64-gce93",
83 machineType: "n1-highcpu-4",
84 buildletURLTmpl: "https://storage.googleapis.com/$BUCKET/buildlet.freebsd-amd64",
85 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-freebsd-amd64.tar.gz",
86 },
87 "host-freebsd-101-gce": &HostConfig{
88 VMImage: "freebsd-amd64-gce101",
89 Notes: "FreeBSD 10.1; GCE VM is built from script in build/env/freebsd-amd64",
90 machineType: "n1-highcpu-4",
91 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.freebsd-amd64", // TODO(bradfitz): why was this http instead of https?
92 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-freebsd-amd64.tar.gz",
93 env: []string{"CC=clang"},
94 },
95 "host-netbsd-gce": &HostConfig{
96 VMImage: "netbsd-amd64-gce",
97 Notes: "NetBSD tip; GCE VM is built from script in build/env/netbsd-amd64",
98 machineType: "n1-highcpu-2",
99 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.netbsd-amd64",
100 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/gobootstrap-netbsd-amd64.tar.gz",
101 },
102 "host-plan9-386-gce": &HostConfig{
Brad Fitzpatrick5cdbabd2016-10-18 13:25:38 +0000103 VMImage: "plan9-386-v4",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000104 Notes: "Plan 9 from 0intro; GCE VM is built from script in build/env/plan9-386",
105 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.plan9-386",
106 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/gobootstrap-plan9-386.tar.gz",
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800107
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000108 // We *were* using n1-standard-1 because Plan 9 can only
109 // reliably use a single CPU. Using 2 or 4 and we see
110 // test failures. See:
111 // https://golang.org/issue/8393
112 // https://golang.org/issue/9491
113 // n1-standard-1 has 3.6 GB of memory which WAS (see below)
114 // overkill (userspace probably only sees 2GB anyway),
115 // but it's the cheapest option. And plenty to keep
116 // our ~250 MB of inputs+outputs in its ramfs.
117 //
118 // But the docs says "For the n1 series of machine
119 // types, a virtual CPU is implemented as a single
120 // hyperthread on a 2.6GHz Intel Sandy Bridge Xeon or
121 // Intel Ivy Bridge Xeon (or newer) processor. This
122 // means that the n1-standard-2 machine type will see
123 // a whole physical core."
124 //
125 // ... so we used n1-highcpu-2 (1.80 RAM, still
126 // plenty), just so we can get 1 whole core for the
127 // single-core Plan 9. It will see 2 virtual cores and
128 // only use 1, but we hope that 1 will be more powerful
129 // and we'll stop timing out on tests.
130 machineType: "n1-highcpu-4",
David du Colombier3689a132016-12-02 00:15:58 +0100131 env: []string{"GO_TEST_TIMEOUT_SCALE=2"},
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000132 },
133 "host-windows-gce": &HostConfig{
134 VMImage: "windows-buildlet-v2",
135 machineType: "n1-highcpu-4",
136 buildletURLTmpl: "http://storage.googleapis.com/$BUCKET/buildlet.windows-amd64",
137 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-windows-amd64.tar.gz",
138 RegularDisk: true,
139 },
140 "host-darwin-10_8": &HostConfig{
141 IsReverse: true,
142 Notes: "MacStadium OS X 10.8 VM under VMWare ESXi",
143 env: []string{
144 "GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
145 },
146 ReverseAliases: []string{"darwin-amd64-10_8"},
147 },
148 "host-darwin-10_10": &HostConfig{
149 IsReverse: true,
150 Notes: "MacStadium OS X 10.10 VM under VMWare ESXi",
151 env: []string{
152 "GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
153 },
154 ReverseAliases: []string{"darwin-amd64-10_10"},
155 },
156 "host-darwin-10_11": &HostConfig{
157 IsReverse: true,
158 Notes: "MacStadium OS X 10.11 VM under VMWare ESXi",
159 env: []string{
160 "GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
161 },
162 ReverseAliases: []string{"darwin-amd64-10_11"},
163 },
Brad Fitzpatrick409147c2017-01-18 22:45:12 +0000164 "host-darwin-10_12": &HostConfig{
165 IsReverse: true,
166 Notes: "MacStadium OS X 10.12 VM under VMWare ESXi",
167 env: []string{
168 "GOROOT_BOOTSTRAP=/Users/gopher/go1.4",
169 },
170 ReverseAliases: []string{"darwin-amd64-10_12"},
171 },
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000172 "host-linux-s390x": &HostConfig{
173 Notes: "run by IBM",
174 IsReverse: true,
175 env: []string{"GOROOT_BOOTSTRAP=/var/buildlet/go-linux-s390x-bootstrap"},
176 ReverseAliases: []string{"linux-s390x-ibm"},
177 },
Brad Fitzpatrickf8a31062016-10-06 20:30:58 +0000178 "host-linux-ppc64-osu": &HostConfig{
179 Notes: "Debian jessie; run by Go team on osuosl.org",
180 IsReverse: true,
181 env: []string{"GOROOT_BOOTSTRAP=/usr/local/go-bootstrap"},
182 ReverseAliases: []string{"linux-ppc64-buildlet"},
183 },
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000184 "host-linux-ppc64le-osu": &HostConfig{
185 Notes: "Debian jessie; run by Go team on osuosl.org",
186 IsReverse: true,
187 env: []string{"GOROOT_BOOTSTRAP=/usr/local/go-bootstrap"},
188 ReverseAliases: []string{"linux-ppc64le-buildlet"},
189 },
190 "host-linux-arm64-linaro": &HostConfig{
191 Notes: "Ubuntu wily; run by Go team, from linaro",
192 IsReverse: true,
193 env: []string{"GOROOT_BOOTSTRAP=/usr/local/go-bootstrap"},
194 ReverseAliases: []string{"linux-arm64-buildlet"},
195 },
196 "host-solaris-amd64": &HostConfig{
197 Notes: "run by Go team on Joyent, on a SmartOS 'infrastructure container'",
198 IsReverse: true,
199 env: []string{"GOROOT_BOOTSTRAP=/root/go-solaris-amd64-bootstrap"},
200 ReverseAliases: []string{"solaris-amd64-smartosbuildlet"},
201 },
Brad Fitzpatrick31e2bfa2016-11-03 17:35:15 +0000202 "host-linux-mips": &HostConfig{
Brad Fitzpatrick01647ec2016-11-09 18:53:36 +0000203 Notes: "Run by Brendan Kirby, imgtec.com",
204 IsReverse: true,
205 env: []string{
206 "GOROOT_BOOTSTRAP=/usr/local/go-bootstrap-mips",
207 "GOARCH=mips",
208 "GOHOSTARCH=mips",
Brad Fitzpatrick47762722016-12-10 19:10:49 +0000209 "GO_TEST_TIMEOUT_SCALE=4",
Brad Fitzpatrick01647ec2016-11-09 18:53:36 +0000210 },
Brad Fitzpatrick31e2bfa2016-11-03 17:35:15 +0000211 ReverseAliases: []string{"linux-mips"},
212 },
213 "host-linux-mipsle": &HostConfig{
Brad Fitzpatrick01647ec2016-11-09 18:53:36 +0000214 Notes: "Run by Brendan Kirby, imgtec.com",
215 IsReverse: true,
216 env: []string{
217 "GOROOT_BOOTSTRAP=/usr/local/go-bootstrap-mipsle",
218 "GOARCH=mipsle",
219 "GOHOSTARCH=mipsle",
220 },
Brad Fitzpatrick31e2bfa2016-11-03 17:35:15 +0000221 ReverseAliases: []string{"linux-mipsle"},
222 },
223 "host-linux-mips64": &HostConfig{
Brad Fitzpatrick01647ec2016-11-09 18:53:36 +0000224 Notes: "Run by Brendan Kirby, imgtec.com",
225 IsReverse: true,
226 env: []string{
227 "GOROOT_BOOTSTRAP=/usr/local/go-bootstrap-mips64",
228 "GOARCH=mips64",
229 "GOHOSTARCH=mips64",
Brad Fitzpatrick47762722016-12-10 19:10:49 +0000230 "GO_TEST_TIMEOUT_SCALE=4",
Brad Fitzpatrick01647ec2016-11-09 18:53:36 +0000231 },
Brad Fitzpatrick31e2bfa2016-11-03 17:35:15 +0000232 ReverseAliases: []string{"linux-mips64"},
233 },
234 "host-linux-mips64le": &HostConfig{
Brad Fitzpatrick01647ec2016-11-09 18:53:36 +0000235 Notes: "Run by Brendan Kirby, imgtec.com",
236 IsReverse: true,
237 env: []string{
238 "GOROOT_BOOTSTRAP=/usr/local/go-bootstrap-mips64le",
239 "GOARCH=mips64le",
240 "GOHOSTARCH=mips64le",
241 },
Brad Fitzpatrick31e2bfa2016-11-03 17:35:15 +0000242 ReverseAliases: []string{"linux-mips64le"},
243 },
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000244}
245
246func init() {
247 for key, c := range Hosts {
248 if key == "" {
249 panic("empty string key in Hosts")
250 }
251 if c.HostType == "" {
252 c.HostType = key
253 }
254 if c.HostType != key {
255 panic(fmt.Sprintf("HostType %q != key %q", c.HostType, key))
256 }
257 nSet := 0
258 if c.VMImage != "" {
259 nSet++
260 }
261 if c.KubeImage != "" {
262 nSet++
263 }
264 if c.IsReverse {
265 nSet++
266 }
267 if nSet != 1 {
268 panic(fmt.Sprintf("exactly one of VMImage, KubeImage, IsReverse must be set for host %q; got %v", key, nSet))
269 }
270 if c.buildletURLTmpl == "" && (c.VMImage != "" || c.KubeImage != "") {
271 panic(fmt.Sprintf("missing buildletURLTmpl for host type %q", key))
272 }
273 }
274}
275
276// A HostConfig describes the available ways to obtain buildlets of
277// different types. Some host configs can server multiple
278// builders. For example, a host config of "host-linux-kube-std" can
279// serve linux-amd64, linux-amd64-race, linux-386, linux-386-387, etc.
280type HostConfig struct {
281 // HostType is the unique name of this host config. It is also
282 // the key in the Hosts map.
283 HostType string
284
285 // buildletURLTmpl is the URL "template" ($BUCKET is auto-expanded)
286 // for the URL to the buildlet binary.
287 // This field is required for GCE and Kubernetes builders. It's not
288 // needed for reverse buildlets because in that case, the buildlets
289 // are already running and their stage0 should know how to update it
290 // it automatically.
291 buildletURLTmpl string
292
293 // Exactly 1 of these must be set:
Brad Fitzpatrick47762722016-12-10 19:10:49 +0000294 VMImage string // e.g. "openbsd-amd64-60"
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000295 KubeImage string // e.g. "linux-buildlet-std:latest" (suffix after "gcr.io/<PROJ>/")
296 IsReverse bool // if true, only use the reverse buildlet pool
297
298 // GCE options, if VMImage != ""
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800299 machineType string // optional GCE instance type
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000300 RegularDisk bool // if true, use spinning disk instead of SSD
301
302 // Optional base env. GOROOT_BOOTSTRAP should go here if the buildlet
303 // has Go 1.4+ baked in somewhere.
304 env []string
Andrew Gerrand8e28dc92016-03-22 09:05:52 +1100305
306 // These template URLs may contain $BUCKET which is expanded to the
307 // relevant Cloud Storage bucket as specified by the build environment.
308 goBootstrapURLTmpl string // optional URL to a built Go 1.4+ tar.gz
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800309
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000310 Owner string // optional email of owner; "bradfitz@golang.org", empty means golang-dev
311 Notes string // notes for humans
312
313 // ReverseAliases lists alternate names for this buildlet
314 // config, for older clients doing a reverse dial into the
315 // coordinator from outside. This prevents us from updating
316 // 75+ dedicated machines/VMs atomically, switching them to
317 // the new "host-*" names.
318 // This is only applicable if IsReverse.
319 ReverseAliases []string
320}
321
322// A BuildConfig describes how to run a builder.
323type BuildConfig struct {
324 // Name is the unique name of the builder, in the form of
325 // "GOOS-GOARCH" or "GOOS-GOARCH-suffix". For example,
326 // "darwin-386", "linux-386-387", "linux-amd64-race". Some
327 // suffixes are well-known and carry special meaning, such as
328 // "-race".
329 Name string
330
331 // HostType is the required key into the Hosts map, describing
332 // the type of host this build will run on.
333 // For example, "host-linux-kube-std".
334 HostType string
335
336 Notes string // notes for humans
337
Brad Fitzpatrickeb52e712015-05-13 18:38:20 -0700338 TryOnly bool // only used for trybots, and not regular builds
Brad Fitzpatrickde72d462016-05-04 17:47:12 +0000339 CompileOnly bool // if true, compile tests, but don't run them
Brad Fitzpatrick00003f42016-05-06 18:55:26 +0000340 FlakyNet bool // network tests are flaky (try anyway, but ignore some failures)
Brad Fitzpatrick1c6d9162015-03-20 16:14:52 -0700341
Brad Fitzpatricke37005b2016-09-22 23:29:31 +0000342 // StopAfterMake causes the build to stop after the make
343 // script completes, returning its result as the result of the
344 // whole build. It does not run or compile any of the tests,
345 // nor does it write a snapshot of the world to cloud
346 // storage. This option is only supported for builders whose
347 // BuildConfig.SplitMakeRun returns true.
348 StopAfterMake bool
349
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000350 // numTestHelpers is the number of _additional_ buildlets
351 // past the first one to help out with sharded tests.
352 // For trybots, the numTryHelpers value is used, unless it's
353 // zero, in which case numTestHelpers is used.
354 numTestHelpers int
355 numTryTestHelpers int // for trybots. if 0, numTesthelpers is used
Brad Fitzpatrick79f3fc02015-05-27 21:51:25 -0700356
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -0700357 env []string // extra environment ("key=value") pairs
358 allScriptArgs []string
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800359}
360
Andrew Gerrandcae837b2015-08-04 12:19:02 +1000361func (c *BuildConfig) Env() []string {
Brad Fitzpatrick00003f42016-05-06 18:55:26 +0000362 env := []string{"GO_BUILDER_NAME=" + c.Name}
363 if c.FlakyNet {
364 env = append(env, "GO_BUILDER_FLAKY_NET=1")
365 }
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000366 env = append(env, c.hostConf().env...)
Brad Fitzpatrick00003f42016-05-06 18:55:26 +0000367 return append(env, c.env...)
Andrew Gerrandcae837b2015-08-04 12:19:02 +1000368}
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800369
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000370func (c *BuildConfig) IsReverse() bool { return c.hostConf().IsReverse }
371
372func (c *BuildConfig) IsKube() bool { return c.hostConf().IsKube() }
373func (c *HostConfig) IsKube() bool { return c.KubeImage != "" }
374
375func (c *BuildConfig) IsGCE() bool { return c.hostConf().IsGCE() }
376func (c *HostConfig) IsGCE() bool { return c.VMImage != "" }
377
Brad Fitzpatrickf3c01932015-01-15 16:29:16 -0800378func (c *BuildConfig) GOOS() string { return c.Name[:strings.Index(c.Name, "-")] }
379
380func (c *BuildConfig) GOARCH() string {
381 arch := c.Name[strings.Index(c.Name, "-")+1:]
382 i := strings.Index(arch, "-")
383 if i == -1 {
384 return arch
385 }
386 return arch[:i]
387}
388
Brad Fitzpatrick79f3fc02015-05-27 21:51:25 -0700389// FilePathJoin is mostly like filepath.Join (without the cleaning) except
390// it uses the path separator of c.GOOS instead of the host system's.
391func (c *BuildConfig) FilePathJoin(x ...string) string {
392 if c.GOOS() == "windows" {
393 return strings.Join(x, "\\")
394 }
395 return strings.Join(x, "/")
396}
397
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000398func (c *BuildConfig) hostConf() *HostConfig {
399 if c, ok := Hosts[c.HostType]; ok {
400 return c
401 }
402 panic(fmt.Sprintf("missing buildlet config for buildlet %q", c.Name))
Andrew Gerrand8e28dc92016-03-22 09:05:52 +1100403}
404
405// BuildletBinaryURL returns the public URL of this builder's buildlet.
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000406func (c *BuildConfig) GoBootstrapURL(e *buildenv.Environment) string {
407 return strings.Replace(c.hostConf().goBootstrapURLTmpl, "$BUCKET", e.BuildletBucket, 1)
408}
409
410// BuildletBinaryURL returns the public URL of this builder's buildlet.
411func (c *HostConfig) BuildletBinaryURL(e *buildenv.Environment) string {
Andrew Gerrand8e28dc92016-03-22 09:05:52 +1100412 tmpl := c.buildletURLTmpl
Evan Browna7311512016-02-14 15:59:59 -0800413 return strings.Replace(tmpl, "$BUCKET", e.BuildletBucket, 1)
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800414}
415
Brad Fitzpatricka5383ff2015-06-17 08:22:14 -0700416func (c *BuildConfig) IsRace() bool {
417 return strings.HasSuffix(c.Name, "-race")
418}
419
Brad Fitzpatrickf8c24842015-01-16 09:54:03 -0800420// AllScript returns the relative path to the operating system's script to
421// do the build and run its standard set of tests.
422// Example values are "src/all.bash", "src/all.bat", "src/all.rc".
423func (c *BuildConfig) AllScript() string {
Brad Fitzpatricka5383ff2015-06-17 08:22:14 -0700424 if c.IsRace() {
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800425 if strings.HasPrefix(c.Name, "windows-") {
426 return "src/race.bat"
427 }
428 return "src/race.bash"
429 }
Brad Fitzpatrickf8c24842015-01-16 09:54:03 -0800430 if strings.HasPrefix(c.Name, "windows-") {
431 return "src/all.bat"
432 }
433 if strings.HasPrefix(c.Name, "plan9-") {
434 return "src/all.rc"
435 }
Brad Fitzpatrick0e84fc72015-02-18 14:12:22 -0800436 if strings.HasPrefix(c.Name, "nacl-") {
437 return "src/nacltest.bash"
438 }
David Crawshaw953e8692015-09-03 13:35:10 -0400439 if strings.HasPrefix(c.Name, "android-") {
440 return "src/androidtest.bash"
441 }
David Crawshawe078c6f2015-04-29 08:54:19 -0400442 if strings.HasPrefix(c.Name, "darwin-arm") {
443 return "src/iostest.bash"
444 }
Brad Fitzpatrick8c6116a2016-05-05 00:42:49 +0000445 if strings.HasPrefix(c.Name, "misc-compile") {
Brad Fitzpatrickab7ff8a2015-04-29 14:44:46 -0700446 return "src/buildall.bash"
447 }
Brad Fitzpatrickf8c24842015-01-16 09:54:03 -0800448 return "src/all.bash"
449}
450
Brad Fitzpatrick7d9b0362015-05-27 11:51:27 -0700451// SplitMakeRun reports whether the coordinator should first compile
452// (using c.MakeScript), then snapshot, then run the tests (ideally
453// sharded) using c.RunScript.
454// Eventually this function should always return true (and then be deleted)
455// but for now we've only set up the scripts and verified that the main
456// configurations work.
457func (c *BuildConfig) SplitMakeRun() bool {
458 switch c.AllScript() {
Brad Fitzpatrickde72d462016-05-04 17:47:12 +0000459 case "src/all.bash", "src/all.bat",
460 "src/race.bash", "src/race.bat",
461 "src/all.rc",
462 "src/nacltest.bash":
Brad Fitzpatrick7d9b0362015-05-27 11:51:27 -0700463 // These we've verified to work.
464 return true
465 }
Brad Fitzpatrickde72d462016-05-04 17:47:12 +0000466 // TODO(bradfitz): make androidtest.bash and iotest.bash work
467 // too. And buildall.bash should really just be N small
468 // Kubernetes jobs instead of a "buildall.bash". Then we can
469 // delete this whole method.
Brad Fitzpatrick7d9b0362015-05-27 11:51:27 -0700470 return false
471}
472
Andrew Gerrand234725b2015-06-04 16:45:17 -0700473func (c *BuildConfig) BuildSubrepos() bool {
474 if !c.SplitMakeRun() {
475 return false
476 }
Andrew Gerrandaf7d1812015-06-11 10:01:24 -0700477 // TODO(adg,bradfitz): expand this as required
478 switch c.Name {
Brad Fitzpatrickd83028e2016-09-07 05:41:02 +0000479 case "darwin-amd64-10_8",
480 "darwin-amd64-10_10",
481 "darwin-amd64-10_11",
482 "darwin-386-10_11",
Andrew Gerrandaf7d1812015-06-11 10:01:24 -0700483 "freebsd-386-gce101", "freebsd-amd64-gce101",
484 "linux-386", "linux-amd64", "linux-amd64-nocgo",
Brad Fitzpatrickd6215412016-12-14 22:41:25 +0000485 "openbsd-386-60", "openbsd-amd64-60",
Andrew Gerrandaf7d1812015-06-11 10:01:24 -0700486 "plan9-386",
487 "windows-386-gce", "windows-amd64-gce":
488 return true
Brad Fitzpatrick9d1e5152017-01-24 21:48:04 +0000489 case "darwin-amd64-10_12":
490 // Don't build subrepos on Sierra until
491 // https://github.com/golang/go/issues/18751#issuecomment-274955794
492 // is addressed.
493 return false
Andrew Gerrandaf7d1812015-06-11 10:01:24 -0700494 default:
495 return false
496 }
Andrew Gerrand234725b2015-06-04 16:45:17 -0700497}
498
Andrew Gerrandfb774882015-05-21 14:02:38 +1000499// AllScriptArgs returns the set of arguments that should be passed to the
David Crawshawe078c6f2015-04-29 08:54:19 -0400500// all.bash-equivalent script. Usually empty.
501func (c *BuildConfig) AllScriptArgs() []string {
502 if strings.HasPrefix(c.Name, "darwin-arm") {
503 return []string{"-restart"}
504 }
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -0700505 return append([]string(nil), c.allScriptArgs...)
David Crawshawe078c6f2015-04-29 08:54:19 -0400506}
507
Andrew Gerrandf83f3e42015-02-02 12:05:01 +0000508// MakeScript returns the relative path to the operating system's script to
509// do the build.
510// Example values are "src/make.bash", "src/make.bat", "src/make.rc".
511func (c *BuildConfig) MakeScript() string {
512 if strings.HasPrefix(c.Name, "windows-") {
513 return "src/make.bat"
514 }
515 if strings.HasPrefix(c.Name, "plan9-") {
516 return "src/make.rc"
517 }
Brad Fitzpatrickde72d462016-05-04 17:47:12 +0000518 if strings.HasPrefix(c.Name, "nacl-") {
519 return "src/naclmake.bash"
520 }
Andrew Gerrandf83f3e42015-02-02 12:05:01 +0000521 return "src/make.bash"
522}
523
Andrew Gerrandfb774882015-05-21 14:02:38 +1000524// MakeScriptArgs returns the set of arguments that should be passed to the
525// make.bash-equivalent script. Usually empty.
526func (c *BuildConfig) MakeScriptArgs() []string {
527 return c.AllScriptArgs()
528}
529
530// RunScript returns the relative path to the operating system's script to
531// run the test suite.
532// Example values are "src/run.bash", "src/run.bat", "src/run.rc".
533func (c *BuildConfig) RunScript() string {
534 if strings.HasPrefix(c.Name, "windows-") {
535 return "src/run.bat"
536 }
537 if strings.HasPrefix(c.Name, "plan9-") {
538 return "src/run.rc"
539 }
540 return "src/run.bash"
541}
542
543// RunScriptArgs returns the set of arguments that should be passed to the
544// run.bash-equivalent script.
545func (c *BuildConfig) RunScriptArgs() []string {
546 return []string{"--no-rebuild"}
547}
548
Andrew Gerrandf83f3e42015-02-02 12:05:01 +0000549// GorootFinal returns the default install location for
550// releases for this platform.
551func (c *BuildConfig) GorootFinal() string {
552 if strings.HasPrefix(c.Name, "windows-") {
553 return "c:\\go"
554 }
555 return "/usr/local/go"
556}
557
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800558// MachineType returns the GCE machine type to use for this builder.
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000559func (c *HostConfig) MachineType() string {
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800560 if v := c.machineType; v != "" {
561 return v
562 }
563 return "n1-highcpu-2"
564}
565
David Crawshaweef380f2015-04-30 20:03:01 -0400566// ShortOwner returns a short human-readable owner.
567func (c BuildConfig) ShortOwner() string {
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000568 owner := c.hostConf().Owner
569 if owner == "" {
David Crawshaweef380f2015-04-30 20:03:01 -0400570 return "go-dev"
571 }
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000572 return strings.TrimSuffix(owner, "@golang.org")
David Crawshaweef380f2015-04-30 20:03:01 -0400573}
574
Brad Fitzpatrickf787cec2016-09-23 00:06:28 +0000575// PoolName returns a short summary of the builder's host type for the
576// http://farmer.golang.org/builders page.
577func (c *HostConfig) PoolName() string {
578 switch {
579 case c.IsReverse:
580 return "Reverse (dedicated machine/VM)"
581 case c.IsGCE():
582 return "GCE VM"
583 case c.IsKube():
584 return "Kubernetes container"
585 }
586 return "??"
587}
588
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -0700589// GCENumCPU reports the number of GCE CPUs this buildlet requires.
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000590func (c *HostConfig) GCENumCPU() int {
Brad Fitzpatrick1b1e0862015-06-04 18:25:50 -0700591 t := c.MachineType()
592 n, _ := strconv.Atoi(t[strings.LastIndex(t, "-")+1:])
593 return n
594}
595
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000596func (c *BuildConfig) NumTestHelpers(isTry bool) int {
597 if isTry && c.numTryTestHelpers != 0 {
598 return c.numTryTestHelpers
599 }
600 return c.numTestHelpers
601}
602
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800603func init() {
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800604 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000605 Name: "freebsd-amd64-gce93",
606 HostType: "host-freebsd-93-gce",
607 numTestHelpers: 1,
Bill Thiede222a9c02015-01-21 21:16:54 -0800608 })
609 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000610 Name: "freebsd-amd64-gce101",
611 HostType: "host-freebsd-101-gce",
612 numTestHelpers: 2,
613 numTryTestHelpers: 4,
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800614 })
615 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000616 Name: "freebsd-amd64-race",
617 HostType: "host-freebsd-101-gce",
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800618 })
619 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000620 Name: "freebsd-386-gce101",
621 HostType: "host-freebsd-101-gce",
622 env: []string{"GOARCH=386", "GOHOSTARCH=386"},
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800623 })
624 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000625 Name: "linux-386",
626 HostType: "host-linux-kubestd",
627 env: []string{"GOARCH=386", "GOHOSTARCH=386"},
628 numTestHelpers: 1,
629 numTryTestHelpers: 3,
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800630 })
631 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000632 Name: "linux-386-387",
633 Notes: "GO386=387",
634 HostType: "host-linux-kubestd",
635 env: []string{"GOARCH=386", "GOHOSTARCH=386", "GO386=387"},
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800636 })
637 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000638 Name: "linux-amd64",
639 HostType: "host-linux-kubestd",
640 numTestHelpers: 3,
Evan Brown08b68a92015-11-20 10:00:06 -0800641 })
Brad Fitzpatrick8c6116a2016-05-05 00:42:49 +0000642
643 addMiscCompile := func(suffix, rx string) {
644 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000645 Name: "misc-compile" + suffix,
646 HostType: "host-linux-kubestd",
647 TryOnly: true,
648 CompileOnly: true,
649 Notes: "Runs buildall.sh to cross-compile std packages for " + rx + ", but doesn't run any tests.",
Brad Fitzpatrick8c6116a2016-05-05 00:42:49 +0000650 allScriptArgs: []string{
651 // Filtering pattern to buildall.bash:
652 rx,
653 },
654 })
655 }
Brad Fitzpatrick98922e12016-11-12 00:32:48 +0000656 addMiscCompile("", "^(linux-arm64|linux-mips64.*|nacl-arm|solaris-amd64|freebsd-arm|darwin-386)$")
657 // TODO(bradfitz): add linux-mips* (or just make a "-mips" suffix builder) to add 32-bit
658 // mips, once that port is finished.
Brad Fitzpatrick8c6116a2016-05-05 00:42:49 +0000659 addMiscCompile("-ppc", "^(linux-ppc64|linux-ppc64le)$")
660 addMiscCompile("-netbsd", "^netbsd-")
661 addMiscCompile("-plan9", "^plan9-")
662
Brad Fitzpatrickab7ff8a2015-04-29 14:44:46 -0700663 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000664 Name: "linux-amd64-nocgo",
665 HostType: "host-linux-kubestd",
666 Notes: "cgo disabled",
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800667 env: []string{
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800668 "CGO_ENABLED=0",
669 // This USER=root was required for Docker-based builds but probably isn't required
670 // in the VM anymore, since the buildlet probably already has this in its environment.
671 // (It was required because without cgo, it couldn't find the username)
672 "USER=root",
673 },
674 })
675 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000676 Name: "linux-amd64-noopt",
677 Notes: "optimizations and inlining disabled",
678 HostType: "host-linux-kubestd",
679 env: []string{"GO_GCFLAGS=-N -l"},
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800680 })
681 addBuilder(BuildConfig{
Brad Fitzpatrickde72d462016-05-04 17:47:12 +0000682 Name: "linux-amd64-ssacheck",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000683 HostType: "host-linux-kubestd",
Brad Fitzpatrickde72d462016-05-04 17:47:12 +0000684 CompileOnly: true,
685 Notes: "SSA internal checks enabled",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000686 env: []string{"GO_GCFLAGS=-d=ssa/check/on"},
Keith Randalla04c8132016-03-18 15:30:38 -0700687 })
688 addBuilder(BuildConfig{
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000689 Name: "linux-amd64-race",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000690 HostType: "host-linux-kubestd",
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000691 numTestHelpers: 2,
692 numTryTestHelpers: 5,
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800693 })
694 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000695 Name: "linux-386-clang",
696 HostType: "host-linux-clang",
697 Notes: "Debian wheezy + clang 3.5 instead of gcc",
698 env: []string{"CC=/usr/bin/clang", "GOHOSTARCH=386"},
Brad Fitzpatricka0a155e2015-02-12 19:45:02 -0800699 })
700 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000701 Name: "linux-amd64-clang",
702 HostType: "host-linux-clang",
703 Notes: "Debian wheezy + clang 3.5 instead of gcc",
704 env: []string{"CC=/usr/bin/clang"},
Brad Fitzpatricka0a155e2015-02-12 19:45:02 -0800705 })
706 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000707 Name: "linux-386-sid",
708 HostType: "host-linux-sid",
709 Notes: "Debian sid (unstable)",
710 env: []string{"GOHOSTARCH=386"},
Brad Fitzpatrickf0728e32015-02-13 19:01:32 -0800711 })
712 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000713 Name: "linux-amd64-sid",
714 HostType: "host-linux-sid",
715 Notes: "Debian sid (unstable)",
Brad Fitzpatrickf0728e32015-02-13 19:01:32 -0800716 })
717 addBuilder(BuildConfig{
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000718 Name: "linux-arm",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000719 HostType: "host-linux-arm",
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000720 FlakyNet: true,
721 numTestHelpers: 2,
722 numTryTestHelpers: 7,
Brad Fitzpatrickdfe82862015-03-01 09:23:57 -0800723 })
724 addBuilder(BuildConfig{
Brad Fitzpatricke37005b2016-09-22 23:29:31 +0000725 Name: "linux-arm-nativemake",
726 Notes: "runs make.bash on real ARM hardware, but does not run tests",
727 HostType: "host-linux-arm",
728 StopAfterMake: true,
729 })
730 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000731 Name: "linux-arm-arm5",
732 HostType: "host-linux-arm",
733 Notes: "GOARM=5, but running on newer-than GOARM=5 hardware",
734 FlakyNet: true,
Brad Fitzpatrick1c437562015-05-11 08:47:37 -0700735 env: []string{
Brad Fitzpatrickbab07182015-05-13 15:16:31 -0700736 "GOARM=5",
Brad Fitzpatrick1c437562015-05-11 08:47:37 -0700737 "GO_TEST_TIMEOUT_SCALE=5", // slow.
738 },
Brad Fitzpatrickf319bb62015-05-07 11:36:25 -0700739 })
740 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000741 Name: "nacl-386",
742 HostType: "host-nacl-kube",
743 numTestHelpers: 3,
744 env: []string{"GOOS=nacl", "GOARCH=386", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
Brad Fitzpatrick0e84fc72015-02-18 14:12:22 -0800745 })
746 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000747 Name: "nacl-amd64p32",
748 HostType: "host-nacl-kube",
749 numTestHelpers: 3,
750 env: []string{"GOOS=nacl", "GOARCH=amd64p32", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
Evan Brown6cd016f2016-01-26 15:13:47 -0800751 })
752 addBuilder(BuildConfig{
Brad Fitzpatrickd6215412016-12-14 22:41:25 +0000753 Name: "openbsd-amd64-60",
Brad Fitzpatrick47762722016-12-10 19:10:49 +0000754 HostType: "host-openbsd-amd64-60",
755 numTestHelpers: 2,
756 numTryTestHelpers: 5,
757 })
758 addBuilder(BuildConfig{
Brad Fitzpatrickd6215412016-12-14 22:41:25 +0000759 Name: "openbsd-386-60",
760 HostType: "host-openbsd-386-60",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000761 numTestHelpers: 2,
762 numTryTestHelpers: 5,
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800763 })
764 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000765 Name: "netbsd-amd64-gce",
766 HostType: "host-netbsd-gce",
767 numTestHelpers: 1,
Brad Fitzpatrick011a8952016-04-04 18:03:49 +0000768 })
769
770 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000771 Name: "plan9-386",
772 HostType: "host-plan9-386-gce",
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000773 numTestHelpers: 1,
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800774 })
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800775 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000776 Name: "windows-amd64-gce",
777 HostType: "host-windows-gce",
778 env: []string{"GOARCH=amd64", "GOHOSTARCH=amd64"},
779 numTestHelpers: 1,
780 numTryTestHelpers: 5,
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800781 })
782 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000783 Name: "windows-amd64-race",
784 HostType: "host-windows-gce",
785 Notes: "Only runs -race tests (./race.bat)",
786 env: []string{"GOARCH=amd64", "GOHOSTARCH=amd64"},
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800787 })
788 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000789 Name: "windows-386-gce",
790 HostType: "host-windows-gce",
791 env: []string{"GOARCH=386", "GOHOSTARCH=386"},
792 numTestHelpers: 1,
793 numTryTestHelpers: 5,
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800794 })
David Crawshaw66c36dd2015-04-23 10:23:22 -0400795 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000796 Name: "darwin-amd64-10_8",
797 HostType: "host-darwin-10_8",
Brad Fitzpatrick8b77adf2016-08-30 19:55:08 +0000798 })
799 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000800 Name: "darwin-amd64-10_10",
801 HostType: "host-darwin-10_10",
Brad Fitzpatrick8b77adf2016-08-30 19:55:08 +0000802 })
Brad Fitzpatrickd83028e2016-09-07 05:41:02 +0000803 addBuilder(BuildConfig{
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000804 Name: "darwin-amd64-10_11",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000805 HostType: "host-darwin-10_11",
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000806 numTestHelpers: 2,
807 numTryTestHelpers: 3,
Brad Fitzpatrickd83028e2016-09-07 05:41:02 +0000808 })
Brad Fitzpatrick409147c2017-01-18 22:45:12 +0000809 addBuilder(BuildConfig{
810 Name: "darwin-amd64-10_12",
811 HostType: "host-darwin-10_12",
812 })
Brad Fitzpatrick8b77adf2016-08-30 19:55:08 +0000813
David Crawshawe29c0bb2015-07-22 10:54:18 -0400814 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000815 Name: "android-arm-sdk19",
816 Notes: "Android ARM device running android-19 (KitKat 4.4), attatched to Mac Mini",
817 env: []string{"GOOS=android", "GOARCH=arm"},
David Crawshawe29c0bb2015-07-22 10:54:18 -0400818 })
819 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000820 Name: "android-arm64-sdk21",
821 Notes: "Android arm64 device using the android-21 toolchain, attatched to Mac Mini",
822 env: []string{"GOOS=android", "GOARCH=arm64"},
David Crawshaw1a1fe1e2015-11-20 11:08:04 -0500823 })
824 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000825 Name: "android-386-sdk21",
826 Notes: "Android 386 device using the android-21 toolchain, attatched to Mac Mini",
827 env: []string{"GOOS=android", "GOARCH=386"},
David Crawshaw1a1fe1e2015-11-20 11:08:04 -0500828 })
829 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000830 Name: "android-amd64-sdk21",
831 Notes: "Android amd64 device using the android-21 toolchain, attatched to Mac Mini",
832 env: []string{"GOOS=android", "GOARCH=amd64"},
David Crawshaw1a1fe1e2015-11-20 11:08:04 -0500833 })
834 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000835 Name: "darwin-arm-a5ios",
836 Notes: "iPhone 4S (A5 processor), via a Mac Mini; owned by crawshaw",
837 env: []string{"GOARCH=arm", "GOHOSTARCH=amd64"},
David Crawshawe078c6f2015-04-29 08:54:19 -0400838 })
David Crawshawe078c6f2015-04-29 08:54:19 -0400839 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000840 Name: "darwin-arm64-a7ios",
841 Notes: "iPad Mini 3 (A7 processor), via a Mac Mini; owned by crawshaw",
842 env: []string{"GOARCH=arm64", "GOHOSTARCH=amd64"},
843 })
844
845 addBuilder(BuildConfig{
846 Name: "solaris-amd64-smartosbuildlet",
847 HostType: "host-solaris-amd64",
David Crawshawe078c6f2015-04-29 08:54:19 -0400848 })
Brad Fitzpatrickc2a36fd2016-03-01 04:49:24 +0000849 addBuilder(BuildConfig{
Brad Fitzpatrickf8a31062016-10-06 20:30:58 +0000850 Name: "linux-ppc64-buildlet",
851 HostType: "host-linux-ppc64-osu",
852 FlakyNet: true,
853 })
854 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000855 Name: "linux-ppc64le-buildlet",
856 HostType: "host-linux-ppc64le-osu",
857 FlakyNet: true,
Brad Fitzpatrickc2a36fd2016-03-01 04:49:24 +0000858 })
859 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000860 Name: "linux-arm64-buildlet",
861 HostType: "host-linux-arm64-linaro",
862 FlakyNet: true,
Brad Fitzpatrickc2a36fd2016-03-01 04:49:24 +0000863 })
864 addBuilder(BuildConfig{
Brad Fitzpatrick31e2bfa2016-11-03 17:35:15 +0000865 Name: "linux-mips",
866 HostType: "host-linux-mips",
867 })
868 addBuilder(BuildConfig{
869 Name: "linux-mipsle",
870 HostType: "host-linux-mipsle",
871 })
872 addBuilder(BuildConfig{
873 Name: "linux-mips64",
874 HostType: "host-linux-mips64",
875 })
876 addBuilder(BuildConfig{
877 Name: "linux-mips64le",
878 HostType: "host-linux-mips64le",
879 })
880 addBuilder(BuildConfig{
Brad Fitzpatrickc2a36fd2016-03-01 04:49:24 +0000881 Name: "linux-s390x-ibm",
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000882 HostType: "host-linux-s390x",
Brad Fitzpatrick94d01412016-09-13 22:45:48 +0000883 numTestHelpers: 0,
Brad Fitzpatrickc2a36fd2016-03-01 04:49:24 +0000884 })
Brad Fitzpatrick30761a02016-04-08 19:40:23 +0000885 addBuilder(BuildConfig{
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000886 Name: "linux-s390x-crosscompile",
887 HostType: "host-s390x-cross-kube",
888 Notes: "s390x cross-compile builder for releases; doesn't run tests",
889 CompileOnly: true,
890 TryOnly: true, // but not in trybot set for now
Brad Fitzpatrick9702f6a2016-08-30 20:32:33 +0000891 env: []string{
Brad Fitzpatrick9702f6a2016-08-30 20:32:33 +0000892 "CGO_ENABLED=1",
893 "GOARCH=s390x",
894 "GOHOSTARCH=amd64",
895 "CC_FOR_TARGET=s390x-linux-gnu-gcc",
896 },
897 })
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000898}
Brad Fitzpatrick9702f6a2016-08-30 20:32:33 +0000899
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000900func (c BuildConfig) isMobile() bool {
901 return strings.HasPrefix(c.Name, "android-") || strings.HasPrefix(c.Name, "darwin-arm")
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800902}
903
904func addBuilder(c BuildConfig) {
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800905 if c.Name == "" {
906 panic("empty name")
907 }
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000908 if c.isMobile() && c.HostType == "" {
909 htyp := "host-" + c.Name
910 if _, ok := Hosts[htyp]; !ok {
911 Hosts[htyp] = &HostConfig{
912 HostType: htyp,
913 IsReverse: true,
914 goBootstrapURLTmpl: "https://storage.googleapis.com/$BUCKET/go1.4-darwin-amd64.tar.gz",
915 ReverseAliases: []string{c.Name},
916 }
917 c.HostType = htyp
918 }
919 }
920 if c.HostType == "" {
921 panic(fmt.Sprintf("missing HostType for builder %q", c.Name))
922 }
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800923 if _, dup := Builders[c.Name]; dup {
924 panic("dup name")
925 }
Brad Fitzpatrick328c9b82016-09-21 21:27:37 +0000926 if _, ok := Hosts[c.HostType]; !ok {
927 panic(fmt.Sprintf("undefined HostType %q for builder %q", c.HostType, c.Name))
Brad Fitzpatrick6925ce82015-09-08 15:18:47 -0700928 }
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800929 Builders[c.Name] = c
930}