From c727587771911a12bcbbe0761ffff9fa793f40fc Mon Sep 17 00:00:00 2001 From: tombojer Date: Wed, 9 Oct 2024 15:04:34 +0200 Subject: [PATCH] fix: run setup job with correct command --- internal/job/setup.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/job/setup.go b/internal/job/setup.go index 1900027..4adbf91 100644 --- a/internal/job/setup.go +++ b/internal/job/setup.go @@ -39,13 +39,13 @@ func SetupJob(store *v1.Store) *batchv1.Job { } maps.Copy(labels, util.GetDefaultLabels(store)) - var stringCommand string + var command []string if store.Spec.SetupHook.Before != "" { - stringCommand = fmt.Sprintf("%s %s", stringCommand, store.Spec.SetupHook.Before) + command = append(command, store.Spec.SetupHook.Before) } - stringCommand = fmt.Sprintf("%s sleep 5", stringCommand) + command = append(command, "/setup") if store.Spec.SetupHook.After != "" { - stringCommand = fmt.Sprintf("%s %s", stringCommand, store.Spec.SetupHook.After) + command = append(command, store.Spec.SetupHook.After) } envs := append(store.GetEnv(), @@ -71,8 +71,8 @@ func SetupJob(store *v1.Store) *batchv1.Job { VolumeMounts: store.Spec.Container.VolumeMounts, ImagePullPolicy: store.Spec.Container.ImagePullPolicy, Image: store.Spec.Container.Image, - Command: []string{"sh"}, - Args: []string{"-c", stringCommand}, + Command: []string{"sh", "-c"}, + Args: command, Env: envs, })