Documentation
¶
Overview ¶
Package runner runs deploys and rollbacks queued from the Alror console, inside your own infrastructure (like a CI runner). It claims jobs from the Alror workspace over POST /jobs/claim (long-poll), runs them with the rollout engine against the remote store, and reports each outcome with POST /jobs/{id}/finish.
Stopping is graceful: cancelling the context passed to Run stops claiming new jobs, while jobs already running finish under JobContext. A rolled-back release is a successful job (status done): it is an outcome, not a failure.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrFatal = errors.New("runner cannot continue")
ErrFatal wraps errors that retrying cannot fix (bad key, missing scope).
Functions ¶
func RiskFor ¶
func RiskFor(p api.DeployPayload, service string) (domain.RiskReport, error)
RiskFor builds the risk report for a deploy job. Runners have no git context, so without risk_override the change is treated as medium risk.
Types ¶
type Runner ¶
type Runner struct {
Client *api.Client
Store store.Store // default store.NewRemote(Client)
Name string // reported as claimed_by; default "runner"
Concurrency int // parallel jobs; default 1
// Log receives one line per event. It must be safe for concurrent use.
Log func(Level, string)
// JobContext bounds running jobs (default context.Background()). Cancel
// it to abort jobs in flight: the engine then rolls the canary back.
JobContext context.Context
// MinBackoff and MaxBackoff bound the retry delay while the server is down (1 s, 30 s).
MinBackoff, MaxBackoff time.Duration
// HeartbeatInterval is how often a running job's lease is extended
// (default 30 s). Losing the lease (409) aborts the job without finishing it.
HeartbeatInterval time.Duration
// Test hooks.
Wait func(ctx context.Context, d time.Duration, tick func(float64)) error
NewDriver func(config.Service) (driver.Driver, error)
NewMetrics func(*config.Config) (metrics.Provider, error)
}
Runner claims and runs jobs. Only Client is required.