Documentation
¶
Overview ¶
Package app holds the orchestration both front-ends call.
It exists because the CLI and the TUI must not be two implementations. The first attempt put these helpers in internal/cli and had the TUI import them, which produced an import cycle the moment the CLI needed to launch the TUI -- a useful accident, because it forced the shared layer to be named rather than left implicit in whichever package happened to define it first.
Index ¶
- func AnyFailed(outcomes []Outcome) bool
- func ApplyWorkspace(pack *config.PackConfig, workspace string)
- func CheckAll(ctx context.Context, packs []*config.PackConfig) []checker.Result
- func LoadPacks(configDir, only string) ([]*config.PackConfig, error)
- func LoadPacksIn(configDir, only, workspace string) ([]*config.PackConfig, error)
- func PackSettings(stack settings.Stack, pack *config.PackConfig) (settings.Resolved, error)
- func RunRecipe(_ context.Context, pack *config.PackConfig, version string, ...) (pipeline.Result, error)
- type Checker
- type Outcome
- type RunFunc
- type Status
- type SyncOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyWorkspace ¶
func ApplyWorkspace(pack *config.PackConfig, workspace string)
ApplyWorkspace resolves a relative pack_root against the workspace setting.
Every shipped config names an absolute /work/<pack>, which is where the Docker image sees the mounted checkouts. A relative root is for running the binary on a laptop against sibling checkouts without editing four configs.
func CheckAll ¶
CheckAll resolves upstream status for every pack, in order.
Sequential on purpose. Polling four registries concurrently would save a second or two and cost the deterministic output order that makes a CI log diffable between runs.
func LoadPacks ¶
func LoadPacks(configDir, only string) ([]*config.PackConfig, error)
LoadPacks loads one pack, or every pack in registry order.
Shared so the two front-ends cannot disagree about what "every pack" means.
func LoadPacksIn ¶
func LoadPacksIn(configDir, only, workspace string) ([]*config.PackConfig, error)
LoadPacksIn is LoadPacks with a relative pack_root resolved against workspace, so the checker reads the vendored version from the right tree.
func PackSettings ¶
PackSettings resolves one pack's settings over the run-wide stack.
The pack layer is the config's `settings` block. It is parsed here rather than at load time because the schema has already checked its shape, and only the settings package knows which keys are pack-scoped.
func RunRecipe ¶
func RunRecipe(_ context.Context, pack *config.PackConfig, version string, opts recipes.Options) (pipeline.Result, error)
RunRecipe builds a pack's pipelines and runs them in order.
Aborts on the first failure and returns that result, rather than running the rest: the emoji recipe's trailing pipeline commits whatever the three asset pipelines left on disk, so continuing past a failed fetch would commit a half-refreshed pack.
Types ¶
type Outcome ¶
type Outcome struct {
Pack string
Status Status
Current string
Latest string
DryRun bool
Result pipeline.Result
Err error
}
Outcome is one pack's result.
func Sync ¶
func Sync(ctx context.Context, packs []*config.PackConfig, opts SyncOptions) []Outcome
Sync refreshes every pack that is behind upstream (or every pack, with force), and returns one outcome per pack in input order.
Two things fail loudly here that the Python let pass:
- An upstream whose latest version cannot be resolved is a failure, not a skip. The Python printed a yellow line and exited 0, so a dead registry or a renamed package looked exactly like an up-to-date pack, every Monday, indefinitely.
- A pack that declares no sinks is a failure unless this is a dry run: it would fetch, transform, and then write nothing, and report success.
Neither stops the other packs. One dead registry must not hold back the rest of the run; it makes the run exit non-zero once the rest are done.
type RunFunc ¶
type RunFunc func(ctx context.Context, pack *config.PackConfig, version string, opts recipes.Options) (pipeline.Result, error)
RunFunc builds and runs one pack's recipe.
type SyncOptions ¶
type SyncOptions struct {
// Stack is the run-wide settings; each pack's own layer is merged in.
Stack settings.Stack
// ConfigDir is handed to the recipes (the bundled manifest lives there).
ConfigDir string
// Concurrency bounds how many packs run at once. Below 1 means 1.
Concurrency int
Checker Checker
Run RunFunc
// Starting and Done are called around each pack, from that pack's
// goroutine, for progress output. Either may be nil. Calls are
// serialised, so a reporter need not lock.
Starting func(pack *config.PackConfig, result checker.Result, dryRun bool)
Done func(Outcome)
}
SyncOptions configures Sync.