gomote

package
v0.0.0-...-a705825 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 3, 2024 License: BSD-3-Clause Imports: 34 Imported by: 0

README

Go Reference

golang.org/x/build/internal/gomote

Package gomote contains all of the necessary components to implement and use the gomote functionality.

Documentation

Overview

Package gomote contains all of the necessary components to implement and use the gomote functionality. Gomotes are instances which are dedicated to an individual user or service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildersClient

BuildersClient is a partial interface of the buildbuicketpb.BuildersClient interface.

type Server

type Server struct {
	// embed the unimplemented server.
	protos.UnimplementedGomoteServiceServer
	// contains filtered or unexported fields
}

Server is a gomote server implementation.

func New

func New(rsp *remote.SessionPool, sched *schedule.Scheduler, rawCAPriKey []byte, gomoteGCSBucket string, storageClient *storage.Client) *Server

New creates a gomote server. If the rawCAPriKey is invalid, the program will exit.

func (*Server) AddBootstrap

AddBootstrap adds the bootstrap version of Go to an instance and returns the URL for the bootstrap version. If no bootstrap version is defined then the returned version URL will be empty.

func (*Server) Authenticate

Authenticate will allow the caller to verify that they are properly authenticated and authorized to interact with the Service.

func (*Server) CreateInstance

CreateInstance will create a gomote instance for the authenticated user.

func (*Server) DestroyInstance

DestroyInstance will destroy a gomote instance. It will ensure that the caller is authenticated and is the owner of the instance before it destroys the instance.

func (*Server) ExecuteCommand

ExecuteCommand will execute a command on a gomote instance. The output from the command will be streamed back to the caller if the output is set.

func (*Server) InstanceAlive

InstanceAlive will ensure that the gomote instance is still alive and will extend the timeout. The requester must be authenticated.

func (*Server) ListDirectory

ListDirectory lists the contents of the directory on a gomote instance.

func (*Server) ListInstances

ListInstances will list the gomote instances owned by the requester. The requester must be authenticated.

func (*Server) ReadTGZToURL

ReadTGZToURL retrieves a directory from the gomote instance and writes the file to GCS. It returns a signed URL which the caller uses to read the file from GCS.

func (*Server) RemoveFiles

RemoveFiles removes files or directories from the gomote instance.

func (*Server) SignSSHKey

SignSSHKey signs the public SSH key with a certificate. The signed public SSH key is intended for use with the gomote service SSH server. It will be signed by the certificate authority of the server and will restrict access to the gomote instance that it was signed for.

func (*Server) UploadFile

UploadFile creates a URL and a set of HTTP post fields which are used to upload a file to a staging GCS bucket. Uploaded files are made available to the gomote instances via a subsequent call to one of the WriteFromURL endpoints.

func (*Server) WriteFileFromURL

WriteFileFromURL initiates an HTTP request to the passed in URL and streams the contents of the request to the gomote instance.

func (*Server) WriteTGZFromURL

WriteTGZFromURL will instruct the gomote instance to download the tar.gz from the provided URL. The tar.gz file will be unpacked in the work directory relative to the directory provided.

type SwarmOpts

type SwarmOpts struct {
	// 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()

	// OnInstanceRegistration optionally specifies a hook to run synchronously
	// after the instance has been registered in rendezvous.
	OnInstanceRegistration func()
}

SwarmOpts provides additional options for swarming task creation.

type SwarmingServer

type SwarmingServer struct {
	// embed the unimplemented server.
	protos.UnimplementedGomoteServiceServer
	// contains filtered or unexported fields
}

SwarmingServer is a gomote server implementation which supports LUCI swarming bots.

func NewSwarming

func NewSwarming(rsp *remote.SessionPool, rawCAPriKey []byte, gomoteGCSBucket string, storageClient *storage.Client, rdv *rendezvous.Rendezvous, swarmClient swarming.Client, buildersClient buildbucketpb.BuildersClient) (*SwarmingServer, error)

NewSwarming creates a gomote server. If the rawCAPriKey is invalid, the program will exit.

func (*SwarmingServer) AddBootstrap

AddBootstrap adds the bootstrap version of Go to an instance and returns the URL for the bootstrap version. If no bootstrap version is defined then the returned version URL will be empty.

func (*SwarmingServer) Authenticate

Authenticate will allow the caller to verify that they are properly authenticated and authorized to interact with the Service.

func (*SwarmingServer) CreateInstance

CreateInstance will create a gomote instance within a swarming task for the authenticated user.

func (*SwarmingServer) DestroyInstance

DestroyInstance will destroy a gomote instance. It will ensure that the caller is authenticated and is the owner of the instance before it destroys the instance.

func (*SwarmingServer) ExecuteCommand

ExecuteCommand will execute a command on a gomote instance. The output from the command will be streamed back to the caller if the output is set.

func (*SwarmingServer) InstanceAlive

InstanceAlive will ensure that the gomote instance is still alive and will extend the timeout. The requester must be authenticated.

func (*SwarmingServer) ListDirectory

ListDirectory lists the contents of the directory on a gomote instance.

func (*SwarmingServer) ListInstances

ListInstances will list the gomote instances owned by the requester. The requester must be authenticated.

func (*SwarmingServer) ListSwarmingBuilders

ListSwarmingBuilders lists all of the swarming builders which run for the Go master or release branches. The requester must be authenticated.

func (*SwarmingServer) ReadTGZToURL

ReadTGZToURL retrieves a directory from the gomote instance and writes the file to GCS. It returns a signed URL which the caller uses to read the file from GCS.

func (*SwarmingServer) RemoveFiles

RemoveFiles removes files or directories from the gomote instance.

func (*SwarmingServer) SignSSHKey

SignSSHKey signs the public SSH key with a certificate. The signed public SSH key is intended for use with the gomote service SSH server. It will be signed by the certificate authority of the server and will restrict access to the gomote instance that it was signed for.

func (*SwarmingServer) UploadFile

UploadFile creates a URL and a set of HTTP post fields which are used to upload a file to a staging GCS bucket. Uploaded files are made available to the gomote instances via a subsequent call to one of the WriteFromURL endpoints.

func (*SwarmingServer) WriteFileFromURL

WriteFileFromURL initiates an HTTP request to the passed in URL and streams the contents of the request to the gomote instance.

func (*SwarmingServer) WriteTGZFromURL

WriteTGZFromURL will instruct the gomote instance to download the tar.gz from the provided URL. The tar.gz file will be unpacked in the work directory relative to the directory provided.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL