Re-register the runner scale set when it is gone from the Actions service (#4571)

This commit is contained in:
Diogo Torres
2026-09-03 08:16:06 +01:00
committed by GitHub
parent 438440e92a
commit 3cfdcf59fe
5 changed files with 322 additions and 13 deletions
@@ -26,6 +26,13 @@ func WithGetRunnerScaleSetByID(result *scaleset.RunnerScaleSet, err error) Clien
}
}
// WithGetRunnerScaleSetByIDFunc configures a function to handle GetRunnerScaleSetByID calls dynamically
func WithGetRunnerScaleSetByIDFunc(fn func(context.Context, int) (*scaleset.RunnerScaleSet, error)) ClientOption {
return func(c *Client) {
c.getRunnerScaleSetByIDFunc = fn
}
}
// WithGetRunnerGroupByName configures the result of GetRunnerGroupByName
func WithGetRunnerGroupByName(result *scaleset.RunnerGroup, err error) ClientOption {
return func(c *Client) {
@@ -135,6 +142,7 @@ type Client struct {
err error
}
getRunnerGroupByNameFunc func(context.Context, string) (*scaleset.RunnerGroup, error)
getRunnerScaleSetByIDFunc func(context.Context, int) (*scaleset.RunnerScaleSet, error)
createRunnerScaleSetResult struct {
*scaleset.RunnerScaleSet
err error
@@ -219,6 +227,9 @@ func (c *Client) GetRunnerScaleSet(ctx context.Context, runnerGroupID int, runne
}
func (c *Client) GetRunnerScaleSetByID(ctx context.Context, runnerScaleSetID int) (*scaleset.RunnerScaleSet, error) {
if c.getRunnerScaleSetByIDFunc != nil {
return c.getRunnerScaleSetByIDFunc(ctx, runnerScaleSetID)
}
return c.getRunnerScaleSetByIDResult.RunnerScaleSet, c.getRunnerScaleSetByIDResult.err
}