Brad Fitzpatrick | 49a6e22 | 2017-03-28 13:59:03 -0700 | [diff] [blame] | 1 | # Using gomote |
| 2 | |
| 3 | ## Installing |
| 4 | |
| 5 | ``` |
Keith Randall | 959c53b | 2017-04-06 09:50:54 -0700 | [diff] [blame] | 6 | $ go get -u golang.org/x/build/cmd/gomote |
Brad Fitzpatrick | 49a6e22 | 2017-03-28 13:59:03 -0700 | [diff] [blame] | 7 | ``` |
| 8 | |
| 9 | ## Using |
| 10 | |
| 11 | TODO: examples. For now: |
| 12 | |
| 13 | ``` |
Hyang-Ah Hana Kim | 7c0b7e5 | 2018-10-10 16:37:56 -0400 | [diff] [blame] | 14 | The gomote command is a client for the Go builder infrastructure. It's a |
| 15 | remote control for remote Go builder machines. |
| 16 | |
| 17 | See https://golang.org/wiki/Gomote |
| 18 | |
| 19 | Usage: |
| 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 | |
| 30 | To 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 | |
| 48 | To list all the builder types available, run "create" with no arguments: |
| 49 | |
| 50 | $ gomote create |
| 51 | (list tons of buildlet types) |
| 52 | |
| 53 | The "gomote run" command has many of its own flags: |
| 54 | |
| 55 | $ gomote run -h |
Dmitri Shuralyov | eee0de3 | 2018-10-13 13:25:14 -0400 | [diff] [blame] | 56 | run usage: gomote run [run-opts] <instance> <cmd> [args...] |
Hyang-Ah Hana Kim | 7c0b7e5 | 2018-10-10 16:37:56 -0400 | [diff] [blame] | 57 | -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 | |
| 82 | Debugging buildlets directly |
| 83 | |
| 84 | Using "gomote create" contacts the build coordinator (farmer.golang.org) and |
| 85 | requests 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 |
| 87 | coordinator. To access a buildlet directly (for example, when working on the |
| 88 | buildlet code), you can skip the "gomote create" step and use the special |
| 89 | builder name "<build-config-name>@ip[:port>", such as |
| 90 | "windows-amd64-2008@10.1.5.3". |
Brad Fitzpatrick | 49a6e22 | 2017-03-28 13:59:03 -0700 | [diff] [blame] | 91 | ``` |
Brad Fitzpatrick | 3f1d563 | 2017-04-06 15:57:39 -0700 | [diff] [blame] | 92 | |
| 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 Klauser | b5b9a2b | 2017-12-12 15:26:15 +0100 | [diff] [blame] | 107 | |
| 108 | ### Subrepos on Unix |
| 109 | |
| 110 | Testing 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 Kim | 7d0e8b6 | 2018-03-01 14:36:33 -0500 | [diff] [blame] | 115 | ``` |
| 116 | |
| 117 | ## About Buildlets |
| 118 | |
| 119 | http://farmer.golang.org/builders lists information about how each buildlet is deployed and configured. |
| 120 | The information is from golang.org/x/build/dashboard and golang.org/x/build/env. |
alandonovan | b6cdc69 | 2018-04-23 13:15:40 -0400 | [diff] [blame] | 121 | |
| 122 | |
| 123 | ## Access token |
| 124 | |
| 125 | To 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 | ``` |