blob: aac373b185ac73d8d98e28cabc90943cbb849155 [file] [log] [blame] [view]
Kevin Burkef9586dc2017-07-18 20:10:49 -07001# Go Build Tools
2
Andrew Gerrand34bf4502015-01-21 17:09:50 +11003This subrepository holds the source for various packages and tools that support
Kevin Burkef9586dc2017-07-18 20:10:49 -07004Go's build system and the development of the Go programming language.
Chris Manghane7d85ae42013-08-01 13:23:51 +10005
Kevin Burkef9586dc2017-07-18 20:10:49 -07006## Report Issues / Send Patches
7
Brad Fitzpatrick623b5762017-07-26 18:23:57 +00008This repository uses Gerrit for code changes. To contribute, see
9https://golang.org/doc/contribute.html.
Kevin Burkef9586dc2017-07-18 20:10:49 -070010
11The main issue tracker for the blog is located at
Brad Fitzpatrick623b5762017-07-26 18:23:57 +000012https://github.com/golang/go/issues. Prefix your issue with
13"`x/build/DIR: `" in the subject line.
Kevin Burkef9586dc2017-07-18 20:10:49 -070014
Brad Fitzpatrick623b5762017-07-26 18:23:57 +000015## Overview
16
17The main components of the Go build system are:
Kevin Burkef9586dc2017-07-18 20:10:49 -070018
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000019* The **dashboard**, in [app/](https://dev.golang.org/dir/build/app), serves
20 https://build.golang.org/. It runs on App Engine and holds the state for
21 which builds passed or failed, and stores the build failure logs for
22 post-submit failures. (Trybot build failure logs are stored elsewhere).
23 The dashboard does not execute any builds on its own.
Brad Fitzpatrick49f23952017-04-12 01:32:46 +000024
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080025
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000026* The **coordinator**, in
27 [cmd/coordinator/](https://dev.golang.org/dir/build/cmd/coordinator/),
28 serves https://farmer.golang.org/. It runs on GKE and coordinates the
29 whole build system. It finds work to do (both pre-submit "TryBot" work,
30 and post-submit work) and executes builds, allocating machines to run the
31 builds. It is the owner of all machines.
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080032
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000033* The Go package in [buildenv/](https://dev.golang.org/dir/build/buildenv/)
34 contains constants for where the dashboard and coordinator run, for prod,
35 staging, and local development.
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080036
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000037* The **buildlet**, in
38 [cmd/buildlet/](https://dev.golang.org/dir/build/cmd/buildlet/), is the
39 HTTP server that runs on each worker machine to execute builds on the
40 coordinator's behalf. This runs on every possible GOOS/GOARCH value. The
41 buildlet binaries are stored on Google Cloud Storage and fetched
42 per-build, so we can update the buildlet binary independently of the
43 underlying machine images. The buildlet is the most insecure server
44 possible: it has HTTP handlers to read & write arbitrary content to disk,
45 and to execute any file on disk. It also has an SSH tunnel handler. The
46 buildlet must never be exposed to the Internet. The coordinator provisions
47 buildlets in one of three ways:
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080048
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000049 1. by creating VMs on Google Compute Engine (GCE) with custom images
50 configured to fetch & run the buildlet on boot, listening on port 80 in a
51 private network.
52
Brad Fitzpatrick6ae87502018-05-04 02:42:17 +000053 2. by running Linux containers (on either Google Kubernetes Engine
54 or GCE with the Container-Optimized OS image), with the container
55 images configured to fetch & run the buildlet on start, also
56 listening on port 80 in a private network.
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080057
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000058 3. by taking buildlets out of a pool of connected, dedicated machines. The
59 buildlet can run in either *listen mode* (as on GCE and GKE) or in
60 *reverse mode*. In reverse mode, the buildlet connects out to
61 https://farmer.golang.org/ and registers itself with the coordinator. The
62 TCP connection is then logically reversed (using
63 [revdial](https://dev.golang.org/dir/build/revdial/) and when the
64 coordinator needs to do a build, it makes HTTP requests to the coordinator
65 over the already-open TCP connection.
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080066
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000067 These three pools can be viewed at the coordinator's
68 http://farmer.golang.org/#pools
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080069
Brad Fitzpatrick49f23952017-04-12 01:32:46 +000070
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000071* The [env/](https://dev.golang.org/dir/build/env/) directory describes
72 build environments. It contains scripts to create VM images, Dockerfiles
73 to create Kubernetes containers, and instructions and tools for dedicated
74 machines.
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080075
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -080076
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +000077* **maintner** in [maintner/](https://dev.golang.org/dir/build/maintner) is
78 a library for slurping all of Go's GitHub and Gerrit state into memory.
79 The daemon **maintnerd** in
80 [maintner/maintnerd/](https://dev.golang.org/dir/build/maintner/maintnerd)
81 runs on GKE and serves https://maintner.golang.org/. The daemon watches
82 GitHub and Gerrit and apps to a mutation log whenever it sees new
83 activity. The logs are stored on GCS and served to clients.
84
85
86* The [godata package](https://godoc.org/golang.org/x/build/maintner/godata)
87 in [maintner/godata/](https://dev.golang.org/dir/build/maintner/godata)
88 provides a trivial API to let anybody write programs against
89 Go's maintner corpus (all of our GitHub and Gerrit history), live up
90 to the second. It takes a few seconds to load into memory and a few hundred
91 MB of RAM after it downloads the mutation log from the network.
92
93
94* **pubsubhelper** in
95 [cmd/pubsubhelper/](https://dev.golang.org/dir/build/cmd/pubsubhelper/) is
Brad Fitzpatrick4bd7ff52017-07-26 19:54:01 +000096 a dependency of maintnerd. It runs on GKE, is available at
97 https://pubsubhelper.golang.org/, and runs an HTTP server to receive
98 Webhook updates from GitHub on new activity and an SMTP server to receive
99 new activity emails from Gerrit. It then is a pubsub system for maintnerd
100 to subscribe to.
Brad Fitzpatrick2c0b1882017-07-26 19:45:04 +0000101
102
103* The **gitmirror** server in
104 [cmd/gitmirror/](https://dev.golang.org/dir/build/cmd/gitmirror) mirrors
105 Gerrit to GitHub, and also serves a mirror of the Gerrit code to the
106 coordinator for builds, so we don't overwhelm Gerrit and blow our quota.
107
108
109* The Go **gopherbot** bot logic runs on GKE. The code is in
110 [cmd/gopherbot](https://dev.golang.org/dir/build/cmd/gopherbot). It
111 depends on maintner via the godata package.
112
113
114* The **developer dashboard** at https://dev.golang.org/ runs on GKE.
115 Its code is in [devapp/](https://dev.golang.org/dir/build/devapp/).
116 It also depends on maintner via the godata package.
117
118
119* **cmd/retrybuilds**: a Go client program to delete build results from the
120 dashboard
121
Brad Fitzpatrick4821e1d2015-01-14 17:24:45 -0800122
Kevin Burkef9586dc2017-07-18 20:10:49 -0700123### Adding a Go Builder
Chris Manghane7d85ae42013-08-01 13:23:51 +1000124
Kevin Burkef9586dc2017-07-18 20:10:49 -0700125If you wish to run a Go builder, please email
126[golang-dev@googlegroups.com](mailto:golang-dev@googlegroups.com) first. There
127is documentation at https://golang.org/wiki/DashboardBuilders, but depending
128on the type of builder, we may want to run it ourselves, after you prepare an
129environment description (resulting in a VM image) of it. See the env directory.
Brad Fitzpatrick623b5762017-07-26 18:23:57 +0000130