scaleset

package
v0.2.13 Latest Latest
Warning

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

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

Documentation

Overview

Package scaleset implements a Source backed by GitHub's Runner Scale Set API (the mechanism behind actions-runner-controller, via the standalone actions/scaleset client).

Instead of polling repos for queued jobs, each scale set holds a long-poll message session; GitHub pushes the set's desired runner count (statistics.TotalAssignedJobs) and per-job lifecycle events. The source emits one credential-free job per missing runner, labelled with the set name — the scheduler and agents downstream are unchanged — and mints the runner's JIT config only when the server dispatches the job (the Source is the controller's JITMinter in this mode, and its DispatchObserver: agent done-reports clear the supply ledger within seconds, and idle scale-down is controller-driven — agents never idle-reap managed dispatches). GitHub then assigns queued work to whichever runner registers. This removes the whole polling cost class: no repo list scans, no rate-limit breaker, no dedup of re-listed jobs.

A scale set's name doubles as the runs-on label workflows target, and repo scoping is enforced GitHub-side by the runner group the set lives in.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

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

Source streams jobs derived from scale set desired-count messages and mints their JIT configs at dispatch (it implements the server's JITMinter and DispatchObserver).

func New

func New(orgs []config.Org, version string) (*Source, error)

New validates the org/set configuration. Credentials are only exercised on Subscribe.

func (*Source) DispatchDone

func (s *Source) DispatchDone(handle string, failed bool)

DispatchDone implements api.DispatchObserver: every terminal agent report clears the runner's ledger slot within seconds, so supply reconciliation runs on real events rather than TTL guesswork.

func (*Source) Mint

func (s *Source) Mint(ctx context.Context, name string, job domain.Job, _ []string) (string, error)

Mint implements api.JITMinter: it registers a fresh runner under the offered name in the scale set that emitted the job. Called on server HTTP goroutines.

func (*Source) Name

func (s *Source) Name(job domain.Job, _ string) (string, error)

Name implements api.JITMinter: scale-set runner names are random per dispatch (a re-dispatched job gets a fresh runner, never a name collision), prefixed with the owning set for attribution.

func (*Source) Subscribe

func (s *Source) Subscribe(ctx context.Context) (<-chan domain.Job, error)

Subscribe ensures every configured scale set exists, then runs one message listener per set. All clients and scale sets are set up before any listener starts, so a failure can't strand live message sessions behind an error return. The channel closes when ctx is cancelled and all listeners have wound down.

Jump to

Keyboard shortcuts

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