Expand description
The scheduling loop: polls GitHub, pulls the profiles’ images, applies plan’s decisions with GitHub and
Docker, removes each runner’s container when its job ends, keeps the mirror up while any runner runs, reseeds
idle profiles and recovers runners and containers a previous daemon left. It also feeds the job history: queued
jobs, the job each runner took (from observe::capture), steps from GitHub, mirror bytes, cache sizes and slot
and budget changes. It owns slot state; it never serves the API (it publishes api::Status and takes commands
through Control) and never logs the token or a JIT config.
This module holds Engine‘s state, its construction and its loop; the submodules each add one concern’s
methods: recover (startup), tick (polling and planning), runners (a slot’s runner from start to removal),
images (pulling the profiles’ images), caches (reseeds, the mirror and the shared caches), build_cache (each
runner’s side of the shared build cache and whether its job may write), history (what
the store records), warm (how many warm runners each repository wants), control (the API’s commands) and
status (what it publishes).
Structs§
- Commands
- The engine’s end of
Control’s commands. - Commit
- What makes a new config durable, run by the engine before it runs with the config:
Okonce the config is in place, with a warning if it may not survive a crash;Errwith nothing changed. - Control
- Commands from the API and signals to the loop.
- Engine
- The scheduler with its side effects, on the real GitHub and Docker unless a test passes fakes.
- Handle
- What the API needs from a running engine.
- Host
Identity - This machine as its runner names carry it:
runnerd-<id>-<host>-<profile>-<slot>-<secs>. Onlyrunnerd-<id>-identifies the machine, so a changed host name still matches the runners started before the change, and two machines with the same or overlapping host names never take each other’s runners for their own. - Setup
- Where the engine runs, besides its config and its GitHub and Docker clients.
Enums§
- Command
- A command the engine carries out between ticks or while a tick waits for GitHub, with where its answer goes.
- Control
Error - Why the engine refused or failed a command from the API.
- Record
Selection - Which records a removal asks for.
- Running
Jobs - What a pause, a shutdown or a runner’s removal does with the jobs runners are running.
- Running
Slots - What a new config may do to slots with a runner in them.
- Shutdown
- How the daemon is asked to stop.
- Target
- The repositories a pause or a resume applies to.