garmbootstrap

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2026 License: AGPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL = "http://127.0.0.1:9997/api/v1"
	// Account identity — owner, repository, App slug and credential name —
	// belongs to the selected Tenant rather than to a constant, so one build
	// can serve more than one account without either being able to answer for
	// the other. See tenant.go for why that set is closed.
	//
	// GARM binds scale sets to one forge entity. A repository entity serves
	// exactly the repository it names; an organization entity serves every
	// repository the organization holds, including ones created later. The
	// second is what lets one fleet replace listeners shared across an
	// account, and it widens who can reach these pools, so it is opt-in and
	// never inferred. A repository allowlist, if one is wanted, belongs on the
	// GitHub runner group rather than here.
	EntityKindRepository              = "repository"
	EntityKindOrganization            = "organization"
	DefaultScaleSetName               = "nddev-linux-standard"
	IntegrationScaleSetName           = "nddev-linux-integration"
	FastScaleSetName                  = "nddev-linux-fast"
	UntrustedScaleSetName             = "nddev-linux-untrusted"
	ReleaseScaleSetName               = "nddev-linux-release"
	ContainerCanaryScaleSetName       = "nddev-linux-container-canary"
	DockerContainerCanaryScaleSetName = "nddev-linux-docker-container-canary"
	PriorityStandardScaleSetName      = "nddev-priority-standard"
	PriorityIntegrationScaleSetName   = "nddev-priority-integration"
	PriorityUntrustedScaleSetName     = "nddev-priority-untrusted"
	DefaultPoolBalancerType           = "roundrobin"
	DefaultProviderName               = "nddev-incus"
	DefaultImage                      = "nddev-ubuntu-24.04-amd64-container-current"
	IntegrationImage                  = "nddev-u24-amd64-ctr-docker-runner-2.336.0-r20260801-b2"
	PriorityStandardImage             = "nddev-ubuntu-24.04-amd64-container-runner-2.336.0-r20260801-b10"
	PriorityIntegrationImage          = "nddev-u24-amd64-ctr-docker-runner-2.336.0-r20260801-b4"
	// Every Linux class is an ephemeral Incus container. Docker-capable classes
	// use their nested-runtime image; release uses a separately stage-smoked
	// standard image so OIDC authority does not inherit Docker/nesting.
	FastImage                   = ContainerCanaryImage
	UntrustedImage              = IntegrationImage
	ReleaseImage                = "nddev-ubuntu-24.04-amd64-container-runner-2.336.0-r20260801-b7"
	ContainerCanaryImage        = "nddev-ubuntu-24.04-amd64-container-current"
	DockerContainerCanaryImage  = "nddev-u24-amd64-ctr-docker-runner-2.336.0-r20260801-b2"
	DefaultFlavor               = "nddev-linux-standard"
	IntegrationFlavor           = "nddev-linux-integration"
	FastFlavor                  = "nddev-linux-fast"
	UntrustedFlavor             = "nddev-linux-untrusted"
	ReleaseFlavor               = "nddev-linux-release"
	ContainerCanaryFlavor       = "nddev-linux-container-canary"
	DockerContainerCanaryFlavor = "nddev-linux-docker-container-canary"
	PriorityStandardFlavor      = "nddev-priority-standard"
	PriorityIntegrationFlavor   = "nddev-priority-integration"
	PriorityUntrustedFlavor     = "nddev-priority-untrusted"
	DefaultRunnerPrefix         = "nddev"
	DefaultBootstrapTimeoutMins = uint(5)
	// Mirrors githubappbootstrap. Duplicated rather than imported because the
	// reconciler must not depend on the one-time bootstrap path to read a
	// bundle that bootstrap already wrote and left behind.
	ActionsReadPermission = "actions"
	// Mirrors githubappbootstrap. An organization entity needs this permission
	// on its App; a repository entity does not and should not hold it.
	OrganizationRunnersPermission = "organization_self_hosted_runners"
	OwnerTypeOrganization         = "organization"
	OwnerTypeUser                 = "user"
	ActivationModeDirectJIT       = "direct-jit"
	ActivationModeMetadata        = "metadata"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Options

type Options struct {
	Registry tenant.Registry
	// Tenant selects which account this run reconciles. Empty means
	// DefaultTenantID, so an operator who passes nothing gets the account that
	// was already deployed.
	Tenant               string
	Repository           string
	BaseURL              string
	AdminCredentialsPath string
	CredentialAnchorPath string
	AppBundleDirectory   string
	ScaleSetName         string
	EntityKind           string
	Apply                bool
	Enable               bool
	ActivationMode       string
	MigrateActivation    bool
	MigrateCapacity      bool
	MigrateImage         bool
}

type ResourceSummary

type ResourceSummary struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

type Result

type Result struct {
	SchemaVersion  int              `json:"schema_version"`
	Applied        bool             `json:"applied"`
	Actions        []string         `json:"actions"`
	Credential     *ResourceSummary `json:"credential,omitempty"`
	Repository     *ResourceSummary `json:"repository,omitempty"`
	Organization   *ResourceSummary `json:"organization,omitempty"`
	ScaleSet       *ScaleSetSummary `json:"scale_set,omitempty"`
	ReadyToEnable  bool             `json:"ready_to_enable"`
	ReadyForCanary bool             `json:"ready_for_canary"`
	ObservedAt     time.Time        `json:"observed_at"`
}

type Runner

type Runner struct {
	HTTPClient *http.Client
	Random     io.Reader
	Now        func() time.Time
}

func (Runner) Run

func (r Runner) Run(ctx context.Context, options Options) (Result, error)

type ScaleSetClass

type ScaleSetClass struct {
	Name             string
	Image            string
	Flavor           string
	MaxRunners       uint
	RepositoryScoped bool
	Trust            string
	Credentials      string
	NetworkPolicy    string
	CacheWriteScope  string
	Docker           bool
	VCPU             int
	MemoryMiB        int
	DiskGiB          int
}

ScaleSetClass is one runner class the reconciler can register: the GARM scale set name, the Incus image alias a worker of that class boots from, and the pool policy the provider selects by.

func PublishedScaleSets

func PublishedScaleSets() []ScaleSetClass

PublishedScaleSets is the closed set of classes this reconciler can register, and the only place that set is written down. Registering a class is what makes GitHub keep it and route jobs to it, so the deployment contract proves every entry here has a worker image the provider can build: a class that is registrable and not buildable does not fail to exist, it accepts work and fails every create with a pool that has no pinned worker image.

type ScaleSetSummary

type ScaleSetSummary struct {
	ID                    uint   `json:"id"`
	GitHubScaleSetID      int    `json:"github_scale_set_id"`
	Name                  string `json:"name"`
	Enabled               bool   `json:"enabled"`
	DisableRunnerUpdate   bool   `json:"disable_runner_update"`
	Provider              string `json:"provider"`
	Image                 string `json:"image"`
	Flavor                string `json:"flavor"`
	MaximumRunners        uint   `json:"maximum_runners"`
	MinimumIdleRunners    uint   `json:"minimum_idle_runners"`
	BootstrapTimeoutMins  uint   `json:"bootstrap_timeout_minutes"`
	RemoteShellEnabled    bool   `json:"remote_shell_enabled"`
	ImmutableGuestUpdates bool   `json:"immutable_guest_updates_disabled"`
	DirectJITActivation   bool   `json:"direct_jit_warm_activation"`
}

Jump to

Keyboard shortcuts

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