Skip to content

Commit

Permalink
fix: run setup job with correct command
Browse files Browse the repository at this point in the history
  • Loading branch information
tombojer committed Oct 9, 2024
1 parent 7218ee7 commit c727587
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions internal/job/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand All @@ -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,
})

Expand Down

0 comments on commit c727587

Please sign in to comment.