cmd/coordinator: find work in dev mode
Start the main findWorkLoop in dev mode, to discover work to run from
the dashboard. In dev mode, was also replace the linux-amd64 builder
config with one using host-linux-amd64-localdev reverse buildlets.
This provides a complete lifecycle to test out builds with a local dev
coordinator and buildlet.
For golang/go#48803
Change-Id: I8ade6c8bccf3bc51437ca9e7d11c232753fe7465
Reviewed-on: https://go-review.googlesource.com/c/build/+/354638
Trust: Michael Pratt <mpratt@google.com>
Run-TryBot: Michael Pratt <mpratt@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/cmd/coordinator/README.md b/cmd/coordinator/README.md
index 870b38e..bb950a4 100644
--- a/cmd/coordinator/README.md
+++ b/cmd/coordinator/README.md
@@ -7,7 +7,7 @@
Run
```sh
-go run golang.org/x/build/cmd/coordinator -mode=dev -env=dev
+go run golang.org/x/build/cmd/coordinator -mode=dev
```
to start a server on https://localhost:8119. Proceed past the TLS warning and
@@ -15,6 +15,13 @@
but you should be able to navigate between the homepage, the dashboard,
the builders page, and do limited local development and testing.
+To test builds locally, start a `host-linux-amd64-localdev` reverse buildlet,
+which will run `linux-amd64` tests:
+
+```sh
+go run golang.org/x/build/cmd/buildlet -halt=false -reverse-type=host-linux-amd64-localdev
+```
+
#### Render the "Trybot Status" page locally
To view/modify the "Trybot Status" page locally, you can run the coordinator
diff --git a/cmd/coordinator/coordinator.go b/cmd/coordinator/coordinator.go
index 8883845..286e757 100644
--- a/cmd/coordinator/coordinator.go
+++ b/cmd/coordinator/coordinator.go
@@ -398,6 +398,16 @@
defer ec2Pool.Close()
}
+ if *mode == "dev" {
+ // Replace linux-amd64 with a config using a -localdev reverse
+ // buildlet so it is possible to run local builds by starting a
+ // local reverse buildlet.
+ dashboard.Builders["linux-amd64"] = &dashboard.BuildConfig{
+ Name: "linux-amd64",
+ HostType: "host-linux-amd64-localdev",
+ }
+ }
+
go updateInstanceRecord()
switch *mode {
@@ -466,6 +476,7 @@
if *mode == "dev" {
// TODO(crawshaw): do more in dev mode
gce.BuildletPool().SetEnabled(*devEnableGCE)
+ go findWorkLoop()
} else {
go gce.BuildletPool().CleanUpOldVMs()
if pool.KubeErr() == nil {