Remove unused fields (#48)
This commit is contained in:
@@ -415,11 +415,24 @@ func (c *Client) GetRunnerGroupByName(ctx context.Context, runnerGroup string) (
|
||||
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.
|
||||
func (c *Client) CreateRunnerScaleSet(ctx context.Context, runnerScaleSet *RunnerScaleSet) (*RunnerScaleSet, error) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
applyDefaultLabelTypes(runnerScaleSet)
|
||||
|
||||
body, err := json.Marshal(runnerScaleSet)
|
||||
if err != nil {
|
||||
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()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
applyDefaultLabelTypes(runnerScaleSet)
|
||||
|
||||
path := fmt.Sprintf("%s/%d", scaleSetEndpoint, runnerScaleSetID)
|
||||
|
||||
body, err := json.Marshal(runnerScaleSet)
|
||||
|
||||
@@ -80,11 +80,9 @@ func run(ctx context.Context, c Config) error {
|
||||
Labels: []scaleset.Label{
|
||||
{
|
||||
Name: c.ScaleSetName,
|
||||
Type: "System",
|
||||
},
|
||||
},
|
||||
RunnerSetting: scaleset.RunnerSetting{
|
||||
Ephemeral: true,
|
||||
DisableUpdate: true,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -17,11 +17,6 @@ const (
|
||||
MessageTypeJobCompleted MessageType = "JobCompleted"
|
||||
)
|
||||
|
||||
type JobAvailable struct {
|
||||
AcquireJobURL string `json:"acquireJobUrl"`
|
||||
JobMessageBase
|
||||
}
|
||||
|
||||
type JobAssigned struct {
|
||||
JobMessageBase
|
||||
}
|
||||
@@ -134,8 +129,6 @@ type RunnerScaleSetStatistic struct {
|
||||
}
|
||||
|
||||
type RunnerSetting struct {
|
||||
Ephemeral bool `json:"ephemeral,omitempty"`
|
||||
IsElastic bool `json:"isElastic,omitempty"`
|
||||
DisableUpdate bool `json:"disableUpdate,omitempty"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user