Documentation ¶
Overview ¶
Package worker contains the Worker implementation that is used for handling builds that are submitted to the server.
Index ¶
- type Runner
- func (r *Runner) Collector() (runner.Collector, error)
- func (r *Runner) DriverBuffer() *bytes.Buffer
- func (r *Runner) DriverJob() *build.Job
- func (r *Runner) Init() error
- func (r *Runner) Placer() (runner.Placer, error)
- func (r *Runner) Run(ctx context.Context, jobId string, d *build.Driver) (runner.Status, error)
- func (r *Runner) Tail() string
- type Worker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Runner ¶
Runner is what's used for actually running the build retrieved from the worker. This will handle updating the state of the build and its jobs in the database whilst the build runs.
func (*Runner) Collector ¶
Collector returns the configured runner.Collector implementation to use for collecting build artifacts.
func (*Runner) DriverBuffer ¶
DriverBuffer returns the buffer for the job that created the driver for the build's runner. If one cannot be found then nil is returned.
func (*Runner) DriverJob ¶
DriverJob returns the build pseudo-job that was added to the build for tracking the progress of driver creation.
func (*Runner) Init ¶
Init initializes the underlying runner.Runner for build execution with the build data from the database.
func (*Runner) Placer ¶
Placer returns the configured runner.Placer implementation to use for placing build objects and keys into a build.
type Worker ¶
type Worker struct { // DB is the client to the SQL database. DB *sqlx.DB // Redis is the client to the Redis database from where submitted builds // will be processed from. Redis *redis.Client // SMTP is the client to the SMTP server we use for sending emails about // a build's progress. SMTP *mail.Client // Admin is the email address that should be used in emails sent from the // worker on build failures. Admin string // Crypto is the block cipher to use for decrypting access tokens when // interacting with a provider's REST API. Crypto *crypto.AESGCM // Log is the logger implementation used for logging information about the // running builds. Log *log.Logger // Consumer is the consumer used for retrieving builds from the queue. Consumer *curlyq.Consumer Queue queue.Queue // Queue for dispatching webhooks. Driver string // Driver is the name of the driver the worker is configured for. Timeout time.Duration // Timeout is the maximum duration a build can run for. Init driver.Init // Init is the initialization function for the worker's driver. Config driver.Config // Config is the global configuration for the worker's driver. // Providers is the registry containing the provider client implementations // used for updating a build's commit status, if submitted via a pull // request hook. Providers *provider.Registry Objects fs.Store // The fs.Store from where we place build objects. Artifacts fs.Store // The fs.Store to where we collect build artifacts. }