From 54c523d5dddbcacc753da218e18f9672770a7e9e Mon Sep 17 00:00:00 2001 From: Robert Elwell Date: Tue, 21 Oct 2025 16:08:46 -0400 Subject: [PATCH] fix runner group support --- README.md | 2 +- main.go | 17 +++++++++++------ pkg/env/env.go | 5 +++-- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index e78eb21..11d9136 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,7 @@ The Orka GitHub runner requires the following environment variabales to be confi * `ORKA_VM_METADATA`: Specifies custom VM metadata passed to the VM. Must be formatted as key=value comma separated pairs. * `ORKA_ENABLE_NODE_IP_MAPPING`: Specifies whether to enable the mapping of Orka node IPs to external IPs. * `ORKA_NODE_IP_MAPPING`: Defines the mapping of Orka node internal IPs to external host IPs. -* `RUNNERS`: A JSON array containing configuration details of the GitHub runner scale set that will be created. Currently only one runner is supported. See [here](#how-to-use-multiple-runners) for how to use multiple runners. Example usage: `RUNNERS='[{"name":"my-github-runner", "id": 1}]'`. The `name` field should match the value specified in the `runs-on` field in the Actions workflow. The `id` field should be used to differentiate runners with GitHub. We default to `1` if it is not defined. See an example [here](./examples/ci.yml). +* `RUNNERS`: A JSON array containing configuration details of the GitHub runner scale set that will be created. Currently only one runner is supported. See [here](#how-to-use-multiple-runners) for how to use multiple runners. Example usage: `RUNNERS='[{"name":"my-github-runner", "groupId": 1, "groupName": "my-group"}]'`. The `name` field should match the value specified in the `runs-on` field in the Actions workflow. The `group-id` field should be used to differentiate runner groups with GitHub. We default to `1` if it is not defined. See an example [here](./examples/ci.yml). * `LOG_LEVEL`: The logging level for the Orka GitHub Runner (e.g., debug, info, error). If not provided, it defaults to info. For a complete example of the required format, refer to the `.env` file located in the examples directory [here](./examples/.env). diff --git a/main.go b/main.go index d56de74..41dc93e 100644 --- a/main.go +++ b/main.go @@ -37,9 +37,13 @@ func main() { } runnerName := envData.Runners[0].Name - groupId := constants.DefaultRunnerGroupID - if envData.Runners[0].Id != 0 { - groupId = envData.Runners[0].Id + runnerGroupName := envData.Runners[0].GroupName + if runnerGroupName == "" { + runnerGroupName = "Orka Runner Group" + } + runnerGroupId := constants.DefaultRunnerGroupID + if envData.Runners[0].GroupId != 0 { + runnerGroupId = envData.Runners[0].GroupId } if len(validation.IsValidLabelValue(runnerName)) > 0 || len(validation.IsDNS1035Label(runnerName)) > 0 { @@ -51,7 +55,7 @@ func main() { panic(err) } - runnerScaleSet, err := actionsClient.GetRunnerScaleSet(ctx, groupId, runnerName) + runnerScaleSet, err := actionsClient.GetRunnerScaleSet(ctx, runnerGroupId, runnerName) if err != nil { panic(err) } @@ -82,8 +86,9 @@ func main() { }() runnerScaleSet, err = actionsClient.CreateRunnerScaleSet(ctx, &types.RunnerScaleSet{ - Name: runnerName, - RunnerGroupId: groupId, + Name: runnerName, + RunnerGroupName: runnerGroupName, + RunnerGroupId: runnerGroupId, Labels: []types.RunnerScaleSetLabel{ { Name: runnerName, diff --git a/pkg/env/env.go b/pkg/env/env.go index 786ac64..1ccbdd8 100644 --- a/pkg/env/env.go +++ b/pkg/env/env.go @@ -18,8 +18,9 @@ import ( ) type Runner struct { - Name string - Id int + Name string // name of the runner + GroupId int // Group ID + GroupName string // Group Name of the runner } type Data struct {