Add token endpoint

This change adds a github registration endpoint that instances can use
to fetch a github registration token.

This change also invalidates disables access to an instance to the token
and status updates endpoints once the instance transitions from
"pending" or "installing" to any other state.
This commit is contained in:
Gabriel Adrian Samfira 2022-12-01 18:00:22 +02:00
parent eba42b0481
commit a078645ab2
No known key found for this signature in database
GPG key ID: 7D073DCC2C074CB5
18 changed files with 252 additions and 77 deletions

View file

@ -127,19 +127,20 @@ type InstanceStatusUpdate struct {
type Instance struct {
Base
ProviderID *string `gorm:"uniqueIndex"`
Name string `gorm:"uniqueIndex"`
AgentID int64
OSType config.OSType
OSArch config.OSArch
OSName string
OSVersion string
Addresses []Address `gorm:"foreignKey:InstanceID"`
Status common.InstanceStatus
RunnerStatus common.RunnerStatus
CallbackURL string
ProviderFault []byte `gorm:"type:longblob"`
CreateAttempt int
ProviderID *string `gorm:"uniqueIndex"`
Name string `gorm:"uniqueIndex"`
AgentID int64
OSType config.OSType
OSArch config.OSArch
OSName string
OSVersion string
Addresses []Address `gorm:"foreignKey:InstanceID"`
Status common.InstanceStatus
RunnerStatus common.RunnerStatus
CallbackURL string
ProviderFault []byte `gorm:"type:longblob"`
CreateAttempt int
GithubRegistrationToken []byte `gorm:"type:longblob"`
PoolID uuid.UUID
Pool Pool `gorm:"foreignKey:PoolID"`