fix(hermes): replace remaining /cache literals with cachePath constant

The prior commit introduced the cachePath constant but never updated its
call sites. Replace the two VolumeMount MountPath literals and the
RESTIC_CACHE_DIR env value with cachePath to finish deduplicating the
Sonar-flagged repeated string literal.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Hermes Execution Worker 2026-09-13 22:08:03 +00:00
parent 51133b559a
commit f21833e787

View File

@ -44,7 +44,7 @@ func buildBackupJob(cfg *config.Config, req api.BackupRequest, jobName, secretNa
Resources: jobResources(cfg), Resources: jobResources(cfg),
VolumeMounts: []corev1.VolumeMount{ VolumeMounts: []corev1.VolumeMount{
{Name: "data", MountPath: "/data", ReadOnly: true}, {Name: "data", MountPath: "/data", ReadOnly: true},
{Name: "cache", MountPath: "/cache"}, {Name: "cache", MountPath: cachePath},
}, },
}, },
}, },
@ -117,7 +117,7 @@ func buildRestoreJob(cfg *config.Config, req api.RestoreTestRequest, jobName, se
Resources: jobResources(cfg), Resources: jobResources(cfg),
VolumeMounts: []corev1.VolumeMount{ VolumeMounts: []corev1.VolumeMount{
{Name: "restore", MountPath: "/restore"}, {Name: "restore", MountPath: "/restore"},
{Name: "cache", MountPath: "/cache"}, {Name: "cache", MountPath: cachePath},
}, },
}, },
}, },
@ -260,7 +260,7 @@ func resticEnv(cfg *config.Config, secretName, repository string) []corev1.EnvVa
} }
env := []corev1.EnvVar{ env := []corev1.EnvVar{
{Name: "RESTIC_REPOSITORY", Value: repository}, {Name: "RESTIC_REPOSITORY", Value: repository},
{Name: "RESTIC_CACHE_DIR", Value: "/cache"}, {Name: "RESTIC_CACHE_DIR", Value: cachePath},
{ {
Name: "AWS_ACCESS_KEY_ID", Name: "AWS_ACCESS_KEY_ID",
ValueFrom: &corev1.EnvVarSource{SecretKeyRef: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: secretName}, Key: "AWS_ACCESS_KEY_ID"}}, ValueFrom: &corev1.EnvVarSource{SecretKeyRef: &corev1.SecretKeySelector{LocalObjectReference: corev1.LocalObjectReference{Name: secretName}, Key: "AWS_ACCESS_KEY_ID"}},