mirror of
https://github.com/actions-runner-controller/actions-runner-controller.git
synced 2026-10-06 09:21:19 +02:00
Re-register the runner scale set when it is gone from the Actions service (#4571)
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user