Help us shape the future of Go! Take the 2026 Go Developer Survey

runner

package
v0.2.23 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ResultsURLVar is the variable the unpatched runner exports.
	ResultsURLVar = "ACTIONS_RESULTS_URL"
	// ResultsURLRenamed is what a patched runner exports GitHub's address
	// as instead. Same length as ResultsURLVar — see above.
	ResultsURLRenamed = "ACTIONS_RESULTS_ORL"
)

The GitHub runner exports the cache/artifact service address to every step as ACTIONS_RESULTS_URL, taken from the job message. It sets it on the step's own environment, so it overwrites any value the container was started with — which is why ephemerd cannot simply point jobs at its LAN cache with an env var.

PatchResultsURL renames that one string inside Runner.Worker.dll to a name of the same length. The runner then exports GitHub's address under the unused name, and the ACTIONS_RESULTS_URL ephemerd put in the container's environment is what the step sees. This is the technique falcondev-oss/github-actions-cache-server documents; the rename has to be same-length because the string lives in the assembly's #US heap, whose entries are length-prefixed.

Verified against runner 2.337.0 (linux-x64 tarball and the win-x64 zip embedded here): Runner.Worker.dll holds exactly ONE UTF-16LE occurrence and Runner.Common.dll/Runner.Sdk.dll hold none.

Variables

View Source
var Version = "unknown"

Runner version embedded at build time.

View Source
var WorkerDLL = filepath.Join("bin", "Runner.Worker.dll")

WorkerDLL is the runner assembly that holds the string, relative to the runner root.

Functions

func PatchResultsURL added in v0.2.23

func PatchResultsURL(data []byte) (patched bool)

PatchResultsURL rewrites every UTF-16LE occurrence of ResultsURLVar in data in place. It reports whether data now exports the renamed variable: true when it patched at least one occurrence or data was already patched, false when neither name is present (a runner version that no longer reads the variable from this assembly — the caller must then leave the cache off).

func PatchResultsURLFile added in v0.2.23

func PatchResultsURLFile(runnerRoot, writableRoot string) (bool, error)

PatchResultsURLFile patches the Runner.Worker.dll under runnerRoot.

When writableRoot is non-empty and differs from runnerRoot, the patched copy is written to writableRoot (an overlay upperdir, or a per-job copy) and runnerRoot is never modified — the shared runner tree must stay byte-identical for jobs that do not use the LAN cache. Otherwise the file is rewritten in place, keeping its mode.

A missing assembly or an absent string is not an error: it returns false and the caller simply does not turn the cache on for the job.

Types

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager handles extraction and caching of the embedded GitHub Actions runner.

func New

func New(dataDir string, log *slog.Logger) *Manager

New creates a runner manager.

func (*Manager) ContainerDir

func (m *Manager) ContainerDir() string

ContainerDir returns the mount target path inside the container.

func (*Manager) Dir

func (m *Manager) Dir() string

Dir returns the path to the extracted runner directory. The path is OS-specific (e.g. runners/2.333.1-linux) so that macOS and Linux extractions don't collide on shared filesystems (virtio-fs). Call Extract() first to ensure it exists.

func (*Manager) Entrypoint

func (m *Manager) Entrypoint() string

Entrypoint returns the runner entrypoint command for the current OS.

func (*Manager) Extract

func (m *Manager) Extract() error

Extract extracts the embedded runner tarball to the data directory. If the runner is already extracted (cached), this is a no-op.

Jump to

Keyboard shortcuts

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