Deregister runners from the Actions service in the background (#4664)

This commit is contained in:
Nikola Jokic
2026-09-17 17:11:59 +02:00
committed by GitHub
parent dc12c2d417
commit 78dacc7a53
8 changed files with 2074 additions and 61 deletions
@@ -78,6 +78,13 @@ func WithRemoveRunner(err error) ClientOption {
}
}
// WithRemoveRunnerFunc configures a function to handle RemoveRunner calls dynamically
func WithRemoveRunnerFunc(fn func(context.Context, int64) error) ClientOption {
return func(c *Client) {
c.removeRunnerFunc = fn
}
}
// WithGenerateJitRunnerConfig configures the result of GenerateJitRunnerConfig
func WithGenerateJitRunnerConfig(result *scaleset.RunnerScaleSetJitRunnerConfig, err error) ClientOption {
return func(c *Client) {
@@ -128,6 +135,7 @@ type Client struct {
systemInfo scaleset.SystemInfo
createRunnerScaleSetFunc func(context.Context, *scaleset.RunnerScaleSet) (*scaleset.RunnerScaleSet, error)
updateRunnerScaleSetFunc func(context.Context, int, *scaleset.RunnerScaleSet) (*scaleset.RunnerScaleSet, error)
removeRunnerFunc func(context.Context, int64) error
getRunnerScaleSetResult struct {
*scaleset.RunnerScaleSet
@@ -212,6 +220,9 @@ func (c *Client) GetRunnerByName(ctx context.Context, runnerName string) (*scale
}
func (c *Client) RemoveRunner(ctx context.Context, runnerID int64) error {
if c.removeRunnerFunc != nil {
return c.removeRunnerFunc(ctx, runnerID)
}
return c.removeRunnerResult.err
}