From f318bcbae3437099dbb98c1edac29bfa90703105 Mon Sep 17 00:00:00 2001 From: Lars Fronius Date: Tue, 5 Nov 2024 12:47:30 +0100 Subject: [PATCH] fix: allow volume mounts in junit checks --- Makefile | 4 ++-- checks/junit.go | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 16232e66d..e473e1d21 100644 --- a/Makefile +++ b/Makefile @@ -234,8 +234,8 @@ ginkgo: CONTROLLER_GEN=$(GOBIN)/controller-gen .bin/yq: .bin - curl -sSLo $(YQ) https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_$(OS)_$(ARCH) && \ - chmod +x $(YQ) + curl -sSLo .bin/yq https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_$(OS)_$(ARCH) && \ + chmod +x .bin/yq .bin/go-junit-report: .bin diff --git a/checks/junit.go b/checks/junit.go index 89095ccc9..e9ed00b7c 100644 --- a/checks/junit.go +++ b/checks/junit.go @@ -105,16 +105,15 @@ func newPod(ctx *context.Context, check v1.JunitCheck) (*corev1.Pod, error) { `, mountPath, mountPath), }, }} - pod.Spec.Volumes = []corev1.Volume{ - { - Name: volumeName, - VolumeSource: corev1.VolumeSource{ - EmptyDir: &corev1.EmptyDirVolumeSource{}, - }, + pod.Spec.Volumes = append(pod.Spec.Volumes, corev1.Volume{ + Name: volumeName, + VolumeSource: corev1.VolumeSource{ + EmptyDir: &corev1.EmptyDirVolumeSource{}, }, - } + }) pod.Spec.RestartPolicy = corev1.RestartPolicyNever - pod.Spec.InitContainers[0].VolumeMounts = []corev1.VolumeMount{{Name: volumeName, MountPath: filepath.Dir(check.TestResults)}} + // + pod.Spec.InitContainers[0].VolumeMounts = append(pod.Spec.InitContainers[0].VolumeMounts, corev1.VolumeMount{Name: volumeName, MountPath: filepath.Dir(check.TestResults)}) pod.Spec.Containers[0].VolumeMounts = []corev1.VolumeMount{{Name: volumeName, MountPath: mountPath}} return pod, nil }