diff --git a/core/service/build/build.go b/core/service/build/build.go index 577da9d..b28ebb0 100644 --- a/core/service/build/build.go +++ b/core/service/build/build.go @@ -272,6 +272,15 @@ func (s *srv) Cancel(ctx context.Context, namespace, name string, number uint64) return errors.New("already done") } + if err := db.Model(&storageV1.Stage{}). + Where(&storageV1.Stage{ + BoxID: buildS.BoxID, + BuildID: buildS.ID, + Phase: v1.PhasePending.String(), + }).Update("phase", v1.PhaseCanceled).Error; err != nil { + return err + } + sched := scheduler.FromContext(ctx) return sched.Cancel(ctx, int64(build.ID)) }