From 7f6a170aeed003b255f61215f5f716e86548dbae Mon Sep 17 00:00:00 2001 From: huanghongbo Date: Tue, 19 May 2026 15:22:16 +0800 Subject: [PATCH 1/2] feat: include release plan in workflow webhook payload Signed-off-by: huanghongbo --- .../aslan/core/common/service/instantmessage/workflow_task.go | 2 ++ .../aslan/core/common/service/webhooknotify/types.go | 1 + 2 files changed, 3 insertions(+) diff --git a/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go b/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go index 15ef5af21e..b9dec27a66 100644 --- a/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go +++ b/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go @@ -774,6 +774,7 @@ func (w *Service) getApproveNotificationContent(notify *models.NotifyCtl, task * WorkflowDisplayName: task.WorkflowDisplayName, ProjectName: task.ProjectName, ProjectDisplayName: project.ProjectName, + ReleasePlan: task.ReleasePlan, Status: task.Status, Remark: task.Remark, Error: task.Error, @@ -973,6 +974,7 @@ func (w *Service) getNotificationContentWithOptions(notify *models.NotifyCtl, ta WorkflowDisplayName: task.WorkflowDisplayName, ProjectName: task.ProjectName, ProjectDisplayName: project.ProjectName, + ReleasePlan: task.ReleasePlan, Status: task.Status, Remark: task.Remark, Error: task.Error, diff --git a/pkg/microservice/aslan/core/common/service/webhooknotify/types.go b/pkg/microservice/aslan/core/common/service/webhooknotify/types.go index 2c898d62e9..785bdcbe49 100644 --- a/pkg/microservice/aslan/core/common/service/webhooknotify/types.go +++ b/pkg/microservice/aslan/core/common/service/webhooknotify/types.go @@ -62,6 +62,7 @@ type WorkflowNotify struct { ProjectDisplayName string `json:"project_display_name"` WorkflowName string `json:"workflow_name"` WorkflowDisplayName string `json:"workflow_display_name"` + ReleasePlan *commonmodels.ReleasePlanRef `json:"release_plan,omitempty"` Status config.Status `json:"status"` Remark string `json:"remark"` DetailURL string `json:"detail_url"` From 4d18442980f76b54b61ebdbcb74a565ee783dde8 Mon Sep 17 00:00:00 2001 From: huanghongbo-hhb Date: Thu, 21 May 2026 18:06:58 +0800 Subject: [PATCH 2/2] refactor: decouple workflow webhook release plan payload Signed-off-by: huanghongbo-hhb --- .../service/instantmessage/workflow_task.go | 16 ++++++++++++++-- .../core/common/service/webhooknotify/types.go | 8 +++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go b/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go index b9dec27a66..d7252a7091 100644 --- a/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go +++ b/pkg/microservice/aslan/core/common/service/instantmessage/workflow_task.go @@ -746,6 +746,18 @@ func getStageTaskByName(stages []*models.StageTask, stageName string) *models.St return nil } +func buildWorkflowNotifyReleasePlan(releasePlan *models.ReleasePlanRef) *webhooknotify.WorkflowNotifyReleasePlan { + if releasePlan == nil { + return nil + } + + return &webhooknotify.WorkflowNotifyReleasePlan{ + ID: releasePlan.ID, + Name: releasePlan.Name, + Index: releasePlan.Index, + } +} + func (w *Service) getApproveNotificationContent(notify *models.NotifyCtl, task *models.WorkflowTask) (string, string, *LarkCard, *webhooknotify.WorkflowNotify, error) { project, err := templaterepo.NewProductColl().Find(task.ProjectName) if err != nil { @@ -774,7 +786,7 @@ func (w *Service) getApproveNotificationContent(notify *models.NotifyCtl, task * WorkflowDisplayName: task.WorkflowDisplayName, ProjectName: task.ProjectName, ProjectDisplayName: project.ProjectName, - ReleasePlan: task.ReleasePlan, + ReleasePlan: buildWorkflowNotifyReleasePlan(task.ReleasePlan), Status: task.Status, Remark: task.Remark, Error: task.Error, @@ -974,7 +986,7 @@ func (w *Service) getNotificationContentWithOptions(notify *models.NotifyCtl, ta WorkflowDisplayName: task.WorkflowDisplayName, ProjectName: task.ProjectName, ProjectDisplayName: project.ProjectName, - ReleasePlan: task.ReleasePlan, + ReleasePlan: buildWorkflowNotifyReleasePlan(task.ReleasePlan), Status: task.Status, Remark: task.Remark, Error: task.Error, diff --git a/pkg/microservice/aslan/core/common/service/webhooknotify/types.go b/pkg/microservice/aslan/core/common/service/webhooknotify/types.go index 785bdcbe49..c7dea331fd 100644 --- a/pkg/microservice/aslan/core/common/service/webhooknotify/types.go +++ b/pkg/microservice/aslan/core/common/service/webhooknotify/types.go @@ -62,7 +62,7 @@ type WorkflowNotify struct { ProjectDisplayName string `json:"project_display_name"` WorkflowName string `json:"workflow_name"` WorkflowDisplayName string `json:"workflow_display_name"` - ReleasePlan *commonmodels.ReleasePlanRef `json:"release_plan,omitempty"` + ReleasePlan *WorkflowNotifyReleasePlan `json:"release_plan,omitempty"` Status config.Status `json:"status"` Remark string `json:"remark"` DetailURL string `json:"detail_url"` @@ -78,6 +78,12 @@ type WorkflowNotify struct { TaskType config.CustomWorkflowTaskType `json:"task_type"` } +type WorkflowNotifyReleasePlan struct { + ID string `json:"id"` + Name string `json:"name"` + Index int64 `json:"index"` +} + type WorkflowNotifyStage struct { Name string `json:"name"` Status config.Status `json:"status"`