Skip to content

Commit

Permalink
deploy scheduled job with entrypoint and command overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
Lou1415926 committed Mar 2, 2021
1 parent 7ba131a commit 013104b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 25 deletions.
50 changes: 25 additions & 25 deletions internal/pkg/deploy/cloudformation/stack/backend_svc.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,36 +67,36 @@ func NewBackendService(mft *manifest.BackendService, env, app string, rc Runtime

// Template returns the CloudFormation template for the backend service.
func (s *BackendService) Template() (string, error) {
//desiredCountLambda, err := s.parser.Read(desiredCountGeneratorPath)
//if err != nil {
// return "", fmt.Errorf("read desired count lambda: %w", err)
//}
//outputs, err := s.addonsOutputs()
//if err != nil {
// return "", err
//}
//sidecars, err := convertSidecar(s.manifest.Sidecars)
//if err != nil {
// return "", fmt.Errorf("convert the sidecar configuration for service %s: %w", s.name, err)
//}
//autoscaling, err := convertAutoscaling(&s.manifest.Count.Autoscaling)
//if err != nil {
// return "", fmt.Errorf("convert the Auto Scaling configuration for service %s: %w", s.name, err)
//}
//storage, err := convertStorageOpts(s.manifest.Storage)
//if err != nil {
// return "", fmt.Errorf("convert storage options for service %s: %w", s.name, err)
//}
desiredCountLambda, err := s.parser.Read(desiredCountGeneratorPath)
if err != nil {
return "", fmt.Errorf("read desired count lambda: %w", err)
}
outputs, err := s.addonsOutputs()
if err != nil {
return "", err
}
sidecars, err := convertSidecar(s.manifest.Sidecars)
if err != nil {
return "", fmt.Errorf("convert the sidecar configuration for service %s: %w", s.name, err)
}
autoscaling, err := convertAutoscaling(&s.manifest.Count.Autoscaling)
if err != nil {
return "", fmt.Errorf("convert the Auto Scaling configuration for service %s: %w", s.name, err)
}
storage, err := convertStorageOpts(s.manifest.Storage)
if err != nil {
return "", fmt.Errorf("convert storage options for service %s: %w", s.name, err)
}
content, err := s.parser.ParseBackendService(template.WorkloadOpts{
Variables: s.manifest.BackendServiceConfig.Variables,
Secrets: s.manifest.BackendServiceConfig.Secrets,
//NestedStack: outputs,
//Sidecars: sidecars,
//Autoscaling: autoscaling,
NestedStack: outputs,
Sidecars: sidecars,
Autoscaling: autoscaling,
HealthCheck: s.manifest.BackendServiceConfig.ImageConfig.HealthCheckOpts(),
LogConfig: convertLogging(s.manifest.Logging),
//DesiredCountLambda: desiredCountLambda.String(),
//Storage: storage,
DesiredCountLambda: desiredCountLambda.String(),
Storage: storage,
Network: convertNetworkConfig(s.manifest.Network),
EntryPoint: s.manifest.EntryPoint.ToStringSlice(),
Command: s.manifest.Command.ToStringSlice(),
Expand Down
2 changes: 2 additions & 0 deletions internal/pkg/deploy/cloudformation/stack/scheduled_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ func (j *ScheduledJob) Template() (string, error) {
LogConfig: convertLogging(j.manifest.Logging),
Storage: storage,
Network: convertNetworkConfig(j.manifest.Network),
EntryPoint: j.manifest.EntryPoint.ToStringSlice(),
Command: j.manifest.Command.ToStringSlice(),
})
if err != nil {
return "", fmt.Errorf("parse scheduled job template: %w", err)
Expand Down
1 change: 1 addition & 0 deletions internal/pkg/manifest/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ type ScheduledJob struct {
// ScheduledJobConfig holds the configuration for a scheduled job
type ScheduledJobConfig struct {
ImageConfig Image `yaml:"image,flow"`
ImageOverride `yaml:",inline"`
TaskConfig `yaml:",inline"`
*Logging `yaml:"logging,flow"`
Sidecars map[string]*SidecarConfig `yaml:"sidecars"`
Expand Down
1 change: 1 addition & 0 deletions templates/workloads/jobs/scheduled-job/cf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Resources:
{{include "envvars" . | indent 10}}
{{include "secrets" . | indent 10}}
{{include "logconfig" . | indent 10}}
{{include "image-overrides" . | indent 10}}
{{- if .Storage -}}
{{include "mount-points" . | indent 10}}
{{- end -}}
Expand Down

0 comments on commit 013104b

Please sign in to comment.