Scale sets are unique within a runner group

You can have multiple scale sets with the same name, as long as
they live in different runner groups.

Signed-off-by: Gabriel Adrian Samfira <gsamfira@cloudbasesolutions.com>
This commit is contained in:
Gabriel Adrian Samfira 2025-05-03 22:49:15 +00:00
parent 77895d9c89
commit 3b3095c546

View file

@ -98,9 +98,10 @@ type ScaleSet struct {
// the scale set was ceated in GARM but has not yet been created in GitHub.
// The scale set ID is also not globally unique. It is only unique within the context
// of an entity.
ScaleSetID int `gorm:"index:idx_scale_set"`
Name string `gorm:"index:idx_name"`
DisableUpdate bool
ScaleSetID int `gorm:"index:idx_scale_set"`
Name string `gorm:"unique_index:idx_name"`
GitHubRunnerGroup string `gorm:"unique_index:idx_name"`
DisableUpdate bool
// State stores the provisioning state of the scale set in GitHub
State params.ScaleSetState
@ -123,8 +124,7 @@ 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
GitHubRunnerGroup string
ExtraSpecs datatypes.JSON
RepoID *uuid.UUID `gorm:"index"`
Repository Repository `gorm:"foreignKey:RepoID;"`