Skip to content

Commit

Permalink
Merge pull request #48 from shopware/fix-setup-job
Browse files Browse the repository at this point in the history
fix: run setup job with correct command
  • Loading branch information
tombojer authored Oct 9, 2024
2 parents 7218ee7 + c727587 commit 64bcab6
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 64bcab6

Please sign in to comment.