Documentation ¶
Overview ¶
Package buildlet contains client tools for working with a buildlet server.
Index ¶
- Variables
- func DestroyVM(ts oauth2.TokenSource, proj, zone, instance string) error
- type Client
- func (c *Client) Close() error
- func (c *Client) Destroy() error
- func (c *Client) DestroyVM(ts oauth2.TokenSource, proj, zone, instance string) error
- func (c *Client) Exec(cmd string, opts ExecOpts) (remoteErr, execErr error)
- func (c *Client) GetTar(dir string) (tgz io.ReadCloser, err error)
- func (c *Client) ListDir(dir string, opts ListDirOpts, fn func(DirEntry)) error
- func (c *Client) Put(r io.Reader, path string, mode os.FileMode) error
- func (c *Client) PutTar(r io.Reader, dir string) error
- func (c *Client) PutTarFromURL(tarURL, dir string) error
- func (c *Client) RemoveAll(paths ...string) error
- func (c *Client) SetCloseFunc(fn func() error)
- func (c *Client) SetDescription(v string)
- func (c *Client) SetHTTPClient(httpClient *http.Client)
- func (c *Client) Status() (Status, error)
- func (c *Client) String() string
- func (c *Client) URL() string
- func (c *Client) WorkDir() (string, error)
- type DirEntry
- type ExecOpts
- type KeyPair
- type ListDirOpts
- type Status
- type VM
- type VMOpts
Constants ¶
This section is empty.
Variables ¶
var GCEGate func()
GCEGate optionally specifies a function to run before any GCE API call. It's intended to be used to bound QPS rate to GCE.
var NoKeyPair = KeyPair{}
NoKeyPair is used by the coordinator to speak http directly to buildlets, inside their firewall, without TLS.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
A Client interacts with a single buildlet.
func NewClient ¶
NewClient returns a *Client that will manipulate ipPort, authenticated using the provided keypair.
This constructor returns immediately without testing the host or auth.
func StartNewVM ¶
StartNewVM boots a new VM on GCE and returns a buildlet client configured to speak to it.
func (*Client) DestroyVM ¶
func (c *Client) DestroyVM(ts oauth2.TokenSource, proj, zone, instance string) error
DestroyVM shuts down the buildlet and destroys the VM instance.
func (*Client) Exec ¶
Exec runs cmd on the buildlet.
Two errors are returned: one is whether the command succeeded remotely (remoteErr), and the second (execErr) is whether there were system errors preventing the command from being started or seen to completition. If execErr is non-nil, the remoteErr is meaningless.
func (*Client) GetTar ¶
func (c *Client) GetTar(dir string) (tgz io.ReadCloser, err error)
GetTar returns a .tar.gz stream of the given directory, relative to the buildlet's work dir. The provided dir may be empty to get everything.
func (*Client) ListDir ¶
func (c *Client) ListDir(dir string, opts ListDirOpts, fn func(DirEntry)) error
ListDir lists the contents of a directory. The fn callback is run for each entry.
func (*Client) PutTar ¶
PutTar writes files to the remote buildlet, rooted at the relative directory dir. If dir is empty, they're placed at the root of the buildlet's work directory. The dir is created if necessary. The Reader must be of a tar.gz file.
func (*Client) PutTarFromURL ¶
PutTarFromURL tells the buildlet to download the tar.gz file from tarURL and write it to dir, a relative directory from the workdir. If dir is empty, they're placed at the root of the buildlet's work directory. The dir is created if necessary. The url must be of a tar.gz file.
func (*Client) SetCloseFunc ¶
SetCloseFunc sets a function to be called when c.Close is called. SetCloseFunc must not be called concurrently with Close.
func (*Client) SetDescription ¶
SetDescription sets a short description of where the buildlet connection came from. This is used by the build coordinator status page, mostly for debugging.
func (*Client) SetHTTPClient ¶
SetHTTPClient replaces the underlying HTTP client.
type DirEntry ¶
type DirEntry struct {
// contains filtered or unexported fields
}
DirEntry is the information about a file on a buildlet.
type ExecOpts ¶
type ExecOpts struct { // Output is the output of stdout and stderr. // If nil, the output is discarded. Output io.Writer // Dir is the directory from which to execute the command. // It is optional. If not specified, it defaults to the directory of // the command, or the work directory if SystemLevel is set. Dir string // Args are the arguments to pass to the cmd given to Client.Exec. Args []string // ExtraEnv are KEY=VALUE pairs to append to the buildlet // process's environment. ExtraEnv []string // SystemLevel controls whether the command is run outside of // the buildlet's environment. SystemLevel bool // Debug, if true, instructs to the buildlet to print extra debug // info to the output before the command begins executing. Debug bool // OnStartExec is an optional hook that runs after the 200 OK // response from the buildlet, but before the output begins // writing to Output. OnStartExec func() }
ExecOpts are options for a remote command invocation.
type KeyPair ¶
KeyPair is the TLS public certificate PEM file and its associated private key PEM file that a builder will use for its HTTPS server. The zero value means no HTTPs, which is used by the coordinator for machines running within a firewall.
func NewKeyPair ¶
type ListDirOpts ¶
type ListDirOpts struct { // Recursive controls whether the directory is listed // recursively. Recursive bool // Skip are the directories to skip, relative to the directory // passed to ListDir. Each item should contain only forward // slashes and not start or end in slashes. Skip []string // Digest controls whether the SHA-1 digests of regular files // are returned. Digest bool }
ListDirOpts are options for Client.ListDir.
type Status ¶
type Status struct {
Version int // buildlet version, coordinator rejects any value less than 1.
}
Status provides status information about the buildlet.
A coordinator can use the provided information to decide what, if anything, to do with a buildlet.
type VM ¶
type VMOpts ¶
type VMOpts struct { // Zone is the GCE zone to create the VM in. Required. Zone string // ProjectID is the GCE project ID. Required. ProjectID string // TLS optionally specifies the TLS keypair to use. // If zero, http without auth is used. TLS KeyPair // Optional description of the VM. Description string // Optional metadata to put on the instance. Meta map[string]string // to delete the VM. DeleteIn time.Duration // OnInstanceRequested optionally specifies a hook to run synchronously // after the computeService.Instances.Insert call, but before // waiting for its operation to proceed. OnInstanceRequested func() // OnInstanceCreated optionally specifies a hook to run synchronously // after the instance operation succeeds. OnInstanceCreated func() // OnInstanceCreated optionally specifies a hook to run synchronously // after the computeService.Instances.Get call. OnGotInstanceInfo func() }
VMOpts control how new VMs are started.