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:
3 files changed
+4
-9
No files matched your search
@@ -302,6 +302,7 @@ type ProcessCron struct {
|
|||||||
ID string `yaml:"id"`
|
ID string `yaml:"id"`
|
||||||
Schedule string `yaml:"schedule"`
|
Schedule string `yaml:"schedule"`
|
||||||
Suffix string `yaml:"suffix"`
|
Suffix string `yaml:"suffix"`
|
||||||
|
Suspend bool `yaml:"suspend"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ProcessPortMap struct {
|
type ProcessPortMap struct {
|
||||||
|
|||||||
@@ -135,6 +135,6 @@ spec:
|
|||||||
schedule: {{ $config.cron.schedule }}
|
schedule: {{ $config.cron.schedule }}
|
||||||
startingDeadlineSeconds: 60
|
startingDeadlineSeconds: 60
|
||||||
successfulJobsHistoryLimit: 10
|
successfulJobsHistoryLimit: 10
|
||||||
suspend: false
|
suspend: {{ $config.cron.suspend }}
|
||||||
timeZone: Etc/UTC
|
timeZone: Etc/UTC
|
||||||
{{- end }}
|
{{- end }}
|
||||||
@@ -312,17 +312,10 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
|||||||
|
|
||||||
workingDir := common.GetWorkingDir(appName, image)
|
workingDir := common.GetWorkingDir(appName, image)
|
||||||
|
|
||||||
allCronTasks, err := cron.FetchCronTasks(cron.FetchCronTasksInput{AppName: appName})
|
cronTasks, err := cron.FetchCronTasks(cron.FetchCronTasksInput{AppName: appName})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error fetching cron tasks: %w", err)
|
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{}
|
domains := []string{}
|
||||||
if _, ok := processes["web"]; ok {
|
if _, ok := processes["web"]; ok {
|
||||||
@@ -655,6 +648,7 @@ func TriggerSchedulerDeploy(scheduler string, appName string, imageTag string) e
|
|||||||
ID: cronTask.ID,
|
ID: cronTask.ID,
|
||||||
Schedule: cronTask.Schedule,
|
Schedule: cronTask.Schedule,
|
||||||
Suffix: suffix,
|
Suffix: suffix,
|
||||||
|
Suspend: cronEntry.Maintenance,
|
||||||
},
|
},
|
||||||
Labels: labels,
|
Labels: labels,
|
||||||
ProcessType: ProcessType_Cron,
|
ProcessType: ProcessType_Cron,
|
||||||
|
|||||||
Reference in new issue
Block a user