Remove unused fields (#48)

This commit is contained in:
Francesco Renzi
2026-01-13 17:19:16 +00:00
committed by GitHub
parent 1208e1216e
commit 0015641f99
3 changed files with 15 additions and 9 deletions
+15
View File
@@ -415,11 +415,24 @@ func (c *Client) GetRunnerGroupByName(ctx context.Context, runnerGroup string) (
return &runnerGroupList.RunnerGroups[0], nil return &runnerGroupList.RunnerGroups[0], nil
} }
// applyDefaultLabelTypes ensures that each label in the runner scale set has a Type set,
// defaulting to "System" when the field is empty. This encapsulates the legacy API detail
// so that callers do not need to manage label types explicitly.
func applyDefaultLabelTypes(runnerScaleSet *RunnerScaleSet) {
for i := range runnerScaleSet.Labels {
if runnerScaleSet.Labels[i].Type == "" {
runnerScaleSet.Labels[i].Type = "System"
}
}
}
// CreateRunnerScaleSet creates a new runner scale set. Note that runner scale set names must be unique within a runner group. // CreateRunnerScaleSet creates a new runner scale set. Note that runner scale set names must be unique within a runner group.
func (c *Client) CreateRunnerScaleSet(ctx context.Context, runnerScaleSet *RunnerScaleSet) (*RunnerScaleSet, error) { func (c *Client) CreateRunnerScaleSet(ctx context.Context, runnerScaleSet *RunnerScaleSet) (*RunnerScaleSet, error) {
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
applyDefaultLabelTypes(runnerScaleSet)
body, err := json.Marshal(runnerScaleSet) body, err := json.Marshal(runnerScaleSet)
if err != nil { if err != nil {
return nil, fmt.Errorf("failed to marshal runner scale set: %w", err) return nil, fmt.Errorf("failed to marshal runner scale set: %w", err)
@@ -454,6 +467,8 @@ func (c *Client) UpdateRunnerScaleSet(ctx context.Context, runnerScaleSetID int,
c.mu.Lock() c.mu.Lock()
defer c.mu.Unlock() defer c.mu.Unlock()
applyDefaultLabelTypes(runnerScaleSet)
path := fmt.Sprintf("%s/%d", scaleSetEndpoint, runnerScaleSetID) path := fmt.Sprintf("%s/%d", scaleSetEndpoint, runnerScaleSetID)
body, err := json.Marshal(runnerScaleSet) body, err := json.Marshal(runnerScaleSet)
-2
View File
@@ -80,11 +80,9 @@ func run(ctx context.Context, c Config) error {
Labels: []scaleset.Label{ Labels: []scaleset.Label{
{ {
Name: c.ScaleSetName, Name: c.ScaleSetName,
Type: "System",
}, },
}, },
RunnerSetting: scaleset.RunnerSetting{ RunnerSetting: scaleset.RunnerSetting{
Ephemeral: true,
DisableUpdate: true, DisableUpdate: true,
}, },
}) })
-7
View File
@@ -17,11 +17,6 @@ const (
MessageTypeJobCompleted MessageType = "JobCompleted" MessageTypeJobCompleted MessageType = "JobCompleted"
) )
type JobAvailable struct {
AcquireJobURL string `json:"acquireJobUrl"`
JobMessageBase
}
type JobAssigned struct { type JobAssigned struct {
JobMessageBase JobMessageBase
} }
@@ -134,8 +129,6 @@ type RunnerScaleSetStatistic struct {
} }
type RunnerSetting struct { type RunnerSetting struct {
Ephemeral bool `json:"ephemeral,omitempty"`
IsElastic bool `json:"isElastic,omitempty"`
DisableUpdate bool `json:"disableUpdate,omitempty"` DisableUpdate bool `json:"disableUpdate,omitempty"`
} }