From 044c8ad4d5d48e50e76f88340dd45511167ee69d Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Sat, 14 Jan 2023 19:35:56 -0500 Subject: [PATCH] Include actions-runner-controller in runner's User-Agent for better telemetry in Actions service. (#2155) --- .../new_runner_pod_test.go | 24 +++++++++++++++++++ .../runner_controller.go | 5 ++++ 2 files changed, 29 insertions(+) diff --git a/controllers/actions.summerwind.net/new_runner_pod_test.go b/controllers/actions.summerwind.net/new_runner_pod_test.go index 5529ca42..4d3b419d 100644 --- a/controllers/actions.summerwind.net/new_runner_pod_test.go +++ b/controllers/actions.summerwind.net/new_runner_pod_test.go @@ -131,6 +131,10 @@ func TestNewRunnerPod(t *testing.T) { Name: "RUNNER_STATUS_UPDATE_HOOK", Value: "false", }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: "actions-runner-controller/NA", + }, { Name: "DOCKER_HOST", Value: "tcp://localhost:2376", @@ -274,6 +278,10 @@ func TestNewRunnerPod(t *testing.T) { Name: "RUNNER_STATUS_UPDATE_HOOK", Value: "false", }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: "actions-runner-controller/NA", + }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -356,6 +364,10 @@ func TestNewRunnerPod(t *testing.T) { Name: "RUNNER_STATUS_UPDATE_HOOK", Value: "false", }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: "actions-runner-controller/NA", + }, }, VolumeMounts: []corev1.VolumeMount{ { @@ -649,6 +661,10 @@ func TestNewRunnerPodFromRunnerController(t *testing.T) { Name: "RUNNER_STATUS_UPDATE_HOOK", Value: "false", }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: "actions-runner-controller/NA", + }, { Name: "DOCKER_HOST", Value: "tcp://localhost:2376", @@ -807,6 +823,10 @@ func TestNewRunnerPodFromRunnerController(t *testing.T) { Name: "RUNNER_STATUS_UPDATE_HOOK", Value: "false", }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: "actions-runner-controller/NA", + }, { Name: "RUNNER_NAME", Value: "runner", @@ -908,6 +928,10 @@ func TestNewRunnerPodFromRunnerController(t *testing.T) { Name: "RUNNER_STATUS_UPDATE_HOOK", Value: "false", }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: "actions-runner-controller/NA", + }, { Name: "RUNNER_NAME", Value: "runner", diff --git a/controllers/actions.summerwind.net/runner_controller.go b/controllers/actions.summerwind.net/runner_controller.go index 6c074978..c208d1a2 100644 --- a/controllers/actions.summerwind.net/runner_controller.go +++ b/controllers/actions.summerwind.net/runner_controller.go @@ -25,6 +25,7 @@ import ( "strings" "time" + "github.com/actions/actions-runner-controller/build" "github.com/actions/actions-runner-controller/hash" "github.com/go-logr/logr" @@ -835,6 +836,10 @@ func newRunnerPodWithContainerMode(containerMode string, template corev1.Pod, ru Name: "RUNNER_STATUS_UPDATE_HOOK", Value: fmt.Sprintf("%v", useRunnerStatusUpdateHook), }, + { + Name: "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT", + Value: fmt.Sprintf("actions-runner-controller/%s", build.Version), + }, } var seLinuxOptions *corev1.SELinuxOptions