Skip to content

Commit

Permalink
cmd/coordinator: find work in dev mode
Browse files Browse the repository at this point in the history
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 <[email protected]>
Run-TryBot: Michael Pratt <[email protected]>
TryBot-Result: Go Bot <[email protected]>
Reviewed-by: Alexander Rakoczy <[email protected]>
  • Loading branch information
prattmic committed Oct 15, 2021
1 parent d59bfcb commit 3025285
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/coordinator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ Building, running tests, running locally is supported on Linux and macOS only.
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
you should get the homepage. Some features won't work when running locally,
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
Expand Down
11 changes: 11 additions & 0 deletions cmd/coordinator/coordinator.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,16 @@ func main() {
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 {
Expand Down Expand Up @@ -466,6 +476,7 @@ func main() {
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 {
Expand Down

0 comments on commit 3025285

Please sign in to comment.