Documentation ¶
Index ¶
- Constants
- Variables
- func GetListener(addr string) (net.Listener, error)
- func GetTLSListener(addr string, conf *tls.Config) (net.Listener, error)
- func GetTask(r *http.Request) *model.Task
- func GetUser(r *http.Request) *user.DBUser
- func MustHaveTask(r *http.Request) *model.Task
- func MustHaveUser(r *http.Request) *user.DBUser
- func Serve(l net.Listener, handler http.Handler) error
- func UserMiddleware(um auth.UserManager) func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
- type APIServer
- func (as *APIServer) AppendTaskLog(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) AttachFiles(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) AttachResults(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) AttachTestLog(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) EndTask(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) FetchProjectVars(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) FetchTask(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) GetDistro(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) GetPatch(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) GetProjectRef(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) GetVersion(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) Handler() (http.Handler, error)
- func (as *APIServer) Heartbeat(w http.ResponseWriter, r *http.Request)
- func (as *APIServer) LoggedError(w http.ResponseWriter, r *http.Request, code int, err error)
- func (as *APIServer) StartTask(w http.ResponseWriter, r *http.Request)
- type PatchAPIRequest
- type PatchAPIResponse
- type PatchMetadata
- type TestServer
Constants ¶
const ( APIServerLockTitle = "apiserver" PatchLockTitle = "patches" )
Variables ¶
var ErrLockTimeout = errors.New("Timed out acquiring global lock")
ErrLockTimeout is returned when the database lock takes too long to be acquired.
Functions ¶
func GetListener ¶
GetListener creates a network listener on the given address.
func GetTLSListener ¶
GetTLSListener creates an encrypted listener with the given TLS config and address.
func MustHaveTask ¶
MustHaveTask get the task from an HTTP Request. Panics if the task is not in request context.
func MustHaveUser ¶
MustHaveUser gets the DBUser from an HTTP Request. Panics if the user is not found.
func UserMiddleware ¶
func UserMiddleware(um auth.UserManager) func(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
UserMiddleware checks for session tokens on the request, then looks up and attaches a user for that token if one is found.
Types ¶
type APIServer ¶
type APIServer struct { *render.Render UserManager auth.UserManager Settings evergreen.Settings // contains filtered or unexported fields }
APIServer handles communication with Evergreen agents and other back-end requests.
func (*APIServer) AppendTaskLog ¶
func (as *APIServer) AppendTaskLog(w http.ResponseWriter, r *http.Request)
AppendTaskLog appends the received logs to the task's internal logs.
func (*APIServer) AttachFiles ¶
func (as *APIServer) AttachFiles(w http.ResponseWriter, r *http.Request)
AttachFiles updates file mappings for a task or build
func (*APIServer) AttachResults ¶
func (as *APIServer) AttachResults(w http.ResponseWriter, r *http.Request)
AttachResults attaches the received results to the task in the database.
func (*APIServer) AttachTestLog ¶
func (as *APIServer) AttachTestLog(w http.ResponseWriter, r *http.Request)
AttachTestLog is the API Server hook for getting the test logs and storing them in the test_logs collection.
func (*APIServer) FetchProjectVars ¶
func (as *APIServer) FetchProjectVars(w http.ResponseWriter, r *http.Request)
FetchProjectVars is an API hook for returning the project variables associated with a task's project.
func (*APIServer) FetchTask ¶
func (as *APIServer) FetchTask(w http.ResponseWriter, r *http.Request)
FetchTask loads the task from the database and sends it to the requester.
func (*APIServer) GetDistro ¶
func (as *APIServer) GetDistro(w http.ResponseWriter, r *http.Request)
GetDistro loads the task's distro and sends it to the requester.
func (*APIServer) GetPatch ¶
func (as *APIServer) GetPatch(w http.ResponseWriter, r *http.Request)
GetPatch loads the task's patch data from the database and sends it to the requester.
func (*APIServer) GetProjectRef ¶
func (as *APIServer) GetProjectRef(w http.ResponseWriter, r *http.Request)
func (*APIServer) GetVersion ¶
func (as *APIServer) GetVersion(w http.ResponseWriter, r *http.Request)
func (*APIServer) Heartbeat ¶
func (as *APIServer) Heartbeat(w http.ResponseWriter, r *http.Request)
Heartbeat handles heartbeat pings from Evergreen agents. If the heartbeating task is marked to be aborted, the abort response is sent.
func (*APIServer) LoggedError ¶
LoggedError logs the given error and writes an HTTP response with its details formatted as JSON if the request headers indicate that it's acceptable (or plaintext otherwise).
type PatchAPIRequest ¶
type PatchAPIRequest struct { ProjectFileName string ModuleName string Githash string PatchContent string BuildVariants []string }
PatchAPIRequest in the input struct with which we process patch requests
func (*PatchAPIRequest) Validate ¶
func (pr *PatchAPIRequest) Validate(oauthToken string) (*PatchMetadata, error)
Validate checks an API request to see if it is safe and sane. Returns the relevant patch metadata and any errors that occur.
type PatchAPIResponse ¶
type PatchAPIResponse struct { Message string `json:"message"` Action string `json:"action"` Patch *patch.Patch `json:"patch"` }
PatchAPIResponse is returned by all patch-related API calls
type PatchMetadata ¶
type PatchMetadata struct { Githash string Project *model.Project Module *model.Module BuildVariants []string Summaries []thirdparty.Summary }
PatchMetadata stores relevant patch information that is not strictly part of the patch data.