Skip to content

Commit b85bf2a

Browse files
feat: add ai release specialist prompt debug api
Signed-off-by: huanghongbo-hhb <huanghongbo@koderover.com>
1 parent f8d39b9 commit b85bf2a

16 files changed

Lines changed: 1392 additions & 0 deletions

File tree

pkg/microservice/aslan/config/consts.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ const (
259259
JobBlueKing JobType = "blueking"
260260
JobApproval JobType = "approval"
261261
JobNotification JobType = "notification"
262+
JobAIReleaseSpecialist JobType = "ai-release-specialist"
262263
JobSAEDeploy JobType = "sae-deploy"
263264
JobApisix JobType = "apisix"
264265
)

pkg/microservice/aslan/core/common/repository/models/wokflow_task_v4.go

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -689,6 +689,65 @@ type JobTaskApprovalSpec struct {
689689
ApprovalMessage string `bson:"approval_message" yaml:"approval_message,omitempty" json:"approval_message,omitempty"`
690690
}
691691

692+
type JobTaskAIReleaseSpecialistSpec struct {
693+
Timeout int64 `bson:"timeout" json:"timeout" yaml:"timeout"`
694+
PromptTemplate string `bson:"prompt_template" json:"prompt_template" yaml:"prompt_template"`
695+
RequireManualConfirm bool `bson:"require_manual_confirm" json:"require_manual_confirm" yaml:"require_manual_confirm"`
696+
ConfirmUsers []*User `bson:"confirm_users" json:"confirm_users" yaml:"confirm_users"`
697+
NativeApproval *NativeApproval `bson:"native_approval,omitempty" json:"native_approval,omitempty" yaml:"native_approval,omitempty"`
698+
Input *AIReleaseSpecialistInput `bson:"input,omitempty" json:"input,omitempty" yaml:"input,omitempty"`
699+
Result *AIReleaseSpecialistResult `bson:"result,omitempty" json:"result,omitempty" yaml:"result,omitempty"`
700+
ChangeSummaryText string `bson:"change_summary_text,omitempty" json:"change_summary_text,omitempty" yaml:"change_summary_text,omitempty"`
701+
}
702+
703+
type AIReleaseSpecialistInput struct {
704+
ReleaseTargets *AIReleaseTargetsSummary `json:"release_targets,omitempty"`
705+
ChangeSummary *AIChangeSummary `json:"change_summary,omitempty"`
706+
ScanSummary *AIScanSummary `json:"scan_summary,omitempty"`
707+
TestSummary *AITestSummary `json:"test_summary,omitempty"`
708+
}
709+
710+
type AIReleaseTargetsSummary struct {
711+
EnvName string `json:"env_name,omitempty"`
712+
EnvAlias string `json:"env_alias,omitempty"`
713+
Production bool `json:"production,omitempty"`
714+
ServiceNames []string `json:"service_names,omitempty"`
715+
ImageVersions []string `json:"image_versions,omitempty"`
716+
TargetCount int `json:"target_count,omitempty"`
717+
}
718+
719+
type AIChangeSummary struct {
720+
Remark string `json:"remark,omitempty"`
721+
Branches []string `json:"branches,omitempty"`
722+
Tags []string `json:"tags,omitempty"`
723+
CommitMessages []string `json:"commit_messages,omitempty"`
724+
Services []string `json:"services,omitempty"`
725+
}
726+
727+
type AIScanSummary struct {
728+
JobStatuses []string `json:"job_statuses,omitempty"`
729+
Summaries []string `json:"summaries,omitempty"`
730+
}
731+
732+
type AITestSummary struct {
733+
JobStatuses []string `json:"job_statuses,omitempty"`
734+
Summaries []string `json:"summaries,omitempty"`
735+
}
736+
737+
type AIReleaseSpecialistResult struct {
738+
Conclusion string `json:"conclusion"`
739+
Summary string `json:"summary"`
740+
Checks []*AIReleaseSpecialistCheckItem `json:"checks"`
741+
RawText string `json:"raw_text"`
742+
}
743+
744+
type AIReleaseSpecialistCheckItem struct {
745+
Name string `json:"name"`
746+
Result string `json:"result"`
747+
Evidence string `json:"evidence"`
748+
Suggestion string `json:"suggestion"`
749+
}
750+
692751
type JobTaskWorkflowTriggerSpec struct {
693752
TriggerType config.WorkflowTriggerType `bson:"trigger_type" json:"trigger_type" yaml:"trigger_type"`
694753
IsEnableCheck bool `bson:"is_enable_check" json:"is_enable_check" yaml:"is_enable_check"`

pkg/microservice/aslan/core/common/repository/models/workflow_v4.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,6 +1188,13 @@ type NotificationJobSpec struct {
11881188
IsAtAll bool `bson:"is_at_all" yaml:"is_at_all" json:"is_at_all"`
11891189
}
11901190

1191+
type AIReleaseSpecialistJobSpec struct {
1192+
Timeout int64 `bson:"timeout" json:"timeout" yaml:"timeout"`
1193+
PromptTemplate string `bson:"prompt_template" json:"prompt_template" yaml:"prompt_template"`
1194+
RequireManualConfirm bool `bson:"require_manual_confirm" json:"require_manual_confirm" yaml:"require_manual_confirm"`
1195+
ConfirmUsers []*User `bson:"confirm_users" json:"confirm_users" yaml:"confirm_users"`
1196+
}
1197+
11911198
// GenerateNewNotifyConfigWithOldData use the data before 3.3.0 in notifyCtl and generate the new config data based on the deprecated data.
11921199
func (n *NotificationJobSpec) GenerateNewNotifyConfigWithOldData() error {
11931200
switch n.WebHookType {

pkg/microservice/aslan/core/common/service/workflowcontroller/jobcontroller/job.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ func initJobCtl(job *commonmodels.JobTask, workflowCtx *commonmodels.WorkflowTas
113113
jobCtl = NewBlueKingJobCtl(job, workflowCtx, ack, logger)
114114
case string(config.JobApproval):
115115
jobCtl = NewApprovalJobCtl(job, workflowCtx, ack, logger)
116+
case string(config.JobAIReleaseSpecialist):
117+
jobCtl = NewAIReleaseSpecialistJobCtl(job, workflowCtx, ack, logger)
116118
case string(config.JobNotification):
117119
jobCtl = NewNotificationJobCtl(job, workflowCtx, ack, logger)
118120
case string(config.JobSAEDeploy):

0 commit comments

Comments
 (0)