Add agent mode
This change adds a new "agent mode" to GARM. The agent enables GARM to set up a persistent websocket connection between the garm server and the runners it spawns. The goal is to be able to easier keep track of state, even without subsequent webhooks from the forge. The Agent will report via websockets when the runner is actually online, when it started a job and when it finished a job. Additionally, the agent allows us to enable optional remote shell between the user and any runner that is spun up using agent mode. The remote shell is multiplexed over the same persistent websocket connection the agent sets up with the server (the agent never listens on a port). Enablement has also been done in the web UI for this functionality. Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
parent
3b132e4233
commit
42cfd1b3c6
246 changed files with 11042 additions and 672 deletions
|
|
@ -51,9 +51,20 @@ type ControllerInfo struct {
|
|||
|
||||
ControllerID uuid.UUID
|
||||
|
||||
CallbackURL string
|
||||
MetadataURL string
|
||||
// CallbackURL is the URL where userdata scripts call back into, to send status updates
|
||||
// and installation progress.
|
||||
CallbackURL string
|
||||
// MetadataURL is the base URL from which runners can get their installation metadata.
|
||||
MetadataURL string
|
||||
// WebhookBaseURL is the base URL used to construct the controller webhook URL.
|
||||
WebhookBaseURL string
|
||||
// AgentURL is the websocket enabled URL whenre garm agents connect to.
|
||||
AgentURL string
|
||||
// GARMAgentReleasesURL is the URL from which GARM can sync garm-agent binaries. Alternatively
|
||||
// the user can manually upload binaries.
|
||||
GARMAgentReleasesURL string
|
||||
// SyncGARMAgentTools enables or disables automatic sync of garm-agent tools.
|
||||
SyncGARMAgentTools bool
|
||||
// MinimumJobAgeBackoff is the minimum time that a job must be in the queue
|
||||
// before GARM will attempt to allocate a runner to service it. This backoff
|
||||
// is useful if you have idle runners in various pools that could potentially
|
||||
|
|
@ -104,6 +115,7 @@ type Pool struct {
|
|||
// any kind of data needed by providers.
|
||||
ExtraSpecs datatypes.JSON
|
||||
GitHubRunnerGroup string
|
||||
EnableShell bool
|
||||
|
||||
RepoID *uuid.UUID `gorm:"index"`
|
||||
Repository Repository `gorm:"foreignKey:RepoID;"`
|
||||
|
|
@ -159,7 +171,8 @@ type ScaleSet struct {
|
|||
// ExtraSpecs is an opaque json that gets sent to the provider
|
||||
// as part of the bootstrap params for instances. It can contain
|
||||
// any kind of data needed by providers.
|
||||
ExtraSpecs datatypes.JSON
|
||||
ExtraSpecs datatypes.JSON
|
||||
EnableShell bool
|
||||
|
||||
RepoID *uuid.UUID `gorm:"index"`
|
||||
Repository Repository `gorm:"foreignKey:RepoID;"`
|
||||
|
|
@ -203,6 +216,7 @@ type Repository struct {
|
|||
ScaleSets []ScaleSet `gorm:"foreignKey:RepoID"`
|
||||
Jobs []WorkflowJob `gorm:"foreignKey:RepoID;constraint:OnDelete:SET NULL"`
|
||||
PoolBalancerType params.PoolBalancerType `gorm:"type:varchar(64)"`
|
||||
AgentMode bool `gorm:"index:repo_agent_idx"`
|
||||
|
||||
EndpointName *string `gorm:"index:idx_owner_nocase,unique,collate:nocase"`
|
||||
Endpoint GithubEndpoint `gorm:"foreignKey:EndpointName;constraint:OnDelete:SET NULL"`
|
||||
|
|
@ -235,6 +249,7 @@ type Organization struct {
|
|||
ScaleSet []ScaleSet `gorm:"foreignKey:OrgID"`
|
||||
Jobs []WorkflowJob `gorm:"foreignKey:OrgID;constraint:OnDelete:SET NULL"`
|
||||
PoolBalancerType params.PoolBalancerType `gorm:"type:varchar(64)"`
|
||||
AgentMode bool `gorm:"index:org_agent_idx"`
|
||||
|
||||
EndpointName *string `gorm:"index:idx_org_name_nocase,collate:nocase"`
|
||||
Endpoint GithubEndpoint `gorm:"foreignKey:EndpointName;constraint:OnDelete:SET NULL"`
|
||||
|
|
@ -265,6 +280,7 @@ type Enterprise struct {
|
|||
ScaleSet []ScaleSet `gorm:"foreignKey:EnterpriseID"`
|
||||
Jobs []WorkflowJob `gorm:"foreignKey:EnterpriseID;constraint:OnDelete:SET NULL"`
|
||||
PoolBalancerType params.PoolBalancerType `gorm:"type:varchar(64)"`
|
||||
AgentMode bool `gorm:"index:enterprise_agent_idx"`
|
||||
|
||||
EndpointName *string `gorm:"index:idx_ent_name_nocase,collate:nocase"`
|
||||
Endpoint GithubEndpoint `gorm:"foreignKey:EndpointName;constraint:OnDelete:SET NULL"`
|
||||
|
|
@ -306,6 +322,7 @@ type Instance struct {
|
|||
Addresses []Address `gorm:"foreignKey:InstanceID;constraint:OnDelete:CASCADE,OnUpdate:CASCADE;"`
|
||||
Status commonParams.InstanceStatus
|
||||
RunnerStatus params.RunnerStatus
|
||||
Heartbeat time.Time
|
||||
CallbackURL string
|
||||
MetadataURL string
|
||||
ProviderFault []byte `gorm:"type:longblob"`
|
||||
|
|
@ -314,6 +331,7 @@ type Instance struct {
|
|||
JitConfiguration []byte `gorm:"type:longblob"`
|
||||
GitHubRunnerGroup string
|
||||
AditionalLabels datatypes.JSON
|
||||
Capabilities datatypes.JSON
|
||||
|
||||
PoolID *uuid.UUID
|
||||
Pool Pool `gorm:"foreignKey:PoolID"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue