Skip to content

Commit

Permalink
fix 321 ua (#3954)
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick Zhao <[email protected]>
  • Loading branch information
PetrusZ authored Jan 9, 2025
1 parent d5d13c9 commit 7d62c49
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion pkg/cli/upgradeassistant/cmd/migrate/321.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion pkg/microservice/aslan/config/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ const (
// GapSchedule 间隔循环
GapSchedule ScheduleType = "gap"
// UnixstampSchedule 时间戳
UnixstampSchedule ScheduleType = "unixstamp"
UnixstampSchedule ScheduleType = "unix_stamp"
)

type SlackNotifyType string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 7d62c49

Please sign in to comment.