runner

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 CompareVersions added in v0.3.0

func CompareVersions(a, b []int) int

CompareVersions returns >0 if a>b, <0 if a<b, 0 if equal, comparing numeric components left to right (a missing component counts as 0).

func ExtractArchive added in v0.3.0

func ExtractArchive(r io.Reader, name, dest string) error

ExtractArchive extracts a runner archive stream into dest. The format is chosen by name: ".zip" for the Windows runner, gzip'd tar otherwise. Path traversal is rejected exactly as for the embedded runner.

func ParseVersion added in v0.3.0

func ParseVersion(name string) []int

ParseVersion extracts the numeric version components from a runner archive name like "actions-runner-linux-x64-2.338.2.tar.gz" -> [2 338 2]. Names it can't parse return nil, which sorts lowest.

func ParseVersionString added in v0.3.0

func ParseVersionString(v string) []int

ParseVersionString parses a bare version like "2.338.2" -> [2 338 2]. Returns nil when any component is not a number.

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) EmbeddedArchive added in v0.3.0

func (m *Manager) EmbeddedArchive() (string, fs.File, error)

EmbeddedArchive opens the embedded runner archive that Extract would use for this OS (the highest embedded version). The returned name is the archive's base filename (e.g. "actions-runner-linux-x64-2.337.0.tar.gz"); the caller closes the file.

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