Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
17 changes: 11 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}
Expand Down Expand Up @@ -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,
Expand Down
5 changes: 3 additions & 2 deletions pkg/env/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading