runners

module
v0.0.0-...-aafd725 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT

README

Lanescape Runners

GitHub Actions runners for the repositories of the lanescape organization, and for no one else, on Google Cloud. A job asks for a machine by a label that names only its shape, as it would ask GitHub or any other runner provider, and gets a Compute Engine machine of its own for that job alone, booted from the service's Debian 13 base image. The job sets the machine up in its own steps, from its own commit, with passwordless sudo, and can ask in a step for a work disk, onto which it restores caches and from which it saves them, as archives in the service's caches' bucket, so that later jobs of the same pull request, or of main, start from them. A job's machine has no cloud identity that can reach anything: jobs that need one sign in with GitHub's token. Nothing runs before a workflow's jobs to set any of this up: the service binds each run itself, at its first job's check, from what GitHub told the job's runner on a fresh machine, confirmed against GitHub's records.

The code is public so that anyone can read it and contribute, but the service itself serves only the lanescape organization. Workflows name its machines in runs-on, and use it through the actions in actions/, lanescape/runners/actions/<name>@v1, which do nothing of the service's outside the organization.

The specs in specs/ describe what it does:

  • 0001 Architecture: the service, the organization-only guards, endpoints, passes, forks and contributions.
  • 0002 Machines: selectors, scopes and long-lived branches, binding a run, failing a job with its reason, a machine's life, the work disk, setting up a machine, preemption, and what's to be confirmed on real GitHub.
  • 0003 Base images, caches and resume images: base images, caches' keys, restoring and saving caches, resume images, and deleting them as early as nothing needs them.
  • 0004 Code, tests and deployment: Go, our own emulators, CI and CD on Blacksmith, the systems they support, Terraform through Infrastructure Manager, and the actions' v1 tag, which moves once its commit is deployed.
  • 0005 The interface for actions: selectors, .github/runners.json, work disks and caches, and what the actions may rely on, versioned as /v1/.
  • 0006 Build tools: the organization's private bucket of build tools, its layout, who reads it and how; apart from the service.
  • 0007 Actions: the actions in actions/, disk, checkout, cache and save-cache, how each degrades outside the organization, and how they're built and tested.

Supported systems

The organization's CI and CD runs on these systems, and on none older (specs/0004-deployment.md, Supported systems):

  • Linux: Debian 13 (trixie), with its Linux 6.12 LTS kernel, on the service's own machines, whose base images are made from it; and Ubuntu 26.04 on GitHub's and Blacksmith's runners, ubuntu-26.04, ubuntu-26.04-arm, blacksmith-<vCPUs>vcpu-ubuntu-2604 and blacksmith-<vCPUs>vcpu-ubuntu-2604-arm.
  • macOS: macOS 26.2, the version of the macOS SDK the organization's builds use, MacOSX26.2.sdk from Xcode 26.3 (Build tools, below), on GitHub's macos-26 and Blacksmith's blacksmith-<vCPUs>vcpu-macos-26.

Nothing here keeps a fallback for an older kernel, distribution or macOS. The actions also build for Windows on amd64, for GitHub's Windows runners, with no minimum version set.

Build tools

The organization's builds can copy platform-specific tools, SDKs and other files onto their runners from a private bucket, gs://lanescape-ci-tools, laid out as <platform>/<tool>/<version>/<file>, each file with its <file>.sha256 beside it, such as macos/sdk/26.2/MacOSX26.2.sdk.tar.zst. Objects never change: a new version gets a new path. A job of any of the organization's repositories reads it by signing in with GitHub's token through the provider projects/168731703350/locations/global/workloadIdentityPools/lanescape-ci-tools/providers/github as lanescape-ci-tools-reader@lanescape-dev.iam.gserviceaccount.com; a fork's job and a pull_request_target run's can't. Only the maintainer uploads. It's no part of the service, which never reads it, and its Terraform, in tools/, is applied by hand by the maintainer, with its own state (specs/0006-tools.md, tools/README.md).

Building and testing

The service is being built in stages. So far there's the configuration in config/, the emulators in emulators/, the pass's lease, the endpoints' authentication, the machines (selectors that name only a shape, making a machine for each queued job, binding a run at its first job's check, failing a job with its reason, the supervisor's report, cleanup and boot logs from Cloud Logging), the service's programs for the base images in machine/ (the supervisor, the job-started hook's script and program, and the program, unit and rule that mount a work disk at /work), work disks asked for by a job's disk requests, caches restored and saved through the cache requests, with their restore choices, downscoped tokens and expiry, long-lived branches' scopes, preemption records, resume images and reruns, the consumer's file and its caches' keys in internal/consumer, the webhook's publishing to Pub/Sub, the interface's constants in endpoints/, its emulator in emulators/service and the conformance suite in conformance/ that holds the emulator and the service to the same answers, the Debian 13 base images, which the service makes itself on builder machines when a deploy changes their key, from config/base.yaml, the builder's script machine/build-base.sh and the programs in machine/, the Terraform in bootstrap/ and infra/, the build tools' bucket in tools/, and CD, cd.yml, which builds the service with ko and applies infra/ through Infrastructure Manager once the maintainer has set its variables (bootstrap/README.md). The actions, disk, checkout, cache and save-cache, are in actions/, with what they share in actions/internal/.

go vet ./... && go vet -tags e2e ./...
gofmt -l .
go test -race ./...         # with the actions' end-to-end tests against the service emulator
go test -short -race ./...  # without them

Tests run against this repository's own emulators of GitHub and Google Cloud, and need no cloud or account. They need Go, at the version go.mod names, Git, Bash, curl and jq, and on Linux a C compiler, since -race builds with cgo there. The tests of cd/apply.sh also need Bash 4.4 or newer, as Ubuntu has, and skip without it: macOS's own /bin/bash is 3.2, so on a Mac they look for Homebrew's too.

Licensed under the MIT License.

Directories

Path Synopsis
actions
cache command
Command cache is the cache action's program (specs/0007-actions.md, cache): it asks the runner service which version of a cache the run restores, downloads its objects from Cloud Storage, checking each, and extracts them under a directory, the files' archives at once and the directories' archive last.
Command cache is the cache action's program (specs/0007-actions.md, cache): it asks the runner service which version of a cache the run restores, downloads its objects from Cloud Storage, checking each, and extracts them under a directory, the files' archives at once and the directories' archive last.
checkout command
Command checkout is the checkout action's program (specs/0007-actions.md, checkout).
Command checkout is the checkout action's program (specs/0007-actions.md, checkout).
disk command
Command disk is the disk action's program (specs/0007-actions.md, disk): it asks the runner service for the job's work disk, asks again while the disk is being made, and waits until it's mounted at /work.
Command disk is the disk action's program (specs/0007-actions.md, disk): it asks the runner service for the job's work disk, asks again while the disk is being made, and waits until it's mounted at /work.
internal/actions
Package actions is what a step's program gets from GitHub Actions and gives back: its environment, its inputs, its outputs, its summary, and the masking of values the log must never show.
Package actions is what a step's program gets from GitHub Actions and gives back: its environment, its inputs, its outputs, its summary, and the masking of values the log must never show.
internal/archive
Package archive is how a cache's tree becomes archives and comes back (specs/0007-actions.md, save-cache and cache): a parallel walk, shards of files and symlinks balanced by the reads they take, and tar archives in PAX format, compressed with zstd, of each shard and of the directories.
Package archive is how a cache's tree becomes archives and comes back (specs/0007-actions.md, save-cache and cache): a parallel walk, shards of files and symlinks balanced by the reads they take, and tar archives in PAX format, compressed with zstd, of each shard and of the directories.
internal/backoff
Package backoff is how the actions wait between attempts at a call that may succeed later.
Package backoff is how the actions wait between attempts at a call that may succeed later.
internal/event
Package event is what the actions read of a run's event: the job's GITHUB_ variables and the event's payload, at GITHUB_EVENT_PATH.
Package event is what the actions read of a run's event: the job's GITHUB_ variables and the event's payload, at GITHUB_EVENT_PATH.
internal/gcs
Package gcs uploads and downloads a cache's objects with Cloud Storage's JSON API, signed with the short-lived, downscoped access token the runner service hands a job for them (specs/0007-actions.md, save-cache and cache).
Package gcs uploads and downloads a cache's objects with Cloud Storage's JSON API, signed with the short-lived, downscoped access token the runner service hands a job for them (specs/0007-actions.md, save-cache and cache).
internal/metadata
Package metadata asks the machine's metadata server, as Compute Engine serves it, whether the machine is one of the runner service's, and for its identity token: for an audience, in the full format, which names the machine.
Package metadata asks the machine's metadata server, as Compute Engine serves it, whether the machine is one of the runner service's, and for its identity token: for an audience, in the full format, which names the machine.
internal/mount
Package mount tells whether a directory is a mount point, as a process sees its mounts in /proc/self/mountinfo.
Package mount tells whether a directory is a mount point, as a process sees its mounts in /proc/self/mountinfo.
internal/service
Package service calls the runner service through its interface for actions, specs/0005-interface.md: nothing else of the service's is relied on.
Package service calls the runner service through its interface for actions, specs/0005-interface.md: nothing else of the service's is relied on.
internal/testgithub
Package testgithub is what the tests need of this repository's GitHub emulator beyond the emulator itself: a job's environment, as GitHub gives a step its variables, event, files and GITHUB_TOKEN, and the tokens handed out, which tests check no log shows.
Package testgithub is what the tests need of this repository's GitHub emulator beyond the emulator itself: a job's environment, as GitHub gives a step its variables, event, files and GITHUB_TOKEN, and the tokens handed out, which tests check no log shows.
internal/where
Package where decides whether an action is inside the organization or outside it (specs/0007-actions.md, Where an action is).
Package where decides whether an action is inside the organization or outside it (specs/0007-actions.md, Where an action is).
save-cache command
Command save-cache is the save-cache action's program (specs/0007-actions.md, save-cache): it asks the runner service for a version of a cache to save, walks a directory, uploads its files and symlinks in shards, and its directories, as compressed archives to Cloud Storage, all at once, and then commits the version.
Command save-cache is the save-cache action's program (specs/0007-actions.md, save-cache): it asks the runner service for a version of a cache to save, walks a directory, uploads its files and symlinks in shards, and its directories, as compressed archives to Cloud Storage, all at once, and then commits the version.
cmd
runners command
Command runners is the service, on Cloud Run (specs/0001-architecture.md).
Command runners is the service, on Cloud Run (specs/0001-architecture.md).
Package config is the service's configuration: the organization's ID, shapes, the runner version and what goes into the base images.
Package config is the service's configuration: the organization's ID, shapes, the runner version and what goes into the base images.
Package conformance is the interface's test suite (specs/0005-interface.md): one set of cases that this repository runs, in CI, against both its service emulator, emulators/service, and the real service wired to its emulators of GitHub, Compute Engine, Google's issuers, Pub/Sub and Cloud Storage.
Package conformance is the interface's test suite (specs/0005-interface.md): one set of cases that this repository runs, in CI, against both its service emulator, emulators/service, and the real service wired to its emulators of GitHub, Compute Engine, Google's issuers, Pub/Sub and Cloud Storage.
emulators
compute
Package compute emulates the parts of Compute Engine the service uses, as Google's REST client (google.golang.org/api/compute/v1) calls them over HTTP: instances, with their labels, metadata, guest attributes and serial output; disks, attached and detached; images; and zone and global operations.
Package compute emulates the parts of Compute Engine the service uses, as Google's REST client (google.golang.org/api/compute/v1) calls them over HTTP: instances, with their labels, metadata, guest attributes and serial output; disks, attached and detached; images; and zone and global operations.
fault
Package fault makes an emulator fail requests as the real service does: before doing the work, after doing it with the response lost, slowly, or by dropping the connection.
Package fault makes an emulator fail requests as the real service does: before doing the work, after doing it with the response lost, slowly, or by dropping the connection.
github
Package github emulates the parts of GitHub the service uses: the REST API as go-github calls it, authenticated as a GitHub App installation; an Actions OIDC issuer; and signed webhook deliveries.
Package github emulates the parts of GitHub the service uses: the REST API as go-github calls it, authenticated as a GitHub App installation; an Actions OIDC issuer; and signed webhook deliveries.
github/cmd/standin command
Command standin is the GitHub emulator's runner stand-in as a program, in place of the runner's run.sh: configured from its environment as the runner is, it takes one job, runs its job-started hook and steps, reports it and exits.
Command standin is the GitHub emulator's runner stand-in as a program, in place of the runner's run.sh: configured from its environment as the runner is, it takes one job, runs its job-started hook and steps, reports it and exits.
google
Package google emulates Google's ID token issuer, as Cloud Scheduler and Pub/Sub push subscriptions sign their calls: tokens for a service account's email, with the audience the caller was configured with; the bodies of Pub/Sub's pushes; and Pub/Sub's publishing (PubSub).
Package google emulates Google's ID token issuer, as Cloud Scheduler and Pub/Sub push subscriptions sign their calls: tokens for a service account's email, with the audience the caller was configured with; the bodies of Pub/Sub's pushes; and Pub/Sub's publishing (PubSub).
oidc
Package oidc is an OpenID Connect issuer with its own signing keys and published key set, for emulating GitHub's Actions tokens and Google's ID tokens.
Package oidc is an OpenID Connect issuer with its own signing keys and published key set, for emulating GitHub's Actions tokens and Google's ID tokens.
service
Package service emulates this repository's service as its interface for actions describes it (specs/0005-interface.md), and nothing more: runs bound at their first job's check, as the service binds them, work disks, always empty, and caches, restored from the versions of the run's restore chain and saved into the caches' bucket of a Cloud Storage emulator.
Package service emulates this repository's service as its interface for actions describes it (specs/0005-interface.md), and nothing more: runs bound at their first job's check, as the service binds them, work disks, always empty, and caches, restored from the versions of the run's restore chain and saved into the caches' bucket of a Cloud Storage emulator.
storage
Package storage emulates Cloud Storage's JSON and XML APIs, as cloud.google.com/go/storage calls them over HTTP: buckets of objects with generations, preconditions, reads, lists by prefix and deletes, and uploads in one request or resumable, in chunks.
Package storage emulates Cloud Storage's JSON and XML APIs, as cloud.google.com/go/storage calls them over HTTP: buckets of objects with generations, preconditions, reads, lists by prefix and deletes, and uploads in one request or resumable, in chunks.
Package endpoints is where the service is, and the one organization it serves, as the actions that call it rely on (specs/0005-interface.md, Where the service is).
Package endpoints is where the service is, and the one organization it serves, as the actions that call it rely on (specs/0005-interface.md, Where the service is).
internal
auth
Package auth authenticates the service's callers (specs/0001-architecture.md, Endpoints): GitHub's webhook deliveries by their HMAC signature, Google's signed calls from the scheduler and push subscriptions, and the service's machines by their Compute Engine identity tokens.
Package auth authenticates the service's callers (specs/0001-architecture.md, Endpoints): GitHub's webhook deliveries by their HMAC signature, Google's signed calls from the scheduler and push subscriptions, and the service's machines by their Compute Engine identity tokens.
bases
Package bases makes the service's base images (specs/0003-disks.md, Base images): one per architecture, lsr-base-<arch>-<key>, whose key covers everything that goes into it.
Package bases makes the service's base images (specs/0003-disks.md, Base images): one per architecture, lsr-base-<arch>-<key>, whose key covers everything that goes into it.
binding
Package binding binds each run's scope, once, in the bucket (specs/0002-machines.md, Binding a run).
Package binding binds each run's scope, once, in the bucket (specs/0002-machines.md, Binding a run).
compute
Package compute is the service's view of Compute Engine: its machines, their disks and the images they boot, in one project, through Google's REST client.
Package compute is the service's view of Compute Engine: its machines, their disks and the images they boot, in one project, through Google's REST client.
consumer
Package consumer reads what a consumer's repository says to the service (specs/0005-interface.md, A consumer's files): its .github/runners.json, and the keys of its caches (specs/0003-disks.md, Keys).
Package consumer reads what a consumer's repository says to the service (specs/0005-interface.md, A consumer's files): its .github/runners.json, and the keys of its caches (specs/0003-disks.md, Keys).
deploy
Package deploy orders the service's deploys, so that a revision a later deploy replaced makes no more machines or base images' builders (specs/0004-deployment.md, Which revision makes machines).
Package deploy orders the service's deploys, so that a revision a later deploy replaced makes no more machines or base images' builders (specs/0004-deployment.md, Which revision makes machines).
disks
Package disks keeps consumers' caches, and makes resume images of the work disks of jobs lost to a preemption or to the age limit (specs/0003-disks.md, specs/0002-machines.md, Preemption).
Package disks keeps consumers' caches, and makes resume images of the work disks of jobs lost to a preemption or to the age limit (specs/0003-disks.md, specs/0002-machines.md, Preemption).
github
Package github is the service's view of GitHub: what it reads, as the organization's GitHub App installation, with every answer classed as confirmed or not.
Package github is the service's view of GitHub: what it reads, as the organization's GitHub App installation, with every answer classed as confirmed or not.
lease
Package lease keeps a lease in the bucket: an object taken with a generation precondition, valid for a fixed time unless renewed, and released by deleting exactly the generation its holder last wrote (specs/0001-architecture.md, Passes).
Package lease keeps a lease in the bucket: an object taken with a generation precondition, valid for a fixed time unless renewed, and released by deleting exactly the generation its holder last wrote (specs/0001-architecture.md, Passes).
logging
Package logging reads the service's machines' boot logs from Cloud Logging (specs/0002-machines.md, A machine's life): Compute Engine sends a machine's serial console there, and serves a stopped or deleted machine's console from nowhere else.
Package logging reads the service's machines' boot logs from Cloud Logging (specs/0002-machines.md, A machine's life): Compute Engine sends a machine's serial console there, and serves a stopped or deleted machine's console from nowhere else.
machines
Package machines gives queued jobs machines and ends their lives (specs/0002-machines.md, A machine's life): a pass makes a machine for each job that may have one, from one pool for every consumer, oldest job first, and deletes what's finished; the job-started check decides, from GitHub's records, whether the job a machine's runner took may run there; an admitted job asks for its work disk and its save in its steps; and the supervisor's report says the job is done.
Package machines gives queued jobs machines and ends their lives (specs/0002-machines.md, A machine's life): a pass makes a machine for each job that may have one, from one pool for every consumer, oldest job first, and deletes what's finished; the job-started check decides, from GitHub's records, whether the job a machine's runner took may run there; an admitted job asks for its work disk and its save in its steps; and the supervisor's report says the job is done.
pass
Package pass runs the reconciler's passes one at a time, under the lease (specs/0001-architecture.md, Passes): taken at the start, renewed every minute, released at the end, with an absolute deadline that caps every call a pass makes, and a stop to everything once a renewal fails.
Package pass runs the reconciler's passes one at a time, under the lease (specs/0001-architecture.md, Passes): taken at the start, renewed every minute, released at the end, with an absolute deadline that caps every call a pass makes, and a stop to everything once a renewal fails.
pubsub
Package pubsub publishes the webhook's checked deliveries to Pub/Sub (specs/0001-architecture.md, Components): each delivery's body as a message's data, with its event as the attribute "event", for the push subscription to deliver to the reconcile endpoint.
Package pubsub publishes the webhook's checked deliveries to Pub/Sub (specs/0001-architecture.md, Components): each delivery's body as a message's data, with its event as the attribute "event", for the push subscription to deliver to the reconcile endpoint.
scope
Package scope is a run's scope: where it may read and save disks (specs/0002-machines.md, Scope).
Package scope is a run's scope: where it may read and save disks (specs/0002-machines.md, Scope).
selector
Package selector reads the one label a job asks for a machine by (specs/0002-machines.md, Selectors):
Package selector reads the one label a job asks for a machine by (specs/0002-machines.md, Selectors):
server
Package server is the service's HTTP interface, versioned under /v1/ (specs/0001-architecture.md, Endpoints).
Package server is the service's HTTP interface, versioned under /v1/ (specs/0001-architecture.md, Endpoints).
servicetest
Package servicetest wires the real service, its machines, disks and webhook, to this repository's emulators of GitHub, Google's issuers, Pub/Sub, Compute Engine and Cloud Storage, as a service.World: what the conformance suite drives.
Package servicetest wires the real service, its machines, disks and webhook, to this repository's emulators of GitHub, Google's issuers, Pub/Sub, Compute Engine and Cloud Storage, as a service.World: what the conformance suite drives.
store
Package store keeps the service's records in its Cloud Storage bucket, with generation preconditions so that concurrent writers never overwrite each other unknowingly.
Package store keeps the service's records in its Cloud Storage bucket, with generation preconditions so that concurrent writers never overwrite each other unknowingly.
tokens
Package tokens mints OAuth access tokens downscoped to one prefix of the caches' bucket, with Google's Credential Access Boundaries, from the service's own credentials (specs/0003-disks.md, Caches): a job gets one that may only read a version's objects, or one that may only create objects under its own version's prefix.
Package tokens mints OAuth access tokens downscoped to one prefix of the caches' bucket, with Google's Credential Access Boundaries, from the service's own credentials (specs/0003-disks.md, Caches): a job gets one that may only read a version's objects, or one that may only create objects under its own version's prefix.
Package machine holds what the service puts on its base images, embedded in the service's binary so that nothing in a consumer's repository can change what a machine does before its job starts or after it ends (specs/0004-deployment.md): the sources of the service's three programs, the supervisor, the job-started hook's program and the program that mounts the work disk, each using only Go's standard library and building from its own files alone, as a statically linked binary; the job-started hook's script, which only runs its program; and the units and rule that start the others (specs/0002-machines.md, A machine's life); and the builder's script, which installs them and everything else a base image holds (specs/0003-disks.md, Making a base image).
Package machine holds what the service puts on its base images, embedded in the service's binary so that nothing in a consumer's repository can change what a machine does before its job starts or after it ends (specs/0004-deployment.md): the sources of the service's three programs, the supervisor, the job-started hook's program and the program that mounts the work disk, each using only Go's standard library and building from its own files alone, as a statically linked binary; the job-started hook's script, which only runs its program; and the units and rule that start the others (specs/0002-machines.md, A machine's life); and the builder's script, which installs them and everything else a base image holds (specs/0003-disks.md, Making a base image).
hook command
Command job-started is the job-started hook's program (specs/0002-machines.md, The job-started check).
Command job-started is the job-started hook's program (specs/0002-machines.md, The job-started check).
mountwork command
Command mount-work mounts the work disk at /work (specs/0002-machines.md, The work disk).
Command mount-work mounts the work disk at /work (specs/0002-machines.md, The work disk).
supervisor command
Command supervisor is the service's own program on every machine (specs/0002-machines.md, A machine's life).
Command supervisor is the service's own program on every machine (specs/0002-machines.md, A machine's life).

Jump to

Keyboard shortcuts

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