blob: e142b91b651be7ff1f34544dc22cd2811be2ef5e [file] [log] [blame] [view]
Brad Fitzpatrick49a6e222017-03-28 13:59:03 -07001# Using gomote
2
3## Installing
4
5```
Keith Randall959c53b2017-04-06 09:50:54 -07006$ go get -u golang.org/x/build/cmd/gomote
Brad Fitzpatrick49a6e222017-03-28 13:59:03 -07007```
8
9## Using
10
11TODO: examples. For now:
12
13```
Hyang-Ah Hana Kim7c0b7e52018-10-10 16:37:56 -040014The gomote command is a client for the Go builder infrastructure. It's a
15remote control for remote Go builder machines.
16
17See https://golang.org/wiki/Gomote
18
19Usage:
20
21 gomote [global-flags] cmd [cmd-flags]
22
23 For example,
24 $ gomote create openbsd-amd64-60
25 user-username-openbsd-amd64-60-0
26 $ gomote push user-username-openbsd-amd64-60-0
27 $ gomote run user-username-openbsd-amd64-60-0 go/src/make.bash
28 $ gomote run user-username-openbsd-amd64-60-0 go/bin/go test -v -short os
29
30To list the subcommands, run "gomote" without arguments:
31
32 Commands:
33
34 create create a buildlet; with no args, list types of buildlets
35 destroy destroy a buildlet
36 gettar extract a tar.gz from a buildlet
37 list list active buildlets
38 ls list the contents of a directory on a buildlet
39 ping test whether a buildlet is alive and reachable
40 push sync your GOROOT directory to the buildlet
41 put put files on a buildlet
42 put14 put Go 1.4 in place
43 puttar extract a tar.gz to a buildlet
44 rm delete files or directories
45 run run a command on a buildlet
46 ssh ssh to a buildlet
47
48To list all the builder types available, run "create" with no arguments:
49
50 $ gomote create
51 (list tons of buildlet types)
52
53The "gomote run" command has many of its own flags:
54
55 $ gomote run -h
Dmitri Shuralyoveee0de32018-10-13 13:25:14 -040056 run usage: gomote run [run-opts] <instance> <cmd> [args...]
Hyang-Ah Hana Kim7c0b7e52018-10-10 16:37:56 -040057 -builderenv string
58 Optional alternate builder to act like. Must share the same
59 underlying buildlet host type, or it's an error. For
60 instance, linux-amd64-race or linux-386-387 are compatible
61 with linux-amd64, but openbsd-amd64 and openbsd-386 are
62 different hosts.
63 -debug
64 write debug info about the command's execution before it begins
65 -dir string
66 Directory to run from. Defaults to the directory of the
67 command, or the work directory if -system is true.
68 -e value
69 Environment variable KEY=value. The -e flag may be repeated
70 multiple times to add multiple things to the environment.
71 -path string
72 Comma-separated list of ExecOpts.Path elements. The special
73 string 'EMPTY' means to run without any $PATH. The empty
74 string (default) does not modify the $PATH. Otherwise, the
75 following expansions apply: the string '$PATH' expands to
76 the current PATH element(s), the substring '$WORKDIR'
77 expands to the buildlet's temp workdir.
78 -system
79 run inside the system, and not inside the workdir; this is implicit if cmd starts with '/'
80
81
82Debugging buildlets directly
83
84Using "gomote create" contacts the build coordinator (farmer.golang.org) and
85requests that it create the buildlet on your behalf. All subsequent commands
86(such as "gomote run" or "gomote ls") then proxy your request via the
87coordinator. To access a buildlet directly (for example, when working on the
88buildlet code), you can skip the "gomote create" step and use the special
89builder name "<build-config-name>@ip[:port>", such as
90"windows-amd64-2008@10.1.5.3".
Brad Fitzpatrick49a6e222017-03-28 13:59:03 -070091```
Brad Fitzpatrick3f1d5632017-04-06 15:57:39 -070092
93## Tricks
94
95### Windows
96
97```
98$ gomote run -path '$PATH,$WORKDIR/go/bin' -e 'GOROOT=c:\workdir\go' user-bradfitz-windows-amd64-gce-0 go/bin/go.exe test cmd/go -short
99```
100
101### Subrepos on Windows
102
103```
104$ tar -C ~/src/ -zc golang.org/x/tools | gomote puttar -dir=gopath/src $MOTE
105$ gomote run -e 'GOPATH=c:/workdir/gopath' $MOTE go/bin/go test -run=TestFixImportsVendorPackage golang.org/x/tools/imports
106```
Tobias Klauserb5b9a2b2017-12-12 15:26:15 +0100107
108### Subrepos on Unix
109
110Testing golang.org/x/sys/unix on $MOTE
111
112```
113$ tar -C $GOPATH/src/ -zc golang.org/x/sys/unix | gomote puttar -dir=gopath/src $MOTE
114$ gomote run -e 'GOPATH=/tmp/workdir/gopath' $MOTE go/bin/go test -v golang.org/x/sys/unix
Hyang-Ah Hana Kim7d0e8b62018-03-01 14:36:33 -0500115```
116
117## About Buildlets
118
119http://farmer.golang.org/builders lists information about how each buildlet is deployed and configured.
120The information is from golang.org/x/build/dashboard and golang.org/x/build/env.
alandonovanb6cdc692018-04-23 13:15:40 -0400121
122
123## Access token
124
125To get an access token, you will need to ask one of the editors of the `golang-org` Google Cloud project to provide you with the hash reported by the page at `https://build-dot-golang-org.appspot.com/key?builder=user-$USER`, where `USER` is your username. Write the resulting token to the gomote config file, as in this hypothetical example:
126
127```
128$ echo d41d8cd98f00b204e9800998ecf8427e > $HOME/.config/gomote/user-$USER.token
129```