mirror of
https://github.com/actions/actions-runner-controller.git
synced 2025-12-11 03:57:01 +00:00
Include extra user-agent for runners created by actions-runner-controller. (#2177)
This commit is contained in:
@@ -6,5 +6,6 @@ const (
|
||||
)
|
||||
|
||||
const (
|
||||
EnvVarRunnerJITConfig = "ACTIONS_RUNNER_INPUT_JITCONFIG"
|
||||
EnvVarRunnerJITConfig = "ACTIONS_RUNNER_INPUT_JITCONFIG"
|
||||
EnvVarRunnerExtraUserAgent = "GITHUB_ACTIONS_RUNNER_EXTRA_USER_AGENT"
|
||||
)
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user