refactor: unify kubernetes_ table prefix, merge CI/CD models, LLM session support
- Rename container_clusters → kubernetes_clusters, container_topology_layouts → kubernetes_topology_layouts - LLM: add session_id to chat history for multi-turn conversation support - CI/CD: add pipeline_id, deploy_type, artifact_url, k8s_cluster_id to AppRelease - Cleanup: remove deprecated playbook handler, simplify automation models - Database: optimize auto-migrate model list - Frontend: AIOps assistant improvements, api.ts updates
This commit is contained in:
1 parent
9365c1e9db
commit
732974d152
14 files changed
+121
-474
No files matched your search
@@ -32,7 +32,7 @@ func (Pipeline) TableName() string {
|
||||
return "ops_pipelines"
|
||||
}
|
||||
|
||||
// PipelineRun 流水线运行记录
|
||||
// PipelineRun 流水线运行记录(CI 执行)
|
||||
type PipelineRun struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
PipelineID uint `gorm:"not null" json:"pipeline_id"`
|
||||
@@ -42,6 +42,8 @@ type PipelineRun struct {
|
||||
CommitID string `gorm:"size:64" json:"commit_id"`
|
||||
CommitMsg string `gorm:"size:500" json:"commit_msg"`
|
||||
Author string `gorm:"size:64" json:"author"`
|
||||
ImageTag string `gorm:"size:255" json:"image_tag"` // 构建产物镜像标签
|
||||
ArtifactURL string `gorm:"size:500" json:"artifact_url"` // 构建产物地址
|
||||
Duration int `json:"duration"` // 秒
|
||||
Stages string `gorm:"type:text" json:"stages"` // JSON
|
||||
Logs string `gorm:"type:longtext" json:"logs"`
|
||||
@@ -57,16 +59,19 @@ type PipelineRun struct {
|
||||
|
||||
// TableName 表名
|
||||
func (PipelineRun) TableName() string {
|
||||
return "pipeline_runs"
|
||||
return "ops_pipeline_runs"
|
||||
}
|
||||
|
||||
// AppRelease 应用发布模型
|
||||
// AppRelease 应用发布模型(CD:从 CI 产物部署到目标环境)
|
||||
type AppRelease struct {
|
||||
ID uint `gorm:"primarykey" json:"id"`
|
||||
PipelineID *uint `json:"pipeline_id"` // 来源流水线
|
||||
PipelineRunID *uint `json:"pipeline_run_id"` // 来源 CI 执行记录
|
||||
AppName string `gorm:"size:128;not null" json:"app_name"`
|
||||
Version string `gorm:"size:64;not null" json:"version"`
|
||||
Environment string `gorm:"size:32;not null" json:"environment"` // dev, test, staging, prod
|
||||
Status string `gorm:"size:32;default:pending" json:"status"` // pending, building, deploying, success, failed, rolled_back
|
||||
DeployType string `gorm:"size:32;default:server" json:"deploy_type"` // server, kubernetes
|
||||
Status string `gorm:"size:32;default:pending" json:"status"` // pending, approved, rejected, deploying, success, failed, rolled_back
|
||||
CommitID string `gorm:"size:64" json:"commit_id"`
|
||||
CommitMsg string `gorm:"size:500" json:"commit_msg"`
|
||||
Author string `gorm:"size:64" json:"author"`
|
||||
@@ -75,7 +80,10 @@ type AppRelease struct {
|
||||
DeployedAt *time.Time `json:"deployed_at"`
|
||||
RollbackAt *time.Time `json:"rollback_at"`
|
||||
Duration int `json:"duration"`
|
||||
Servers string `gorm:"type:text" json:"servers"` // JSON
|
||||
ImageTag string `gorm:"size:255" json:"image_tag"` // 构建产物镜像标签
|
||||
K8sClusterID *uint `json:"k8s_cluster_id"` // Kubernetes 部署目标集群
|
||||
K8sNamespace string `gorm:"size:128" json:"k8s_namespace"` // Kubernetes 部署目标命名空间
|
||||
Servers string `gorm:"type:text" json:"servers"` // JSON(传统服务器部署目标)
|
||||
Description string `gorm:"size:500" json:"description"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
@@ -107,13 +115,19 @@ type TriggerPipelineRequest struct {
|
||||
|
||||
// CreateAppReleaseRequest 创建应用发布请求
|
||||
type CreateAppReleaseRequest struct {
|
||||
AppName string `json:"app_name" binding:"required"`
|
||||
Version string `json:"version" binding:"required"`
|
||||
Environment string `json:"environment" binding:"required,oneof=dev test staging prod"`
|
||||
CommitID string `json:"commit_id"`
|
||||
CommitMsg string `json:"commit_msg"`
|
||||
Servers []uint `json:"servers"`
|
||||
Description string `json:"description"`
|
||||
PipelineID *uint `json:"pipeline_id"`
|
||||
PipelineRunID *uint `json:"pipeline_run_id"`
|
||||
AppName string `json:"app_name" binding:"required"`
|
||||
Version string `json:"version" binding:"required"`
|
||||
Environment string `json:"environment" binding:"required,oneof=dev test staging prod"`
|
||||
DeployType string `json:"deploy_type" binding:"omitempty,oneof=server kubernetes"`
|
||||
CommitID string `json:"commit_id"`
|
||||
CommitMsg string `json:"commit_msg"`
|
||||
ImageTag string `json:"image_tag"`
|
||||
K8sClusterID *uint `json:"k8s_cluster_id"`
|
||||
K8sNamespace string `json:"k8s_namespace"`
|
||||
Servers []uint `json:"servers"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// PipelineStats 流水线统计
|
||||
|
||||
Reference in new issue
Block a user