Skip to content

Commit

Permalink
Merge pull request #44 from shopware/fix-hooks
Browse files Browse the repository at this point in the history
fix hooks
  • Loading branch information
TrayserCassa authored Oct 7, 2024
2 parents ec2c855 + 3d36867 commit d560c02
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions api/v1/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ func (s *Store) getWorker() []corev1.EnvVar {
Name: "MESSENGER_TRANSPORT_DSN",
Value: fmt.Sprintf(
"rediss://%s:%d/messages/symfony/consumer?auto_setup=true&serializer=1&stream_max_entries=0&dbindex=%d",
s.Spec.AppCache.RedisHost,
s.Spec.AppCache.RedisPort,
s.Spec.AppCache.RedisIndex,
s.Spec.Worker.RedisHost,
s.Spec.Worker.RedisPort,
s.Spec.Worker.RedisIndex,
),
},
}
Expand Down
14 changes: 7 additions & 7 deletions internal/job/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ func MigrationJob(store *v1.Store) *batchv1.Job {
}
maps.Copy(annotations, store.Spec.Container.Annotations)

var command string
if store.Spec.MigrationHook.Before != "" {
command = fmt.Sprintf("%s && ", store.Spec.MigrationHook.Before)
var command []string
if store.Spec.SetupHook.Before != "" {
command = append(command, store.Spec.MigrationHook.Before)
}
command = fmt.Sprintf("%s /setup", command)
if store.Spec.MigrationHook.After != "" {
command = fmt.Sprintf("%s && %s", command, store.Spec.MigrationHook.After)
command = append(command, " /setup")
if store.Spec.SetupHook.After != "" {
command = append(command, store.Spec.MigrationHook.After)
}

containers := append(store.Spec.Container.ExtraContainers, corev1.Container{
Expand All @@ -67,7 +67,7 @@ func MigrationJob(store *v1.Store) *batchv1.Job {
ImagePullPolicy: store.Spec.Container.ImagePullPolicy,
Image: store.Spec.Container.Image,
Command: []string{"sh", "-c"},
Args: []string{command},
Args: command,
Env: store.GetEnv(),
})

Expand Down
10 changes: 5 additions & 5 deletions internal/job/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ func SetupJob(store *v1.Store) *batchv1.Job {
}
maps.Copy(labels, util.GetDefaultLabels(store))

var command string
var command []string
if store.Spec.SetupHook.Before != "" {
command = fmt.Sprintf("%s && ", store.Spec.SetupHook.Before)
command = append(command, store.Spec.SetupHook.Before)
}
command = fmt.Sprintf("%s /setup", command)
command = append(command, " /setup")
if store.Spec.SetupHook.After != "" {
command = fmt.Sprintf("%s && %s", command, store.Spec.SetupHook.After)
command = append(command, store.Spec.SetupHook.After)
}

envs := append(store.GetEnv(),
Expand All @@ -71,7 +71,7 @@ func SetupJob(store *v1.Store) *batchv1.Job {
ImagePullPolicy: store.Spec.Container.ImagePullPolicy,
Image: store.Spec.Container.Image,
Command: []string{"sh", "-c"},
Args: []string{command},
Args: command,
Env: envs,
})

Expand Down

0 comments on commit d560c02

Please sign in to comment.