diff --git a/cmd/githubrunnerscalesetlistener/main.go b/cmd/githubrunnerscalesetlistener/main.go index 583ae268..2c9d71b2 100644 --- a/cmd/githubrunnerscalesetlistener/main.go +++ b/cmd/githubrunnerscalesetlistener/main.go @@ -23,6 +23,7 @@ import ( "os/signal" "syscall" + "github.com/actions/actions-runner-controller/build" "github.com/actions/actions-runner-controller/github/actions" "github.com/actions/actions-runner-controller/logging" "github.com/go-logr/logr" @@ -83,7 +84,7 @@ func run(rc RunnerScaleSetListenerConfig, logger logr.Logger) error { } } - actionsServiceClient, err := actions.NewClient(ctx, rc.ConfigureUrl, creds, "actions-runner-controller", logger) + actionsServiceClient, err := actions.NewClient(ctx, rc.ConfigureUrl, creds, fmt.Sprintf("actions-runner-controller/%s", build.Version), logger) if err != nil { return fmt.Errorf("failed to create an Actions Service client: %w", err) } diff --git a/controllers/actions.github.com/constants.go b/controllers/actions.github.com/constants.go index 0ff80d53..70f39628 100644 --- a/controllers/actions.github.com/constants.go +++ b/controllers/actions.github.com/constants.go @@ -6,5 +6,6 @@ const ( ) const ( - EnvVarRunnerJITConfig = "ACTIONS_RUNNER_INPUT_JITCONFIG" + EnvVarRunnerJITConfig = "ACTIONS_RUNNER_INPUT_JITCONFIG" + EnvVarRunnerExtraUserAgent = "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT" ) diff --git a/controllers/actions.github.com/resourcebuilder.go b/controllers/actions.github.com/resourcebuilder.go index 45df0b4c..f6aa1a47 100644 --- a/controllers/actions.github.com/resourcebuilder.go +++ b/controllers/actions.github.com/resourcebuilder.go @@ -7,6 +7,7 @@ import ( "strconv" "github.com/actions/actions-runner-controller/apis/actions.github.com/v1alpha1" + "github.com/actions/actions-runner-controller/build" "github.com/actions/actions-runner-controller/hash" corev1 "k8s.io/api/core/v1" rbacv1 "k8s.io/api/rbac/v1" @@ -357,17 +358,23 @@ func (b *resourceBuilder) newEphemeralRunnerPod(ctx context.Context, runner *v1a for _, c := range runner.Spec.PodTemplateSpec.Spec.Containers { if c.Name == EphemeralRunnerContainerName { - c.Env = append(c.Env, corev1.EnvVar{ - Name: EnvVarRunnerJITConfig, - ValueFrom: &corev1.EnvVarSource{ - SecretKeyRef: &corev1.SecretKeySelector{ - LocalObjectReference: corev1.LocalObjectReference{ - Name: secret.Name, + c.Env = append( + c.Env, + corev1.EnvVar{ + Name: EnvVarRunnerJITConfig, + ValueFrom: &corev1.EnvVarSource{ + SecretKeyRef: &corev1.SecretKeySelector{ + LocalObjectReference: corev1.LocalObjectReference{ + Name: secret.Name, + }, + Key: jitTokenKey, }, - Key: jitTokenKey, }, }, - }) + corev1.EnvVar{ + Name: EnvVarRunnerExtraUserAgent, + Value: fmt.Sprintf("actions-runner-controller/%s", build.Version), + }) } newPod.Spec.Containers = append(newPod.Spec.Containers, c)