refactor: respect the maintenance value of the cron task instead of skipping them
The former method would omit the CronJob objects entirely, meaning a redeploy would be necessary to re-enable them.
This commit is contained in:
@@ -302,6 +302,7 @@ type ProcessCron struct {
|
||||
ID string `yaml:"id"`
|
||||
Schedule string `yaml:"schedule"`
|
||||
Suffix string `yaml:"suffix"`
|
||||
Suspend bool `yaml:"suspend"`
|
||||
}
|
||||
|
||||
type ProcessPortMap struct {
|
||||
|
||||
@@ -135,6 +135,6 @@ spec:
|
||||
schedule: {{ $config.cron.schedule }}
|
||||
startingDeadlineSeconds: 60
|
||||
successfulJobsHistoryLimit: 10
|
||||
suspend: false
|
||||
suspend: {{ $config.cron.suspend }}
|
||||
timeZone: Etc/UTC
|
||||
{{- end }}
|
||||
|
||||
@@ -312,17 +312,10 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
||||
|
||||
workingDir := common.GetWorkingDir(appName, image)
|
||||
|
||||
allCronTasks, err := cron.FetchCronTasks(cron.FetchCronTasksInput{AppName: appName})
|
||||
cronTasks, err := cron.FetchCronTasks(cron.FetchCronTasksInput{AppName: appName})
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error fetching cron tasks: %w", err)
|
||||
}
|
||||
// remove maintenance cron tasks
|
||||
cronTasks := []cron.CronTask{}
|
||||
for _, cronTask := range allCronTasks {
|
||||
if !cronTask.Maintenance {
|
||||
cronTasks = append(cronTasks, cronTask)
|
||||
}
|
||||
}
|
||||
|
||||
domains := []string{}
|
||||
if _, ok := processes["web"]; ok {
|
||||
@@ -655,6 +648,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
||||
ID: cronTask.ID,
|
||||
Schedule: cronTask.Schedule,
|
||||
Suffix: suffix,
|
||||
Suspend: cronEntry.Maintenance,
|
||||
},
|
||||
Labels: labels,
|
||||
ProcessType: ProcessType_Cron,
|
||||
|
||||
Reference in New Issue
Block a user