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..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,6 +786,7 @@ func (w *Service) getApproveNotificationContent(notify *models.NotifyCtl, task * WorkflowDisplayName: task.WorkflowDisplayName, ProjectName: task.ProjectName, ProjectDisplayName: project.ProjectName, + ReleasePlan: buildWorkflowNotifyReleasePlan(task.ReleasePlan), Status: task.Status, Remark: task.Remark, Error: task.Error, @@ -973,6 +986,7 @@ func (w *Service) getNotificationContentWithOptions(notify *models.NotifyCtl, ta WorkflowDisplayName: task.WorkflowDisplayName, ProjectName: task.ProjectName, ProjectDisplayName: project.ProjectName, + 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 2c898d62e9..c7dea331fd 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 *WorkflowNotifyReleasePlan `json:"release_plan,omitempty"` Status config.Status `json:"status"` Remark string `json:"remark"` DetailURL string `json:"detail_url"` @@ -77,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"`