MCPcopy Create free account
hub / github.com/cloudbase/garm / listRunnersWithScaleSetAPI

Method listRunnersWithScaleSetAPI

runner/pool/util.go:240–271  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

238}
239
240func (r *basePoolManager) listRunnersWithScaleSetAPI() ([]forgeRunner, error) {
241 if r.scaleSetClient == nil {
242 return nil, fmt.Errorf("scaleset client not initialized")
243 }
244
245 runners, err := r.scaleSetClient.ListAllRunners(r.ctx)
246 if err != nil {
247 return nil, fmt.Errorf("failed to list runners through scaleset API: %w", err)
248 }
249
250 ret := []forgeRunner{}
251 for _, runner := range runners.RunnerReferences {
252 if runner.RunnerScaleSetID != 0 {
253 // skip scale set runners.
254 continue
255 }
256 run := forgeRunner{
257 Name: runner.Name,
258 ID: runner.ID,
259 Status: string(runner.GetStatus()),
260 Labels: make([]RunnerLabels, len(runner.Labels)),
261 }
262 for labelIDX, label := range runner.Labels {
263 run.Labels[labelIDX] = RunnerLabels{
264 Name: label.Name,
265 Type: label.Type,
266 }
267 }
268 ret = append(ret, run)
269 }
270 return ret, nil
271}
272
273func (r *basePoolManager) GetGithubRunners() ([]forgeRunner, error) {
274 // Gitea has no scale sets API

Callers 1

GetGithubRunnersMethod · 0.95

Calls 2

ListAllRunnersMethod · 0.80
GetStatusMethod · 0.80

Tested by

no test coverage detected