From 7d62c494bd87c1e47268ae8085ca4ee49c79a126 Mon Sep 17 00:00:00 2001 From: Petrus Date: Thu, 9 Jan 2025 17:58:59 +0800 Subject: [PATCH] fix 321 ua (#3954) Signed-off-by: Patrick Zhao --- pkg/cli/upgradeassistant/cmd/migrate/321.go | 4 +++- pkg/microservice/aslan/config/consts.go | 2 +- .../cron/core/service/scheduler/cronjob_handler.go | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/cli/upgradeassistant/cmd/migrate/321.go b/pkg/cli/upgradeassistant/cmd/migrate/321.go index 7bbe4db04a..845c919f24 100644 --- a/pkg/cli/upgradeassistant/cmd/migrate/321.go +++ b/pkg/cli/upgradeassistant/cmd/migrate/321.go @@ -25,6 +25,7 @@ import ( commonmodels "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/models" commonrepo "github.com/koderover/zadig/v2/pkg/microservice/aslan/core/common/repository/mongodb" "github.com/koderover/zadig/v2/pkg/shared/handler" + "github.com/koderover/zadig/v2/pkg/util" "go.mongodb.org/mongo-driver/bson" ) @@ -69,9 +70,10 @@ func migrateReleasePlanCron(ctx *handler.Context) error { for _, releasePlan := range releasePlans { if releasePlan.ScheduleExecuteTime != 0 && releasePlan.Status == config.StatusExecuting { if time.Unix(releasePlan.ScheduleExecuteTime, 0).After(time.Now()) { + releasePlanCronName := util.GetReleasePlanCronName(releasePlan.ID.Hex(), releasePlan.Name, releasePlan.Index) cronjob := &commonmodels.Cronjob{ Enabled: true, - Name: releasePlan.Name, + Name: releasePlanCronName, Type: "release_plan", JobType: string(config.UnixstampSchedule), UnixStamp: releasePlan.ScheduleExecuteTime, diff --git a/pkg/microservice/aslan/config/consts.go b/pkg/microservice/aslan/config/consts.go index afcbf43448..238b99e6fb 100644 --- a/pkg/microservice/aslan/config/consts.go +++ b/pkg/microservice/aslan/config/consts.go @@ -59,7 +59,7 @@ const ( // GapSchedule 间隔循环 GapSchedule ScheduleType = "gap" // UnixstampSchedule 时间戳 - UnixstampSchedule ScheduleType = "unixstamp" + UnixstampSchedule ScheduleType = "unix_stamp" ) type SlackNotifyType string diff --git a/pkg/microservice/cron/core/service/scheduler/cronjob_handler.go b/pkg/microservice/cron/core/service/scheduler/cronjob_handler.go index ce8d3aaed4..6d78bfefa2 100644 --- a/pkg/microservice/cron/core/service/scheduler/cronjob_handler.go +++ b/pkg/microservice/cron/core/service/scheduler/cronjob_handler.go @@ -455,6 +455,8 @@ func registerCronjob(job *service.Cronjob, client *client.Client, scheduler *cro } } else { switch job.Type { + case setting.WorkflowCronjob: + return nil case setting.WorkflowV4Cronjob: if job.WorkflowV4Args == nil { return fmt.Errorf("workflow args is nil")