Documentation ¶
Index ¶
- type BuildManager
- type Context
- type Manager
- func (m *Manager) Accept(ctx context.Context, id int64, machine string) (*core.Stage, error)
- func (m *Manager) After(ctx context.Context, step *core.Step) error
- func (m *Manager) AfterAll(ctx context.Context, stage *core.Stage) error
- func (m *Manager) Before(ctx context.Context, step *core.Step) error
- func (m *Manager) BeforeAll(ctx context.Context, stage *core.Stage) error
- func (m *Manager) Details(ctx context.Context, id int64) (*Context, error)
- func (m *Manager) Netrc(ctx context.Context, id int64) (*core.Netrc, error)
- func (m *Manager) Request(ctx context.Context, args *Request) (*core.Stage, error)
- func (m *Manager) Upload(ctx context.Context, step int64, r io.Reader) error
- func (m *Manager) UploadBytes(ctx context.Context, step int64, data []byte) error
- func (m *Manager) Watch(ctx context.Context, id int64) (bool, error)
- func (m *Manager) Write(ctx context.Context, step int64, line *core.Line) error
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BuildManager ¶
type BuildManager interface { // Request requests the next available build stage for execution. Request(ctx context.Context, args *Request) (*core.Stage, error) // Accept accepts the build stage for execution. Accept(ctx context.Context, stage int64, machine string) (*core.Stage, error) // Netrc returns a valid netrc for execution. Netrc(ctx context.Context, repo int64) (*core.Netrc, error) // Details fetches build details Details(ctx context.Context, stage int64) (*Context, error) // Before signals the build step is about to start. Before(ctxt context.Context, step *core.Step) error // After signals the build step is complete. After(ctx context.Context, step *core.Step) error // Before signals the build stage is about to start. BeforeAll(ctxt context.Context, stage *core.Stage) error // After signals the build stage is complete. AfterAll(ctx context.Context, stage *core.Stage) error // Watch watches for build cancellation requests. Watch(ctx context.Context, stage int64) (bool, error) // Write writes a line to the build logs Write(ctx context.Context, step int64, line *core.Line) error // Upload uploads the full logs Upload(ctx context.Context, step int64, r io.Reader) error // UploadBytes uploads the full logs UploadBytes(ctx context.Context, step int64, b []byte) error }
BuildManager encapsulets complex build operations and provides a simplified interface for build runners.
func New ¶
func New( builds core.BuildStore, config core.ConfigService, events core.Pubsub, logs core.LogStore, logz core.LogStream, netrcs core.NetrcService, repos core.RepositoryStore, scheduler core.Scheduler, secrets core.SecretStore, globals core.GlobalSecretStore, status core.StatusService, stages core.StageStore, steps core.StepStore, system *core.System, users core.UserStore, webhook core.WebhookSender, ) BuildManager
New returns a new Manager.
type Context ¶
type Context struct { Repo *core.Repository `json:"repository"` Build *core.Build `json:"build"` Stage *core.Stage `json:"stage"` Config *core.File `json:"config"` Secrets []*core.Secret `json:"secrets"` System *core.System `json:"system"` }
Context represents the minimum amount of information required by the runner to execute a build.
type Manager ¶
type Manager struct { Builds core.BuildStore Config core.ConfigService Events core.Pubsub Globals core.GlobalSecretStore Logs core.LogStore Logz core.LogStream Netrcs core.NetrcService Repos core.RepositoryStore Scheduler core.Scheduler Secrets core.SecretStore Status core.StatusService Stages core.StageStore Steps core.StepStore System *core.System Users core.UserStore Webhook core.WebhookSender }
Manager provides a simplified interface to the build runner so that it can more easily interact with the server.
func (*Manager) Accept ¶
Accept accepts the build stage for execution. It is possible for multiple agents to pull the same stage from the queue. The system uses optimistic locking at the database-level to prevent multiple agents from executing the same stage.
func (*Manager) Netrc ¶
Netrc returns netrc file with a valid, non-expired token that can be used to clone the repository.
func (*Manager) UploadBytes ¶
UploadBytes uploads the full logs.
type Request ¶
type Request struct { Kind string `json:"kind"` Type string `json:"type"` OS string `json:"os"` Arch string `json:"arch"` Variant string `json:"variant"` Kernel string `json:"kernel"` Labels map[string]string `json:"labels,omitempty"` }
Request provildes filters when requesting a pending build from the queue. This allows an agent, for example, to request a build that matches its architecture and kernel.