Documentation
¶
Index ¶
- Constants
- Variables
- type Account
- type AccountListItem
- type AccountListOptions
- type AccountPreference
- type AccountPreferenceStore
- type AccountRoleUpdate
- type AccountSecret
- type AccountSecretStore
- type AccountStats
- type AuditEvent
- type AuditStore
- type DBStore
- func (s *DBStore) AccountScopeForPersonalGitHubInstallation(installationID int64) (int64, bool, error)
- func (s *DBStore) ActiveCount() (int, error)
- func (s *DBStore) ActiveCountForProfile(name string) (int, error)
- func (s *DBStore) AppendAuditEvent(event AuditEvent) (AuditEvent, error)
- func (s *DBStore) AppendLog(id, name string, data []byte)
- func (s *DBStore) ClaimNextRunnable(workerID string, now time.Time, leaseTTL time.Duration) (RunnerRequest, RunnerState, bool, error)
- func (s *DBStore) CreateRequest(req RunnerRequest, payload []byte) (bool, RunnerState, error)
- func (s *DBStore) DeleteAccountSecret(scopeType string, scopeID int64, keyType string) error
- func (s *DBStore) DeleteGitHubInstallation(accountID, id int64) error
- func (s *DBStore) DeleteProfile(name string) error
- func (s *DBStore) DeleteRepositoryPolicy(id int64) error
- func (s *DBStore) DeleteRunnerGroup(name string) error
- func (s *DBStore) DeleteSandboxServiceDefaultAPIKey() error
- func (s *DBStore) DeleteSandboxServiceDefaultAudience(id int64) error
- func (s *DBStore) Ensure() error
- func (s *DBStore) EnsureAccountForOAuthIdentity(identity OAuthIdentity, role string) (Account, OAuthIdentity, error)
- func (s *DBStore) GetAccount(accountID int64) (Account, error)
- func (s *DBStore) GetAccountByOAuthIdentity(provider, subject string) (Account, OAuthIdentity, error)
- func (s *DBStore) GetAccountPreference(scopeType string, scopeID int64, namespace, key string) (AccountPreference, error)
- func (s *DBStore) GetAccountSecret(scopeType string, scopeID int64, keyType string) (AccountSecret, error)
- func (s *DBStore) GetAccountStats() (AccountStats, error)
- func (s *DBStore) GetGitHubInstallationOwner(installationID int64) (GitHubInstallationAccount, error)
- func (s *DBStore) GetOAuthIdentityForAccount(accountID int64, provider string) (OAuthIdentity, error)
- func (s *DBStore) GetProfile(name string) (RunnerProfile, error)
- func (s *DBStore) GetRepositoryPolicy(id int64) (RepositoryPolicy, error)
- func (s *DBStore) GetRunnerGroup(name string) (RunnerGroup, error)
- func (s *DBStore) GetSandboxServiceDefault() (SandboxServiceDefault, error)
- func (s *DBStore) GitHubInstallationAccountForInstallation(installationID int64) (GitHubInstallationAccount, error)
- func (s *DBStore) GitHubInstallationAccountForLogin(accountLogin string) (GitHubInstallationAccount, error)
- func (s *DBStore) GitHubInstallationScopeForAccountLogin(accountLogin string) (int64, bool, error)
- func (s *DBStore) InFlightCount() (int, error)
- func (s *DBStore) InFlightCountForProfile(name string) (int, error)
- func (s *DBStore) LinkOAuthIdentityToAccount(accountID int64, identity OAuthIdentity) (Account, OAuthIdentity, error)
- func (s *DBStore) ListAccounts(options AccountListOptions) ([]AccountListItem, int64, error)
- func (s *DBStore) ListActiveStates() ([]RunnerState, error)
- func (s *DBStore) ListAuditEvents(limit int) ([]AuditEvent, error)
- func (s *DBStore) ListFailedWorkflowJobStates(limit int) ([]RunnerState, error)
- func (s *DBStore) ListGitHubInstallationAccounts() ([]GitHubInstallationAccount, error)
- func (s *DBStore) ListGitHubInstallations(accountID int64) ([]GitHubInstallation, error)
- func (s *DBStore) ListMismatchedCompletedStates(limit int) ([]RunnerState, error)
- func (s *DBStore) ListProfiles() ([]RunnerProfile, error)
- func (s *DBStore) ListRepositoryPolicies() ([]RepositoryPolicy, error)
- func (s *DBStore) ListRunnerGroups() ([]RunnerGroup, error)
- func (s *DBStore) ListSandboxServiceDefaultAudiences() ([]SandboxServiceDefaultAudience, error)
- func (s *DBStore) ListStates() ([]RunnerState, error)
- func (s *DBStore) ListStatesForGitHubInstallationRepositories(access []GitHubInstallationRepositoryAccess, limit, offset int) ([]RunnerState, int64, error)
- func (s *DBStore) ListStatesForGitHubInstallations(installationIDs []int64, limit int) ([]RunnerState, error)
- func (s *DBStore) ListStatesForRepositories(repositories []string, limit int) ([]RunnerState, error)
- func (s *DBStore) ListStatesPage(limit, offset int) ([]RunnerState, int64, error)
- func (s *DBStore) MatchProfile(repositoryFullName string, labels []string) (ProfileMatch, error)
- func (s *DBStore) ReadLog(id, name string, maxBytes int64) ([]byte, error)
- func (s *DBStore) ReadRequest(id string) (RunnerRequest, error)
- func (s *DBStore) ReadState(id string) (RunnerState, error)
- func (s *DBStore) ReconcileManagedProfiles(profiles []RunnerProfile) ([]ManagedProfileConflict, error)
- func (s *DBStore) ReleaseLease(id, workerID string) error
- func (s *DBStore) RetryRequest(id string, now time.Time) (RunnerState, error)
- func (s *DBStore) SandboxServiceDefaultAudienceContains(githubAccountID int64, accountType string) (bool, error)
- func (s *DBStore) UpdateAccountRoleWithAudit(update AccountRoleUpdate) (Account, error)
- func (s *DBStore) UpdateSandboxServiceDefaultPreservingAPIKey(defaultConfig SandboxServiceDefault) (SandboxServiceDefault, error)
- func (s *DBStore) UpsertAccountForOAuthIdentity(identity OAuthIdentity, role string) (Account, OAuthIdentity, error)
- func (s *DBStore) UpsertAccountPreference(preference AccountPreference) (AccountPreference, error)
- func (s *DBStore) UpsertAccountPreferenceAndDeleteSecret(preference AccountPreference, secret AccountSecret) (AccountPreference, error)
- func (s *DBStore) UpsertAccountPreferenceAndSecret(preference AccountPreference, secret *AccountSecret) (AccountPreference, *AccountSecret, error)
- func (s *DBStore) UpsertAccountSecret(secret AccountSecret) (AccountSecret, error)
- func (s *DBStore) UpsertGitHubInstallation(installation GitHubInstallation) (GitHubInstallation, error)
- func (s *DBStore) UpsertGitHubInstallationOwner(installationID int64, owner GitHubInstallationAccount) (GitHubInstallationAccount, error)
- func (s *DBStore) UpsertProfile(profile RunnerProfile) (RunnerProfile, error)
- func (s *DBStore) UpsertRepositoryPolicy(policy RepositoryPolicy) (RepositoryPolicy, error)
- func (s *DBStore) UpsertRunnerGroup(group RunnerGroup) (RunnerGroup, error)
- func (s *DBStore) UpsertSandboxServiceDefault(defaultConfig SandboxServiceDefault) (SandboxServiceDefault, error)
- func (s *DBStore) UpsertSandboxServiceDefaultAudience(audience SandboxServiceDefaultAudience) (SandboxServiceDefaultAudience, error)
- func (s *DBStore) WriteState(st RunnerState) error
- type GitHubInstallation
- type GitHubInstallationAccount
- type GitHubInstallationRepositoryAccess
- type GitHubInstallationStore
- type IdentityStore
- type ManagedProfileConflict
- type OAuthIdentity
- type Options
- type ProfileMatch
- type RepositoryPolicy
- type RunnerCatalogStore
- type RunnerGroup
- type RunnerProfile
- type RunnerRequest
- type RunnerRequestStore
- type RunnerState
- type SandboxServiceDefault
- type SandboxServiceDefaultAudience
- type SandboxServiceDefaultStore
- type Store
Constants ¶
const ( StatusQueued = "queued" StatusCreating = "creating" StatusRunning = "running" StatusStopping = "stopping" StatusCompleted = "completed" StatusFailed = "failed" )
const ( BackendSQLite = "sqlite" BackendPostgres = "postgres" BackendMySQL = "mysql" )
const ( AccountSecretTypeSandboxAPIKey = "sandbox_api_key" AccountSecretTypeGitHubOAuthToken = "github_oauth_token" AccountScopeTypeAccount = "account" AccountScopeTypeGitHubInstall = "github_installation" )
const ( SandboxServiceDefaultAudienceModeAll = "all" SandboxServiceDefaultAudienceModeSelected = "selected" )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
ID int64 `json:"id"`
Role string `json:"role"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Account represents a local user account.
type AccountListItem ¶
type AccountListItem struct {
Account
OAuthIdentities []OAuthIdentity `json:"oauth_identities"`
}
AccountListItem combines a local account with all linked OAuth identities.
type AccountListOptions ¶
AccountListOptions controls account search, role filtering, and pagination.
type AccountPreference ¶
type AccountPreference struct {
ID int64 `json:"id"`
ScopeType string `json:"scope_type"`
ScopeID int64 `json:"scope_id"`
Namespace string `json:"namespace"`
Key string `json:"key"`
ValueJSON string `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AccountPreference stores a non-secret structured preference for one account.
type AccountPreferenceStore ¶
type AccountPreferenceStore interface {
GetAccountPreference(scopeType string, scopeID int64, namespace, key string) (AccountPreference, error)
UpsertAccountPreference(preference AccountPreference) (AccountPreference, error)
UpsertAccountPreferenceAndSecret(preference AccountPreference, secret *AccountSecret) (AccountPreference, *AccountSecret, error)
UpsertAccountPreferenceAndDeleteSecret(preference AccountPreference, secret AccountSecret) (AccountPreference, error)
}
type AccountRoleUpdate ¶
type AccountRoleUpdate struct {
ActorAccountID int64
AccountID int64
Role string
AuditActor string
}
AccountRoleUpdate describes an audited administrator-initiated role change.
type AccountSecret ¶
type AccountSecret struct {
ID int64 `json:"id"`
ScopeType string `json:"scope_type"`
ScopeID int64 `json:"scope_id"`
KeyType string `json:"key_type"`
EncryptedValue string `json:"-"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
AccountSecret stores an encrypted named secret for one account.
type AccountSecretStore ¶
type AccountSecretStore interface {
GetAccountSecret(scopeType string, scopeID int64, keyType string) (AccountSecret, error)
UpsertAccountSecret(secret AccountSecret) (AccountSecret, error)
DeleteAccountSecret(scopeType string, scopeID int64, keyType string) error
}
type AccountStats ¶
type AccountStats struct {
TotalAccounts int64 `json:"total_accounts"`
AdminAccounts int64 `json:"admin_accounts"`
UserAccounts int64 `json:"user_accounts"`
OAuthIdentities int64 `json:"oauth_identities"`
}
AccountStats summarizes local accounts, roles, and linked OAuth identities.
type AuditEvent ¶
type AuditStore ¶
type AuditStore interface {
AppendAuditEvent(event AuditEvent) (AuditEvent, error)
ListAuditEvents(limit int) ([]AuditEvent, error)
}
type DBStore ¶
type DBStore struct {
// contains filtered or unexported fields
}
func (*DBStore) AccountScopeForPersonalGitHubInstallation ¶
func (*DBStore) ActiveCount ¶
func (*DBStore) ActiveCountForProfile ¶
func (*DBStore) AppendAuditEvent ¶
func (s *DBStore) AppendAuditEvent(event AuditEvent) (AuditEvent, error)
func (*DBStore) ClaimNextRunnable ¶
func (s *DBStore) ClaimNextRunnable(workerID string, now time.Time, leaseTTL time.Duration) (RunnerRequest, RunnerState, bool, error)
func (*DBStore) CreateRequest ¶
func (s *DBStore) CreateRequest(req RunnerRequest, payload []byte) (bool, RunnerState, error)
func (*DBStore) DeleteAccountSecret ¶
func (*DBStore) DeleteGitHubInstallation ¶
func (*DBStore) DeleteProfile ¶
func (*DBStore) DeleteRepositoryPolicy ¶
func (*DBStore) DeleteRunnerGroup ¶
func (*DBStore) DeleteSandboxServiceDefaultAPIKey ¶
func (*DBStore) DeleteSandboxServiceDefaultAudience ¶
func (*DBStore) EnsureAccountForOAuthIdentity ¶
func (s *DBStore) EnsureAccountForOAuthIdentity(identity OAuthIdentity, role string) (Account, OAuthIdentity, error)
func (*DBStore) GetAccount ¶
GetAccount returns a local account by its stable database ID.
func (*DBStore) GetAccountByOAuthIdentity ¶
func (s *DBStore) GetAccountByOAuthIdentity(provider, subject string) (Account, OAuthIdentity, error)
func (*DBStore) GetAccountPreference ¶
func (*DBStore) GetAccountSecret ¶
func (*DBStore) GetAccountStats ¶
func (s *DBStore) GetAccountStats() (AccountStats, error)
GetAccountStats returns unfiltered account, role, and OAuth identity totals.
func (*DBStore) GetGitHubInstallationOwner ¶
func (s *DBStore) GetGitHubInstallationOwner(installationID int64) (GitHubInstallationAccount, error)
func (*DBStore) GetOAuthIdentityForAccount ¶
func (s *DBStore) GetOAuthIdentityForAccount(accountID int64, provider string) (OAuthIdentity, error)
func (*DBStore) GetProfile ¶
func (s *DBStore) GetProfile(name string) (RunnerProfile, error)
func (*DBStore) GetRepositoryPolicy ¶
func (s *DBStore) GetRepositoryPolicy(id int64) (RepositoryPolicy, error)
func (*DBStore) GetRunnerGroup ¶
func (s *DBStore) GetRunnerGroup(name string) (RunnerGroup, error)
func (*DBStore) GetSandboxServiceDefault ¶
func (s *DBStore) GetSandboxServiceDefault() (SandboxServiceDefault, error)
func (*DBStore) GitHubInstallationAccountForInstallation ¶
func (s *DBStore) GitHubInstallationAccountForInstallation(installationID int64) (GitHubInstallationAccount, error)
func (*DBStore) GitHubInstallationAccountForLogin ¶
func (s *DBStore) GitHubInstallationAccountForLogin(accountLogin string) (GitHubInstallationAccount, error)
func (*DBStore) GitHubInstallationScopeForAccountLogin ¶
func (*DBStore) InFlightCount ¶
func (*DBStore) InFlightCountForProfile ¶
func (*DBStore) LinkOAuthIdentityToAccount ¶
func (s *DBStore) LinkOAuthIdentityToAccount(accountID int64, identity OAuthIdentity) (Account, OAuthIdentity, error)
func (*DBStore) ListAccounts ¶
func (s *DBStore) ListAccounts(options AccountListOptions) ([]AccountListItem, int64, error)
ListAccounts returns one page of accounts with their linked OAuth identities.
func (*DBStore) ListActiveStates ¶
func (s *DBStore) ListActiveStates() ([]RunnerState, error)
func (*DBStore) ListAuditEvents ¶
func (s *DBStore) ListAuditEvents(limit int) ([]AuditEvent, error)
func (*DBStore) ListFailedWorkflowJobStates ¶
func (s *DBStore) ListFailedWorkflowJobStates(limit int) ([]RunnerState, error)
func (*DBStore) ListGitHubInstallationAccounts ¶
func (s *DBStore) ListGitHubInstallationAccounts() ([]GitHubInstallationAccount, error)
func (*DBStore) ListGitHubInstallations ¶
func (s *DBStore) ListGitHubInstallations(accountID int64) ([]GitHubInstallation, error)
func (*DBStore) ListMismatchedCompletedStates ¶
func (s *DBStore) ListMismatchedCompletedStates(limit int) ([]RunnerState, error)
func (*DBStore) ListProfiles ¶
func (s *DBStore) ListProfiles() ([]RunnerProfile, error)
func (*DBStore) ListRepositoryPolicies ¶
func (s *DBStore) ListRepositoryPolicies() ([]RepositoryPolicy, error)
func (*DBStore) ListRunnerGroups ¶
func (s *DBStore) ListRunnerGroups() ([]RunnerGroup, error)
func (*DBStore) ListSandboxServiceDefaultAudiences ¶
func (s *DBStore) ListSandboxServiceDefaultAudiences() ([]SandboxServiceDefaultAudience, error)
func (*DBStore) ListStates ¶
func (s *DBStore) ListStates() ([]RunnerState, error)
func (*DBStore) ListStatesForGitHubInstallationRepositories ¶
func (s *DBStore) ListStatesForGitHubInstallationRepositories(access []GitHubInstallationRepositoryAccess, limit, offset int) ([]RunnerState, int64, error)
func (*DBStore) ListStatesForGitHubInstallations ¶
func (s *DBStore) ListStatesForGitHubInstallations(installationIDs []int64, limit int) ([]RunnerState, error)
func (*DBStore) ListStatesForRepositories ¶
func (s *DBStore) ListStatesForRepositories(repositories []string, limit int) ([]RunnerState, error)
func (*DBStore) ListStatesPage ¶
func (s *DBStore) ListStatesPage(limit, offset int) ([]RunnerState, int64, error)
func (*DBStore) MatchProfile ¶
func (s *DBStore) MatchProfile(repositoryFullName string, labels []string) (ProfileMatch, error)
func (*DBStore) ReadRequest ¶
func (s *DBStore) ReadRequest(id string) (RunnerRequest, error)
func (*DBStore) ReconcileManagedProfiles ¶ added in v0.2.7
func (s *DBStore) ReconcileManagedProfiles(profiles []RunnerProfile) ([]ManagedProfileConflict, error)
ReconcileManagedProfiles creates or upgrades catalog-owned profiles while preserving operator controls.
func (*DBStore) ReleaseLease ¶
func (*DBStore) RetryRequest ¶
func (*DBStore) SandboxServiceDefaultAudienceContains ¶
func (*DBStore) UpdateAccountRoleWithAudit ¶
func (s *DBStore) UpdateAccountRoleWithAudit(update AccountRoleUpdate) (Account, error)
UpdateAccountRoleWithAudit atomically updates an account role and records the administrator action.
func (*DBStore) UpdateSandboxServiceDefaultPreservingAPIKey ¶
func (s *DBStore) UpdateSandboxServiceDefaultPreservingAPIKey(defaultConfig SandboxServiceDefault) (SandboxServiceDefault, error)
func (*DBStore) UpsertAccountForOAuthIdentity ¶
func (s *DBStore) UpsertAccountForOAuthIdentity(identity OAuthIdentity, role string) (Account, OAuthIdentity, error)
func (*DBStore) UpsertAccountPreference ¶
func (s *DBStore) UpsertAccountPreference(preference AccountPreference) (AccountPreference, error)
func (*DBStore) UpsertAccountPreferenceAndDeleteSecret ¶
func (s *DBStore) UpsertAccountPreferenceAndDeleteSecret(preference AccountPreference, secret AccountSecret) (AccountPreference, error)
func (*DBStore) UpsertAccountPreferenceAndSecret ¶
func (s *DBStore) UpsertAccountPreferenceAndSecret(preference AccountPreference, secret *AccountSecret) (AccountPreference, *AccountSecret, error)
func (*DBStore) UpsertAccountSecret ¶
func (s *DBStore) UpsertAccountSecret(secret AccountSecret) (AccountSecret, error)
func (*DBStore) UpsertGitHubInstallation ¶
func (s *DBStore) UpsertGitHubInstallation(installation GitHubInstallation) (GitHubInstallation, error)
func (*DBStore) UpsertGitHubInstallationOwner ¶
func (s *DBStore) UpsertGitHubInstallationOwner(installationID int64, owner GitHubInstallationAccount) (GitHubInstallationAccount, error)
func (*DBStore) UpsertProfile ¶
func (s *DBStore) UpsertProfile(profile RunnerProfile) (RunnerProfile, error)
func (*DBStore) UpsertRepositoryPolicy ¶
func (s *DBStore) UpsertRepositoryPolicy(policy RepositoryPolicy) (RepositoryPolicy, error)
func (*DBStore) UpsertRunnerGroup ¶
func (s *DBStore) UpsertRunnerGroup(group RunnerGroup) (RunnerGroup, error)
func (*DBStore) UpsertSandboxServiceDefault ¶
func (s *DBStore) UpsertSandboxServiceDefault(defaultConfig SandboxServiceDefault) (SandboxServiceDefault, error)
func (*DBStore) UpsertSandboxServiceDefaultAudience ¶
func (s *DBStore) UpsertSandboxServiceDefaultAudience(audience SandboxServiceDefaultAudience) (SandboxServiceDefaultAudience, error)
func (*DBStore) WriteState ¶
func (s *DBStore) WriteState(st RunnerState) error
type GitHubInstallation ¶
type GitHubInstallation struct {
ID int64 `json:"id"`
AccountID int64 `json:"account_id"`
InstallationID int64 `json:"installation_id"`
GitHubAccountID int64 `json:"github_account_id,omitempty"`
AccountType string `json:"account_type,omitempty"`
AccountLogin string `json:"account_login,omitempty"`
AccountName string `json:"account_name,omitempty"`
AccountAvatar string `json:"account_avatar,omitempty"`
Repositories []string `json:"repositories"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
GitHubInstallation is a per-account GitHub App installation link. Repositories contains repositories observed by runnerd for that installation, not the full GitHub App authorization scope.
type GitHubInstallationRepositoryAccess ¶
GitHubInstallationRepositoryAccess preserves repositories within one installation authorization scope.
type GitHubInstallationStore ¶
type GitHubInstallationStore interface {
ListGitHubInstallations(accountID int64) ([]GitHubInstallation, error)
ListGitHubInstallationAccounts() ([]GitHubInstallationAccount, error)
GitHubInstallationAccountForInstallation(installationID int64) (GitHubInstallationAccount, error)
GitHubInstallationAccountForLogin(accountLogin string) (GitHubInstallationAccount, error)
GetGitHubInstallationOwner(installationID int64) (GitHubInstallationAccount, error)
UpsertGitHubInstallationOwner(installationID int64, owner GitHubInstallationAccount) (GitHubInstallationAccount, error)
GitHubInstallationScopeForAccountLogin(accountLogin string) (int64, bool, error)
AccountScopeForPersonalGitHubInstallation(installationID int64) (int64, bool, error)
UpsertGitHubInstallation(installation GitHubInstallation) (GitHubInstallation, error)
DeleteGitHubInstallation(accountID, id int64) error
}
type IdentityStore ¶
type IdentityStore interface {
GetAccount(accountID int64) (Account, error)
GetAccountByOAuthIdentity(provider, subject string) (Account, OAuthIdentity, error)
GetOAuthIdentityForAccount(accountID int64, provider string) (OAuthIdentity, error)
ListAccounts(options AccountListOptions) ([]AccountListItem, int64, error)
GetAccountStats() (AccountStats, error)
UpdateAccountRoleWithAudit(update AccountRoleUpdate) (Account, error)
EnsureAccountForOAuthIdentity(identity OAuthIdentity, role string) (Account, OAuthIdentity, error)
UpsertAccountForOAuthIdentity(identity OAuthIdentity, role string) (Account, OAuthIdentity, error)
LinkOAuthIdentityToAccount(accountID int64, identity OAuthIdentity) (Account, OAuthIdentity, error)
}
type ManagedProfileConflict ¶ added in v0.2.7
ManagedProfileConflict reports a catalog name already owned by another source.
type OAuthIdentity ¶
type OAuthIdentity struct {
ID int64 `json:"id"`
AccountID int64 `json:"account_id"`
OAuthProvider string `json:"oauth_provider"`
OAuthSubject string `json:"oauth_subject"`
OAuthLogin string `json:"oauth_login"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
OAuthIdentity represents an external OAuth identity linked to an account.
type ProfileMatch ¶
type ProfileMatch struct {
RepositoryFullName string `json:"repository_full_name"`
Labels []string `json:"labels"`
Profile *RunnerProfile `json:"runner_spec,omitempty"`
Reason string `json:"reason,omitempty"`
}
type RepositoryPolicy ¶
type RunnerCatalogStore ¶
type RunnerCatalogStore interface {
ListProfiles() ([]RunnerProfile, error)
GetProfile(name string) (RunnerProfile, error)
UpsertProfile(profile RunnerProfile) (RunnerProfile, error)
ReconcileManagedProfiles(profiles []RunnerProfile) ([]ManagedProfileConflict, error)
DeleteProfile(name string) error
ListRunnerGroups() ([]RunnerGroup, error)
GetRunnerGroup(name string) (RunnerGroup, error)
UpsertRunnerGroup(group RunnerGroup) (RunnerGroup, error)
DeleteRunnerGroup(name string) error
ListRepositoryPolicies() ([]RepositoryPolicy, error)
GetRepositoryPolicy(id int64) (RepositoryPolicy, error)
UpsertRepositoryPolicy(policy RepositoryPolicy) (RepositoryPolicy, error)
DeleteRepositoryPolicy(id int64) error
MatchProfile(repositoryFullName string, labels []string) (ProfileMatch, error)
}
type RunnerGroup ¶
type RunnerProfile ¶
type RunnerProfile struct {
Name string `json:"name"`
Labels []string `json:"labels"`
RequiredLabels []string `json:"required_labels"`
TemplateID string `json:"template_id"`
DefaultTemplateName string `json:"default_template_name,omitempty"`
RunnerGroup string `json:"runner_group,omitempty"`
MaxConcurrency int `json:"max_concurrency"`
MinIdle int `json:"min_idle"`
Priority int `json:"priority"`
Enabled bool `json:"enabled"`
DefaultAvailable bool `json:"default_available"`
ManagedBy string `json:"managed_by,omitempty"`
CatalogRevision int `json:"catalog_revision,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type RunnerRequest ¶
type RunnerRequest struct {
ID string `json:"id"`
Source string `json:"source"`
JobID int64 `json:"job_id,omitempty"`
GitHubInstallationID int64 `json:"github_installation_id,omitempty"`
RepositoryFullName string `json:"repository_full_name,omitempty"`
RequestedLabels []string `json:"requested_labels,omitempty"`
Labels []string `json:"labels"`
ProfileName string `json:"runner_spec_name,omitempty"`
RunnerGroup string `json:"runner_group,omitempty"`
RunnerName string `json:"runner_name"`
SandboxAPIURL string `json:"-"`
SandboxAPIKeyEncrypted string `json:"-"`
SandboxConfigSource string `json:"sandbox_config_source,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type RunnerRequestStore ¶
type RunnerRequestStore interface {
Ensure() error
CreateRequest(req RunnerRequest, payload []byte) (bool, RunnerState, error)
ReadRequest(id string) (RunnerRequest, error)
ReadState(id string) (RunnerState, error)
WriteState(st RunnerState) error
ListStates() ([]RunnerState, error)
ListActiveStates() ([]RunnerState, error)
ListMismatchedCompletedStates(limit int) ([]RunnerState, error)
ListFailedWorkflowJobStates(limit int) ([]RunnerState, error)
ListStatesPage(limit, offset int) ([]RunnerState, int64, error)
ListStatesForRepositories(repositories []string, limit int) ([]RunnerState, error)
ListStatesForGitHubInstallations(installationIDs []int64, limit int) ([]RunnerState, error)
ListStatesForGitHubInstallationRepositories(access []GitHubInstallationRepositoryAccess, limit, offset int) ([]RunnerState, int64, error)
ActiveCount() (int, error)
InFlightCount() (int, error)
ActiveCountForProfile(name string) (int, error)
InFlightCountForProfile(name string) (int, error)
ClaimNextRunnable(workerID string, now time.Time, leaseTTL time.Duration) (RunnerRequest, RunnerState, bool, error)
ReleaseLease(id, workerID string) error
RetryRequest(id string, now time.Time) (RunnerState, error)
AppendLog(id, name string, data []byte)
ReadLog(id, name string, maxBytes int64) ([]byte, error)
}
type RunnerState ¶
type RunnerState struct {
ID string `json:"id"`
Status string `json:"status"`
GitHubInstallationID int64 `json:"github_installation_id,omitempty"`
RepositoryFullName string `json:"repository_full_name,omitempty"`
RequestedLabels []string `json:"requested_labels,omitempty"`
ProfileName string `json:"runner_spec_name,omitempty"`
RunnerGroup string `json:"runner_group,omitempty"`
RunnerName string `json:"runner_name"`
SandboxID string `json:"sandbox_id,omitempty"`
SandboxAPIURL string `json:"-"`
SandboxAPIKeyEncrypted string `json:"-"`
SandboxConfigSource string `json:"sandbox_config_source,omitempty"`
ProcessPID uint32 `json:"process_pid,omitempty"`
WorkflowJobID int64 `json:"workflow_job_id,omitempty"`
WorkflowRunID int64 `json:"workflow_run_id,omitempty"`
WorkflowName string `json:"workflow_name,omitempty"`
WorkflowRunAttempt int64 `json:"workflow_run_attempt,omitempty"`
HeadBranch string `json:"head_branch,omitempty"`
HeadSHA string `json:"head_sha,omitempty"`
GitHubJobURL string `json:"github_job_url,omitempty"`
PullRequestNumber int64 `json:"pull_request_number,omitempty"`
AssignedJobID int64 `json:"assigned_job_id,omitempty"`
AssignedJobName string `json:"assigned_job_name,omitempty"`
Error string `json:"error,omitempty"`
FailureStage string `json:"failure_stage,omitempty"`
FailureReason string `json:"failure_reason,omitempty"`
LastErrorCode string `json:"last_error_code,omitempty"`
LastErrorMessage string `json:"last_error_message,omitempty"`
LastErrorRetryable bool `json:"last_error_retryable,omitempty"`
RetryCount int `json:"retry_count,omitempty"`
UpdatedAt time.Time `json:"updated_at"`
CreatedAt time.Time `json:"created_at"`
LastAttemptAt time.Time `json:"last_attempt_at,omitempty"`
NextRetryAt time.Time `json:"next_retry_at,omitempty"`
CreatingAt time.Time `json:"creating_at,omitempty"`
RunningAt time.Time `json:"running_at,omitempty"`
StoppingAt time.Time `json:"stopping_at,omitempty"`
CompletedAt time.Time `json:"completed_at,omitempty"`
FailedAt time.Time `json:"failed_at,omitempty"`
LeaseOwner string `json:"lease_owner,omitempty"`
LeaseExpiresAt time.Time `json:"lease_expires_at,omitempty"`
Version int64 `json:"version"`
}
type SandboxServiceDefault ¶
type SandboxServiceDefault struct {
ID int64 `json:"id"`
Enabled bool `json:"enabled"`
AudienceMode string `json:"audience_mode"`
APIURL string `json:"api_url"`
APIKeyEncrypted string `json:"-"`
APIKeyUpdatedAt *time.Time `json:"api_key_updated_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SandboxServiceDefaultAudience ¶
type SandboxServiceDefaultAudience struct {
ID int64 `json:"id"`
GitHubAccountID int64 `json:"github_account_id"`
AccountType string `json:"account_type"`
AccountLogin string `json:"account_login"`
AccountName string `json:"account_name,omitempty"`
AccountAvatar string `json:"account_avatar,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SandboxServiceDefaultStore ¶
type SandboxServiceDefaultStore interface {
GetSandboxServiceDefault() (SandboxServiceDefault, error)
UpsertSandboxServiceDefault(defaultConfig SandboxServiceDefault) (SandboxServiceDefault, error)
UpdateSandboxServiceDefaultPreservingAPIKey(defaultConfig SandboxServiceDefault) (SandboxServiceDefault, error)
DeleteSandboxServiceDefaultAPIKey() error
ListSandboxServiceDefaultAudiences() ([]SandboxServiceDefaultAudience, error)
UpsertSandboxServiceDefaultAudience(audience SandboxServiceDefaultAudience) (SandboxServiceDefaultAudience, error)
DeleteSandboxServiceDefaultAudience(id int64) error
SandboxServiceDefaultAudienceContains(githubAccountID int64, accountType string) (bool, error)
}
type Store ¶
type Store interface {
RunnerRequestStore
RunnerCatalogStore
IdentityStore
GitHubInstallationStore
AccountSecretStore
AccountPreferenceStore
SandboxServiceDefaultStore
AuditStore
}