Author SHA1 Message Date
Francesco Renzi 6fcfe31040 log connection 2026-02-02 10:44:31 +01:00
Francesco Renzi bc6c5ed3e8 do not delete 2026-01-31 12:37:25 +01:00
Francesco Renzi c250298318 gging 2026-01-31 12:35:56 +01:00
Francesco Renzi 14887afcce no labels 2026-01-31 12:32:30 +01:00
3 changed files with 25 additions and 17 deletions
+3 -3
View File
@@ -1,10 +1,10 @@
# GitHub Actions Runner Scale Set Client (Public Preview)
# GitHub Actions Runner Scale Set Client (Private Preview)
> Status: **Public Preview** – While the API is stable, interfaces and examples in this repository may change.
> Status: **Private Preview** – While the API is stable, interfaces and examples in this repository may change.
This repository provides a standalone Go client for the GitHub Actions **Runner Scale Set** APIs. It is extracted from the `actions-runner-controller` project so that platform teams, integrators, and infrastructure providers can build **their own custom autoscaling solutions** for GitHub Actions runners.
You don't need to adopt the full controller or Kubernetes to take advantage of scale sets. The client supports the same platforms as the GitHub Actions runner, including containers and virtual machines running Windows, Linux, and macOS. This package contains all the primitives you need: create, update, and delete scale sets; generate just-in-time (JIT) runner configs; and manage message sessions.
You do *not* need to adopt the full controller (and Kubernetes) to take advantage of scale sets. This package contains all the primitives you need: create/update/delete scale sets, generate just‑in‑time (JIT) runner configs, and manage message sessions.
---
+3
View File
@@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"io"
"log/slog"
"maps"
"net/http"
"net/url"
@@ -835,6 +836,8 @@ func (c *Client) getActionsServiceAdminConnection(ctx context.Context, rt *regis
return nil, fmt.Errorf("failed to get actions service admin connection: %w", err)
}
slog.Info("got admin connection", *adminConnection.ActionsServiceURL)
return adminConnection, nil
}
+19 -14
View File
@@ -74,35 +74,40 @@ func run(ctx context.Context, c Config) error {
runnerGroupID = runnerGroup.ID
}
slog.Info("creating scale set")
// Create the runner scale set
scaleSet, err := scalesetClient.CreateRunnerScaleSet(ctx, &scaleset.RunnerScaleSet{
Name: c.ScaleSetName,
RunnerGroupID: runnerGroupID,
Labels: c.BuildLabels(),
Labels: []scaleset.Label{},
RunnerSetting: scaleset.RunnerSetting{
DisableUpdate: true,
},
})
if err != nil {
slog.Error("failed to create", err)
return fmt.Errorf("failed to create runner scale set: %w", err)
}
slog.Info("created")
// Set the user agent for the scaleset client now that we have the scale set ID
scalesetClient.SetSystemInfo(systemInfo(scaleSet.ID))
defer func() {
logger.Info(
"Deleting runner scale set",
slog.Int("scaleSetID", scaleSet.ID),
)
if err := scalesetClient.DeleteRunnerScaleSet(context.WithoutCancel(ctx), scaleSet.ID); err != nil {
slog.Error(
"Failed to delete runner scale set",
slog.Int("scaleSetID", scaleSet.ID),
slog.String("error", err.Error()),
)
}
}()
// defer func() {
// logger.Info(
// "Deleting runner scale set",
// slog.Int("scaleSetID", scaleSet.ID),
// )
// if err := scalesetClient.DeleteRunnerScaleSet(context.WithoutCancel(ctx), scaleSet.ID); err != nil {
// slog.Error(
// "Failed to delete runner scale set",
// slog.Int("scaleSetID", scaleSet.ID),
// slog.String("error", err.Error()),
// )
// }
// }()
dockerClient, err := dockerclient.NewClientWithOpts(dockerclient.FromEnv, dockerclient.WithAPIVersionNegotiation())
if err != nil {