runner

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

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

View Source
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 Level

type Level int

Level classifies a log line.

const (
	Info Level = iota
	OK
	Warn
	Error
)

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.

func (*Runner) Run

func (rn *Runner) Run(ctx context.Context, once bool) error

Run claims and executes jobs until ctx is cancelled. With once, it makes a single claim (one long-poll), runs the job if one arrived, and returns.

Jump to

Keyboard shortcuts

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