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:
Jose Diaz-Gonzalez
2025-09-21 19:48:11 -04:00
parent 1674d02af9
commit c885205b91
3 changed files with 4 additions and 9 deletions

View File

@@ -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 {

View File

@@ -135,6 +135,6 @@ spec:
schedule: {{ $config.cron.schedule }}
startingDeadlineSeconds: 60
successfulJobsHistoryLimit: 10
suspend: false
suspend: {{ $config.cron.suspend }}
timeZone: Etc/UTC
{{- end }}

View File

@@ -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,