This commit is contained in:
Logan committed 2026-07-09 14:16:56 +08:00
1 parent 0690285147
commit 5618cd2738
154 files changed
+5021 -3161

No files matched your search

+10 -74
View File
@@ -2,91 +2,27 @@ package model
import "time"
// ============================================
// PipelineRepo Git 仓库认证配置
// ============================================
// RepoAuthType 仓库认证方式
type RepoAuthType string
const (
RepoAuthToken RepoAuthType = "token" // Personal Access Token
RepoAuthSSH RepoAuthType = "ssh" // SSH Key
RepoAuthPassword RepoAuthType = "password" // 用户名+密码
)
// PipelineRepo Git 仓库认证配置表
type PipelineRepo struct {
ID uint `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
Name string `gorm:"type:varchar(128);not null;comment:配置名称" json:"name"`
Description string `gorm:"type:varchar(256);comment:描述" json:"description,omitempty"`
URL string `gorm:"type:varchar(512);not null;comment:仓库 URL" json:"url"`
AuthType RepoAuthType `gorm:"type:varchar(16);default:'token';comment:认证方式: token/ssh/password" json:"auth_type"`
CredentialID *uint `gorm:"index;comment:凭据ID(关联 iam_credentials)" json:"credential_id,omitempty"`
Enabled bool `gorm:"default:true;comment:是否启用" json:"enabled"`
CreatedBy string `gorm:"type:varchar(64);comment:创建人" json:"created_by,omitempty"`
CreatedAt time.Time `gorm:"not null;comment:创建时间" json:"created_at"`
UpdatedAt time.Time `gorm:"not null;comment:更新时间" json:"updated_at"`
}
// TableName 表名
func (PipelineRepo) TableName() string {
return "deploy_pipeline_repos"
}
// ============================================
// PipelineRegistry 镜像仓库认证配置
// ============================================
// RegistryAuthType 镜像仓库认证方式
type RegistryAuthType string
const (
RegistryAuthToken RegistryAuthType = "token" // Access Token
RegistryAuthPassword RegistryAuthType = "password" // 用户名+密码
)
// PipelineRegistry 镜像仓库认证配置表
type PipelineRegistry struct {
ID uint `gorm:"primaryKey;autoIncrement;comment:主键ID" json:"id"`
Name string `gorm:"type:varchar(128);not null;comment:配置名称" json:"name"`
Description string `gorm:"type:varchar(256);comment:描述" json:"description,omitempty"`
RegistryURL string `gorm:"type:varchar(512);not null;comment:镜像仓库地址" json:"registry_url"`
Namespace string `gorm:"type:varchar(128);comment:默认命名空间" json:"namespace,omitempty"`
AuthType RegistryAuthType `gorm:"type:varchar(16);default:'password';comment:认证方式: token/password" json:"auth_type"`
CredentialID *uint `gorm:"index;comment:凭据ID(关联 iam_credentials)" json:"credential_id,omitempty"`
Enabled bool `gorm:"default:true;comment:是否启用" json:"enabled"`
CreatedBy string `gorm:"type:varchar(64);comment:创建人" json:"created_by,omitempty"`
CreatedAt time.Time `gorm:"not null;comment:创建时间" json:"created_at"`
UpdatedAt time.Time `gorm:"not null;comment:更新时间" json:"updated_at"`
}
// TableName 表名
func (PipelineRegistry) TableName() string {
return "deploy_pipeline_registries"
}
// ============================================
// PipelineStage 流水线阶段定义(JSON)
// ============================================
// PipelineStage 一个阶段包含多个任务
type PipelineStage struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // source/build/deploy/test/custom
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // source/build/deploy/test/custom
Tasks []PipelineTask `json:"tasks"`
}
// PipelineTask 阶段内的任务
type PipelineTask struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // build/deploy/test/custom
Icon string `json:"icon,omitempty"`
Config map[string]string `json:"config,omitempty"`
Script string `json:"script,omitempty"`
ScriptType string `json:"script_type,omitempty"` // shell/python
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // build/deploy/test/custom
Icon string `json:"icon,omitempty"`
Config map[string]string `json:"config,omitempty"`
Script string `json:"script,omitempty"`
ScriptType string `json:"script_type,omitempty"` // shell/python
}
// ============================================