Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: deprecate some activities in favor of issue comment (#11660)
p0ny31de30eb1661
diff --git a/backend/api/v1/rollout_service.go b/backend/api/v1/rollout_service.goindex 70c27212eb..888090f3dd 100644--- a/backend/api/v1/rollout_service.go+++ b/backend/api/v1/rollout_service.go@@ -1268,26 +1268,6 @@ func (s *RolloutService) UpdatePlan(ctx context.Context, request *v1pb.UpdatePla}(); err != nil {slog.Warn("failed to create issue comments for statement update", "issueUID", issue.UID, log.BBError(err))}-- if err := func() error {- payload, err := json.Marshal(statementUpdate)- if err != nil {- return errors.Wrapf(err, "failed to marshal payload")- }- _, err = s.activityManager.CreateActivity(ctx, &store.ActivityMessage{- CreatorUID: user.ID,- ResourceContainer: project.GetName(),- ContainerUID: task.PipelineID,- Type: api.ActivityPipelineTaskStatementUpdate,- Payload: string(payload),- Level: api.ActivityInfo,- }, &activity.Metadata{- Issue: issue,- })- return errors.Wrapf(err, "failed to create activity")- }(); err != nil {- slog.Error("failed to create statement update activity after updating plan", log.BBError(err))- }}for _, earliestUpdate := range earliestUpdates {task := tasksMap[earliestUpdate.TaskID]@@ -1308,26 +1288,6 @@ func (s *RolloutService) UpdatePlan(ctx context.Context, request *v1pb.UpdatePla}(); err != nil {slog.Warn("failed to create issue comments for earliest allowed time update", "issueUID", issue.UID, log.BBError(err))}-- if err := func() error {- payload, err := json.Marshal(earliestUpdate)- if err != nil {- return errors.Wrapf(err, "failed to marshal payload")- }- _, err = s.activityManager.CreateActivity(ctx, &store.ActivityMessage{- CreatorUID: user.ID,- ResourceContainer: project.GetName(),- ContainerUID: task.PipelineID,- Type: api.ActivityPipelineTaskEarliestAllowedTimeUpdate,- Payload: string(payload),- Level: api.ActivityInfo,- }, &activity.Metadata{- Issue: issue,- })- return errors.Wrapf(err, "failed to create activity")- }(); err != nil {- slog.Error("failed to create earliest update activity after updating plan", log.BBError(err))- }}if issue != nil && doUpdateSheet {diff --git a/backend/component/activity/manager.go b/backend/component/activity/manager.goindex 7e315fc53d..1b58819706 100644--- a/backend/component/activity/manager.go+++ b/backend/component/activity/manager.go@@ -387,6 +387,7 @@ func (m *Manager) getWebhookContext(ctx context.Context, activity *store.Activitcase api.ActivityIssueCreate:title = fmt.Sprintf("Issue created - %s", meta.Issue.Title)titleZh = fmt.Sprintf("创建工单 - %s", meta.Issue.Title)+case api.ActivityIssueStatusUpdate:switch meta.Issue.Status {case "OPEN":@@ -400,9 +401,11 @@ func (m *Manager) getWebhookContext(ctx context.Context, activity *store.Activittitle = fmt.Sprintf("Issue canceled - %s", meta.Issue.Title)titleZh = fmt.Sprintf("工单取消 - %s", meta.Issue.Title)}+case api.ActivityIssueCommentCreate:title = fmt.Sprintf("Comment created - %s", meta.Issue.Title)titleZh = fmt.Sprintf("工单新评论 - %s", meta.Issue.Title)+case api.ActivityIssueFieldUpdate:update := new(api.ActivityIssueFieldUpdatePayload)if err := json.Unmarshal([]byte(activity.Payload), update); err != nil {@@ -482,6 +485,7 @@ func (m *Manager) getWebhookContext(ctx context.Context, activity *store.Activittitle = fmt.Sprintf("Updated issue - %s", meta.Issue.Title)titleZh = fmt.Sprintf("工单信息变更 - %s", meta.Issue.Title)}+case api.ActivityPipelineStageStatusUpdate:payload := &api.ActivityPipelineStageStatusUpdatePayload{}if err := json.Unmarshal([]byte(activity.Payload), payload); err != nil {diff --git a/backend/legacyapi/activity.go b/backend/legacyapi/activity.goindex 3e771f33b8..f11460e3f0 100644--- a/backend/legacyapi/activity.go+++ b/backend/legacyapi/activity.go@@ -20,27 +20,37 @@ const (// Issue related.// ActivityIssueCreate is the type for creating issues.+ // Used for notification only.ActivityIssueCreate ActivityType = "bb.issue.create"// ActivityIssueCommentCreate is the type for creating issue comments.+ // Used for notification only.ActivityIssueCommentCreate ActivityType = "bb.issue.comment.create"// ActivityIssueFieldUpdate is the type for updating issue fields.+ // Used for notification only.ActivityIssueFieldUpdate ActivityType = "bb.issue.field.update"// ActivityIssueStatusUpdate is the type for updating issue status.+ // Used for notification only.ActivityIssueStatusUpdate ActivityType = "bb.issue.status.update"// ActivityIssueApprovalNotify is the type for notifying issue approval.+ // Used for notification only.ActivityIssueApprovalNotify ActivityType = "bb.issue.approval.notify"// ActivityPipelineStageStatusUpdate is the type for stage begins or ends.+ // Used for notification only.ActivityPipelineStageStatusUpdate ActivityType = "bb.pipeline.stage.status.update"// ActivityPipelineTaskStatusUpdate is the type for updating pipeline task status.// Deprecated: use `ActivityPipelineTaskRunStatusUpdate` instead.ActivityPipelineTaskStatusUpdate ActivityType = "bb.pipeline.task.status.update"// ActivityPipelineTaskRunStatusUpdate is the type for updating pipeline task run status.+ // Used for notification only.ActivityPipelineTaskRunStatusUpdate ActivityType = "bb.pipeline.taskrun.status.update"// ActivityPipelineTaskStatementUpdate is the type for updating pipeline task SQL statement.+ // Deprecated.ActivityPipelineTaskStatementUpdate ActivityType = "bb.pipeline.task.statement.update"// ActivityPipelineTaskEarliestAllowedTimeUpdate is the type for updating pipeline task the earliest allowed time.+ // Deprecated.ActivityPipelineTaskEarliestAllowedTimeUpdate ActivityType = "bb.pipeline.task.general.earliest-allowed-time.update"// ActivityPipelineTaskStatementUpdate is the type for updating pipeline task SQL statement.+ // Deprecated.ActivityPipelineTaskPriorBackup ActivityType = "bb.pipeline.task.prior-backup"// Member related.diff --git a/backend/store/activity.go b/backend/store/activity.goindex 35150ff0c9..6ec1118713 100644--- a/backend/store/activity.go+++ b/backend/store/activity.go@@ -270,7 +270,16 @@ type UpdateActivityMessage struct {// Certain types of activities are not stored in the database.func (s *Store) CreateActivityV2(ctx context.Context, create *ActivityMessage) (*ActivityMessage, error) {switch create.Type {- case api.ActivityNotifyIssueApproved, api.ActivityNotifyPipelineRollout:+ case+ api.ActivityIssueCreate,+ api.ActivityIssueCommentCreate,+ api.ActivityIssueFieldUpdate,+ api.ActivityIssueStatusUpdate,+ api.ActivityIssueApprovalNotify,+ api.ActivityPipelineStageStatusUpdate,+ api.ActivityPipelineTaskRunStatusUpdate,+ api.ActivityNotifyIssueApproved,+ api.ActivityNotifyPipelineRollout:return create, nil}