actioncache

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package actioncache keeps a host-local cache of GitHub Action archives in the layout the actions runner reads through ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE: <dir>/<owner>_<repo>/<sha>.tar.gz. The runner only reads it, so the agent fills it after each job from the actions that job's log says it downloaded.

Index

Constants

View Source
const DefaultMaxBytes = 2 << 30

DefaultMaxBytes caps the cache; the oldest archives go first past it.

View Source
const DirName = "actions"

DirName is the cache's directory under the agent state dir. The VM CLIs name a guest share after the host folder, so this is also its name in the guest.

View Source
const EnvVar = "ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE"

EnvVar points the runner at the cache directory.

Variables

This section is empty.

Functions

func Path

func Path(dir, repo, sha string) string

Path is where the runner looks for repo's archive at sha.

Types

type Action

type Action struct {
	Repo string // owner/repo
	SHA  string
}

Action is one action repository at a resolved commit.

func Parse

func Parse(r io.Reader) ([]Action, error)

Parse returns the distinct actions a job log's setup section reports downloading, in order, at most maxActions. A subpath action (owner/repo/path) is cached under its repository.

type Cache

type Cache struct {
	Dir      string
	MaxBytes int64
	// Client returns the job scope's App client. Set it before the first fill.
	Client func(scope string) *github.Client
	// contains filtered or unexported fields
}

Cache fills and trims one host's archive directory.

func New

func New(dir string) (*Cache, error)

New creates dir and returns a cache. Fills authenticate with Client.

func (*Cache) Fill

func (c *Cache) Fill(job domain.Job)

Fill schedules a cache fill from a finished job. It never blocks: a full queue drops the job, which costs a later download, not a job.

func (*Cache) FillRun added in v0.2.15

func (c *Cache) FillRun(scope, owner, repo string, runID int64, runner string)

FillRun schedules a cache fill from the job that runner ran in run runID of owner/repo, under scope's App client. Scale-set completions carry the Actions service job id, not the REST one, so the fill looks the job up by runner. It never blocks.

func (*Cache) Reclaim

func (c *Cache) Reclaim() error

Reclaim empties the cache for disk-pressure reclaim. It removes the entries, not the directory, so live runner mounts of it stay valid.

func (*Cache) Run

func (c *Cache) Run(ctx context.Context)

Run works the fill queue until ctx is cancelled.

Jump to

Keyboard shortcuts

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