Documentation
¶
Overview ¶
Package runner manages GitHub Actions runner registration and configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Org string `json:"org"`
Repo string `json:"repo,omitempty"`
RunID string `json:"run_id"`
JITToken string `json:"jit_token"`
Labels []string `json:"labels"`
RunnerGroup string `json:"runner_group,omitempty"`
JobID string `json:"job_id,omitempty"`
CacheToken string `json:"cache_token,omitempty"`
CacheURL string `json:"cache_url,omitempty"`
TerminationQueueURL string `json:"termination_queue_url,omitempty"`
IsOrg bool `json:"is_org"` // Deprecated: always false, kept for JSON compatibility
}
Config represents the configuration stored in SSM for a runner.
type GitHubClient ¶
type GitHubClient struct {
// contains filtered or unexported fields
}
GitHubClient handles GitHub App authentication and runner registration.
func NewGitHubClient ¶
func NewGitHubClient(appID string, privateKeyBase64 string) (*GitHubClient, error)
NewGitHubClient creates a new GitHub client for runner operations. privateKeyBase64 should be the base64-encoded PEM private key.
func (*GitHubClient) GetJITConfig ¶
func (c *GitHubClient) GetJITConfig(ctx context.Context, org string, runnerName string, labels []string) (string, error)
GetJITConfig gets a Just-In-Time runner configuration for registering a runner. Returns the JIT config that can be used with config.sh --jitconfig. The org parameter specifies which organization to register the runner for.
func (*GitHubClient) GetRegistrationToken ¶
func (c *GitHubClient) GetRegistrationToken(ctx context.Context, repo string) (*RegistrationResult, error)
GetRegistrationToken gets a registration token for GitHub Actions runners. Always uses repo-level endpoint to ensure runners only pick up jobs from the specific repository. Extracts owner from repo string (owner/repo format) for installation token. Retries transient errors with exponential backoff.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles runner registration and SSM configuration.
func NewManager ¶
func NewManager(awsCfg aws.Config, githubClient *GitHubClient, config ManagerConfig) *Manager
NewManager creates a new runner manager.
func (*Manager) CleanupRunner ¶
CleanupRunner deletes the SSM parameter for a runner.
func (*Manager) PrepareRunner ¶
func (m *Manager) PrepareRunner(ctx context.Context, req PrepareRunnerRequest) error
PrepareRunner creates the SSM parameter with runner configuration. This should be called after the EC2 instance is created but before it boots.
type ManagerConfig ¶
ManagerConfig holds configuration for the runner manager.
type PrepareRunnerRequest ¶
type PrepareRunnerRequest struct {
InstanceID string
JobID string
RunID string
Repo string // owner/repo format for repo-level registration
Labels []string
}
PrepareRunnerRequest contains parameters for preparing a runner.
type RegistrationResult ¶ added in v1.0.0
type RegistrationResult struct {
Token string
IsOrg bool // Deprecated: always false since repo-level registration is always used
}
RegistrationResult contains the registration token.
type SSMAPI ¶
type SSMAPI interface {
PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
DeleteParameter(ctx context.Context, params *ssm.DeleteParameterInput, optFns ...func(*ssm.Options)) (*ssm.DeleteParameterOutput, error)
}
SSMAPI defines SSM operations for runner configuration.