blob: 2b7c0b892b9af1dd2614c70eec8babc05eaebfee [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 Fitzpatrick83455d12015-02-19 16:14:20 -08009import "strings"
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080010
11// Builders are the different build configurations.
12// The keys are like "darwin-amd64" or "linux-386-387".
13// This map should not be modified by other packages.
14var Builders = map[string]BuildConfig{}
15
David Crawshaw66c36dd2015-04-23 10:23:22 -040016// A BuildConfig describes how to run a builder.
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080017type BuildConfig struct {
18 // Name is the unique name of the builder, in the form of
19 // "darwin-386" or "linux-amd64-race".
20 Name string
21
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080022 VMImage string // e.g. "openbsd-amd64-56"
23 machineType string // optional GCE instance type
Brad Fitzpatrick20d84832015-01-21 10:03:07 -080024 Go14URL string // URL to built Go 1.4 tar.gz
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -080025 buildletURL string // optional override buildlet URL
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080026
David Crawshaw66c36dd2015-04-23 10:23:22 -040027 IsReverse bool // if true, only use the reverse buildlet pool
Brad Fitzpatrick1c6d9162015-03-20 16:14:52 -070028 RegularDisk bool // if true, use spinning disk instead of SSD
29
Brad Fitzpatrick32d05202015-01-21 15:15:48 -080030 env []string // extra environment ("key=value") pairs
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080031}
32
Brad Fitzpatrick32d05202015-01-21 15:15:48 -080033func (c *BuildConfig) Env() []string { return append([]string(nil), c.env...) }
34
Brad Fitzpatrickf3c01932015-01-15 16:29:16 -080035func (c *BuildConfig) GOOS() string { return c.Name[:strings.Index(c.Name, "-")] }
36
37func (c *BuildConfig) GOARCH() string {
38 arch := c.Name[strings.Index(c.Name, "-")+1:]
39 i := strings.Index(arch, "-")
40 if i == -1 {
41 return arch
42 }
43 return arch[:i]
44}
45
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -080046// BuildletBinaryURL returns the public URL of this builder's buildlet.
47func (c *BuildConfig) BuildletBinaryURL() string {
48 if c.buildletURL != "" {
49 return c.buildletURL
50 }
51 return "http://storage.googleapis.com/go-builder-data/buildlet." + c.GOOS() + "-" + c.GOARCH()
52}
53
Brad Fitzpatrickf8c24842015-01-16 09:54:03 -080054// AllScript returns the relative path to the operating system's script to
55// do the build and run its standard set of tests.
56// Example values are "src/all.bash", "src/all.bat", "src/all.rc".
57func (c *BuildConfig) AllScript() string {
Brad Fitzpatrick32d05202015-01-21 15:15:48 -080058 if strings.HasSuffix(c.Name, "-race") {
59 if strings.HasPrefix(c.Name, "windows-") {
60 return "src/race.bat"
61 }
62 return "src/race.bash"
63 }
Brad Fitzpatrickf8c24842015-01-16 09:54:03 -080064 if strings.HasPrefix(c.Name, "windows-") {
65 return "src/all.bat"
66 }
67 if strings.HasPrefix(c.Name, "plan9-") {
68 return "src/all.rc"
69 }
Brad Fitzpatrick0e84fc72015-02-18 14:12:22 -080070 if strings.HasPrefix(c.Name, "nacl-") {
71 return "src/nacltest.bash"
72 }
Brad Fitzpatrickf8c24842015-01-16 09:54:03 -080073 return "src/all.bash"
74}
75
Andrew Gerrandf83f3e42015-02-02 12:05:01 +000076// MakeScript returns the relative path to the operating system's script to
77// do the build.
78// Example values are "src/make.bash", "src/make.bat", "src/make.rc".
79func (c *BuildConfig) MakeScript() string {
80 if strings.HasPrefix(c.Name, "windows-") {
81 return "src/make.bat"
82 }
83 if strings.HasPrefix(c.Name, "plan9-") {
84 return "src/make.rc"
85 }
86 return "src/make.bash"
87}
88
89// GorootFinal returns the default install location for
90// releases for this platform.
91func (c *BuildConfig) GorootFinal() string {
92 if strings.HasPrefix(c.Name, "windows-") {
93 return "c:\\go"
94 }
95 return "/usr/local/go"
96}
97
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -080098// MachineType returns the GCE machine type to use for this builder.
99func (c *BuildConfig) MachineType() string {
100 if v := c.machineType; v != "" {
101 return v
102 }
103 return "n1-highcpu-2"
104}
105
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800106func init() {
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800107 addBuilder(BuildConfig{
Bill Thiede222a9c02015-01-21 21:16:54 -0800108 Name: "freebsd-amd64-gce93",
109 VMImage: "freebsd-amd64-gce93",
110 machineType: "n1-highcpu-2",
111 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-freebsd-amd64.tar.gz",
112 })
113 addBuilder(BuildConfig{
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800114 Name: "freebsd-amd64-gce101",
115 VMImage: "freebsd-amd64-gce101",
116 machineType: "n1-highcpu-2",
117 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-freebsd-amd64.tar.gz",
118 env: []string{"CC=clang"},
119 })
120 addBuilder(BuildConfig{
121 Name: "freebsd-amd64-race",
122 VMImage: "freebsd-amd64-gce101",
123 machineType: "n1-highcpu-4",
124 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-freebsd-amd64.tar.gz",
125 env: []string{"CC=clang"},
126 })
127 addBuilder(BuildConfig{
128 Name: "freebsd-386-gce101",
129 VMImage: "freebsd-amd64-gce101",
130 machineType: "n1-highcpu-2",
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800131 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.freebsd-amd64",
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800132 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-freebsd-amd64.tar.gz",
Brad Fitzpatrick50ba0cb2015-01-27 14:22:21 -0800133 // TODO(bradfitz): setting GOHOSTARCH=386 should work
134 // to eliminate some unnecessary work (it works on
135 // Linux), but fails on FreeBSD with:
136 // ##### ../misc/cgo/testso
137 // Shared object "libcgosotest.so" not found, required by "main"
138 // Maybe this is a clang thing? We'll see when we do linux clang too.
139 env: []string{"GOARCH=386", "CC=clang"},
140 })
141 addBuilder(BuildConfig{
142 Name: "linux-386",
143 VMImage: "linux-buildlet-std",
144 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
145 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOARCH=386", "GOHOSTARCH=386"},
146 })
147 addBuilder(BuildConfig{
148 Name: "linux-386-387",
149 VMImage: "linux-buildlet-std",
150 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
151 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOARCH=386", "GOHOSTARCH=386", "GO386=387"},
152 })
153 addBuilder(BuildConfig{
154 Name: "linux-amd64",
155 VMImage: "linux-buildlet-std",
156 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
157 })
158 addBuilder(BuildConfig{
159 Name: "linux-amd64-nocgo",
160 VMImage: "linux-buildlet-std",
161 env: []string{
162 "GOROOT_BOOTSTRAP=/go1.4",
163 "CGO_ENABLED=0",
164 // This USER=root was required for Docker-based builds but probably isn't required
165 // in the VM anymore, since the buildlet probably already has this in its environment.
166 // (It was required because without cgo, it couldn't find the username)
167 "USER=root",
168 },
169 })
170 addBuilder(BuildConfig{
171 Name: "linux-amd64-noopt",
172 VMImage: "linux-buildlet-std",
173 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GO_GCFLAGS=-N -l"},
174 })
175 addBuilder(BuildConfig{
176 Name: "linux-amd64-race",
177 VMImage: "linux-buildlet-std",
178 machineType: "n1-highcpu-4",
179 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800180 })
181 addBuilder(BuildConfig{
Brad Fitzpatricka0a155e2015-02-12 19:45:02 -0800182 Name: "linux-386-clang",
183 VMImage: "linux-buildlet-clang",
184 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
Brad Fitzpatrick4d7595c2015-02-13 16:32:21 -0800185 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "CC=/usr/bin/clang", "GOHOSTARCH=386"},
Brad Fitzpatricka0a155e2015-02-12 19:45:02 -0800186 })
187 addBuilder(BuildConfig{
188 Name: "linux-amd64-clang",
189 VMImage: "linux-buildlet-clang",
190 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "CC=/usr/bin/clang"},
191 })
192 addBuilder(BuildConfig{
Brad Fitzpatrickf0728e32015-02-13 19:01:32 -0800193 Name: "linux-386-sid",
194 VMImage: "linux-buildlet-sid",
195 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
196 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOHOSTARCH=386"},
197 })
198 addBuilder(BuildConfig{
199 Name: "linux-amd64-sid",
200 VMImage: "linux-buildlet-sid",
201 env: []string{"GOROOT_BOOTSTRAP=/go1.4"},
202 })
203 addBuilder(BuildConfig{
Brad Fitzpatrickdfe82862015-03-01 09:23:57 -0800204 Name: "linux-arm-qemu",
205 VMImage: "linux-buildlet-arm",
206 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "IN_QEMU=1"},
207 })
208 addBuilder(BuildConfig{
Brad Fitzpatrick0e84fc72015-02-18 14:12:22 -0800209 Name: "nacl-386",
Brad Fitzpatrick38c2c752015-03-24 18:50:33 -0700210 VMImage: "linux-buildlet-nacl-v2",
Brad Fitzpatrick0e84fc72015-02-18 14:12:22 -0800211 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
212 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOOS=nacl", "GOARCH=386", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
213 })
214 addBuilder(BuildConfig{
215 Name: "nacl-amd64p32",
Brad Fitzpatrick38c2c752015-03-24 18:50:33 -0700216 VMImage: "linux-buildlet-nacl-v2",
Brad Fitzpatrick0e84fc72015-02-18 14:12:22 -0800217 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.linux-amd64",
218 env: []string{"GOROOT_BOOTSTRAP=/go1.4", "GOOS=nacl", "GOARCH=amd64p32", "GOHOSTOS=linux", "GOHOSTARCH=amd64"},
219 })
220 addBuilder(BuildConfig{
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800221 Name: "openbsd-amd64-gce56",
222 VMImage: "openbsd-amd64-56",
223 machineType: "n1-highcpu-2",
Brad Fitzpatrick20d84832015-01-21 10:03:07 -0800224 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-openbsd-amd64.tar.gz",
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800225 })
226 addBuilder(BuildConfig{
Brad Fitzpatrickf6a4a4a2015-01-22 14:11:10 -0800227 Name: "openbsd-386-gce56",
228 VMImage: "openbsd-386-56",
229 machineType: "n1-highcpu-2",
230 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-openbsd-386.tar.gz",
231 })
232 addBuilder(BuildConfig{
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800233 Name: "plan9-386-gcepartial",
Brad Fitzpatrickdfe82862015-03-01 09:23:57 -0800234 VMImage: "plan9-386-v2",
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800235 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-plan9-386.tar.gz",
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800236 // It's named "partial" because the buildlet sets
237 // GOTESTONLY=std to stop after the "go test std"
238 // tests because it's so slow otherwise.
Brad Fitzpatrick32d05202015-01-21 15:15:48 -0800239 env: []string{"GOTESTONLY=std"},
240
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800241 // We *were* using n1-standard-1 because Plan 9 can only
242 // reliably use a single CPU. Using 2 or 4 and we see
243 // test failures. See:
244 // https://golang.org/issue/8393
245 // https://golang.org/issue/9491
Brad Fitzpatrickdfe82862015-03-01 09:23:57 -0800246 // n1-standard-1 has 3.6 GB of memory which WAS (see below)
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800247 // overkill (userspace probably only sees 2GB anyway),
248 // but it's the cheapest option. And plenty to keep
249 // our ~250 MB of inputs+outputs in its ramfs.
250 //
251 // But the docs says "For the n1 series of machine
252 // types, a virtual CPU is implemented as a single
253 // hyperthread on a 2.6GHz Intel Sandy Bridge Xeon or
254 // Intel Ivy Bridge Xeon (or newer) processor. This
255 // means that the n1-standard-2 machine type will see
256 // a whole physical core."
257 //
Brad Fitzpatrickdfe82862015-03-01 09:23:57 -0800258 // ... so we used n1-highcpu-2 (1.80 RAM, still
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800259 // plenty), just so we can get 1 whole core for the
260 // single-core Plan 9. It will see 2 virtual cores and
261 // only use 1, but we hope that 1 will be more powerful
262 // and we'll stop timing out on tests.
Brad Fitzpatrickdfe82862015-03-01 09:23:57 -0800263 //
264 // But then with the toolchain conversion to Go and
265 // using ramfs, it turns out we need more memory
266 // anyway, so use n1-highcpu-4.
267 machineType: "n1-highcpu-4",
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800268 })
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800269 addBuilder(BuildConfig{
270 Name: "windows-amd64-gce",
Brad Fitzpatrick0c0bd362015-03-22 10:50:04 -0700271 VMImage: "windows-buildlet-v2",
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800272 machineType: "n1-highcpu-2",
273 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-windows-amd64.tar.gz",
Brad Fitzpatrick1c6d9162015-03-20 16:14:52 -0700274 RegularDisk: true,
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800275 env: []string{"GOARCH=amd64", "GOHOSTARCH=amd64"},
276 })
277 addBuilder(BuildConfig{
278 Name: "windows-amd64-race",
Brad Fitzpatrick0c0bd362015-03-22 10:50:04 -0700279 VMImage: "windows-buildlet-v2",
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800280 machineType: "n1-highcpu-4",
281 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-windows-amd64.tar.gz",
Brad Fitzpatrick1c6d9162015-03-20 16:14:52 -0700282 RegularDisk: true,
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800283 env: []string{"GOARCH=amd64", "GOHOSTARCH=amd64"},
284 })
285 addBuilder(BuildConfig{
286 Name: "windows-386-gce",
Brad Fitzpatrick0c0bd362015-03-22 10:50:04 -0700287 VMImage: "windows-buildlet-v2",
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800288 machineType: "n1-highcpu-2",
289 buildletURL: "http://storage.googleapis.com/go-builder-data/buildlet.windows-amd64",
290 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-windows-386.tar.gz",
Brad Fitzpatrick1c6d9162015-03-20 16:14:52 -0700291 RegularDisk: true,
Brad Fitzpatrickcc587d42015-02-06 17:32:15 -0800292 env: []string{"GOARCH=386", "GOHOSTARCH=386"},
293 })
David Crawshaw66c36dd2015-04-23 10:23:22 -0400294 addBuilder(BuildConfig{
295 Name: "darwin-amd64",
296 Go14URL: "https://storage.googleapis.com/go-builder-data/go1.4-darwin-amd64.tar.gz",
297 IsReverse: true,
298 })
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800299}
300
301func addBuilder(c BuildConfig) {
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800302 if c.Name == "" {
303 panic("empty name")
304 }
305 if _, dup := Builders[c.Name]; dup {
306 panic("dup name")
307 }
David Crawshaw66c36dd2015-04-23 10:23:22 -0400308 if c.VMImage == "" && !c.IsReverse {
Brad Fitzpatrick83455d12015-02-19 16:14:20 -0800309 panic("empty VMImage")
Brad Fitzpatrick46cc7592015-01-15 12:46:22 -0800310 }
311 Builders[c.Name] = c
312}