Documentation ¶
Index ¶
- Variables
- func RegisterWorker(name string, fun func([]byte, *exectorManager) (TaskWorker, error))
- type BackupAPPNew
- type BackupAPPRestore
- type Commit
- type DockerComposeYaml
- type Error
- type ExportApp
- type ImageBuildItem
- type ImageShareItem
- type ImportApp
- type Info
- type Manager
- type MarketSlugItem
- type PluginShareItem
- type RegionServiceSnapshot
- type RestoreResult
- type Service
- type ServiceCheckInput
- type ServiceCheckResult
- type ShareStatus
- type SlugShareItem
- type SourceCodeBuildItem
- func (i *SourceCodeBuildItem) IsDockerfile() bool
- func (i *SourceCodeBuildItem) Run(timeout time.Duration) error
- func (i *SourceCodeBuildItem) UpdateBuildVersionInfo(res *build.Response) error
- func (i *SourceCodeBuildItem) UpdateCheckResult(result *dbmodel.CodeCheckResult) error
- func (i *SourceCodeBuildItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error
- type TaskWorker
- func BackupAPPNewCreater(in []byte, m *exectorManager) (TaskWorker, error)
- func BackupAPPRestoreCreater(in []byte, m *exectorManager) (TaskWorker, error)
- func NewExportApp(in []byte, m *exectorManager) (TaskWorker, error)
- func NewImportApp(in []byte, m *exectorManager) (TaskWorker, error)
- func SharePluginItemCreater(in []byte, m *exectorManager) (TaskWorker, error)
- type Worker
Constants ¶
This section is empty.
Variables ¶
var ErrorNum float64 = 0
var TaskNum float64 = 0
Functions ¶
func RegisterWorker ¶
func RegisterWorker(name string, fun func([]byte, *exectorManager) (TaskWorker, error))
RegisterWorker register worker creater
Types ¶
type BackupAPPNew ¶
type BackupAPPNew struct { GroupID string `json:"group_id" ` ServiceIDs []string `json:"service_ids" ` //full-online,full-offline Mode string `json:"mode"` Version string `json:"version"` EventID string SlugInfo struct { Namespace string `json:"namespace"` FTPHost string `json:"ftp_host"` FTPPort string `json:"ftp_port"` FTPUser string `json:"ftp_username"` FTPPassword string `json:"ftp_password"` } `json:"slug_info"` ImageInfo struct { HubURL string `json:"hub_url"` HubUser string `json:"hub_user"` HubPassword string `json:"hub_password"` Namespace string `json:"namespace"` IsTrust bool `json:"is_trust,omitempty"` } `json:"image_info,omitempty"` SourceDir string `json:"source_dir"` SourceType string `json:"source_type"` BackupID string `json:"backup_id"` BackupSize int64 Logger event.Logger DockerClient *client.Client }
BackupAPPNew backup group app new version
func (*BackupAPPNew) ErrorCallBack ¶
func (b *BackupAPPNew) ErrorCallBack(err error)
ErrorCallBack if run error will callback
func (*BackupAPPNew) GetLogger ¶
func (b *BackupAPPNew) GetLogger() event.Logger
GetLogger GetLogger
type BackupAPPRestore ¶
type BackupAPPRestore struct { //full-online,full-offline EventID string SlugInfo struct { Namespace string `json:"namespace"` FTPHost string `json:"ftp_host"` FTPPort string `json:"ftp_port"` FTPUser string `json:"ftp_username"` FTPPassword string `json:"ftp_password"` } `json:"slug_info"` ImageInfo struct { HubURL string `json:"hub_url"` HubUser string `json:"hub_user"` HubPassword string `json:"hub_password"` Namespace string `json:"namespace"` IsTrust bool `json:"is_trust,omitempty"` } `json:"image_info,omitempty"` BackupID string `json:"backup_id"` TenantID string `json:"tenant_id"` Logger event.Logger //RestoreMode(cdct) current datacenter and current tenant //RestoreMode(cdot) current datacenter and other tenant //RestoreMode(od) other datacenter RestoreMode string `json:"restore_mode"` RestoreID string `json:"restore_id"` DockerClient *client.Client // contains filtered or unexported fields }
BackupAPPRestore restrore the group app backup
func (*BackupAPPRestore) ErrorCallBack ¶
func (b *BackupAPPRestore) ErrorCallBack(err error)
ErrorCallBack if run error will callback
func (*BackupAPPRestore) GetLogger ¶
func (b *BackupAPPRestore) GetLogger() event.Logger
GetLogger GetLogger
type DockerComposeYaml ¶
type DockerComposeYaml struct { Version string `yaml:"version"` Volumes map[string]string `yaml:"volumes,omitempty"` Services map[string]*Service `yaml:"services,omitempty"` }
DockerComposeYaml docker compose struct
type Error ¶
type Error struct { Code uint `json:"code"` Msg string `json:"msg"` Details string `json:"details,omitempty"` }
Error Error
type ExportApp ¶
type ExportApp struct { EventID string `json:"event_id"` Format string `json:"format"` SourceDir string `json:"source_dir"` Logger event.Logger DockerClient *client.Client }
ExportApp Export app to specified format(rainbond-app or dockercompose)
func (*ExportApp) CleanSourceDir ¶
CleanSourceDir clean export dir
func (*ExportApp) ErrorCallBack ¶
ErrorCallBack if run error will callback
type ImageBuildItem ¶
type ImageBuildItem struct { Namespace string `json:"namespace"` TenantName string `json:"tenant_name"` ServiceAlias string `json:"service_alias"` Image string `json:"image"` DestImage string `json:"dest_image"` Logger event.Logger `json:"logger"` EventID string `json:"event_id"` DockerClient *client.Client TenantID string ServiceID string DeployVersion string HubUser string HubPassword string Action string }
ImageBuildItem ImageBuildItem
func (*ImageBuildItem) ImageNameHandler ¶
func (i *ImageBuildItem) ImageNameHandler(source string) string
ImageNameHandler 根据平台配置处理镜像名称
func (*ImageBuildItem) StorageVersionInfo ¶
func (i *ImageBuildItem) StorageVersionInfo(imageURL string) error
StorageVersionInfo 存储version信息
func (*ImageBuildItem) UpdateVersionInfo ¶
func (i *ImageBuildItem) UpdateVersionInfo(status string) error
UpdateVersionInfo 更新任务执行结果
type ImageShareItem ¶
type ImageShareItem struct { string `json:"service_key" ` AppVersion string `json:"app_version" ` EventID string `json:"event_id"` ShareUser string `json:"share_user"` ShareScope string `json:"share_scope"` ImageInfo struct { HubURL string `json:"hub_url"` HubUser string `json:"hub_user"` HubPassword string `json:"hub_password"` Namespace string `json:"namespace"` IsTrust bool `json:"is_trust,omitempty"` } `json:"image_info,omitempty"` } `json:"share_info"` }ServiceKey
ImageShareItem ImageShareItem
func NewImageShareItem ¶
func NewImageShareItem(in []byte, DockerClient *client.Client, EtcdCli *clientv3.Client) (*ImageShareItem, error)
NewImageShareItem 创建实体
func (*ImageShareItem) ShareService ¶
func (i *ImageShareItem) ShareService() error
ShareService ShareService
func (*ImageShareItem) UpdateShareStatus ¶
func (i *ImageShareItem) UpdateShareStatus(status string) error
UpdateShareStatus 更新任务执行结果
type ImportApp ¶
type ImportApp struct { EventID string `json:"event_id"` Format string `json:"format"` SourceDir string `json:"source_dir"` Apps []string `json:"apps"` ServiceImage model.ServiceImage ServiceSlug model.ServiceSlug Logger event.Logger DockerClient *client.Client // contains filtered or unexported fields }
ImportApp Export app to specified format(rainbond-app or dockercompose)
func (*ImportApp) ErrorCallBack ¶
ErrorCallBack if run error will callback
type Manager ¶
type Manager interface { AddTask(*pb.TaskMessage) error Start() error Stop() error }
Manager 任务执行管理器
type MarketSlugItem ¶
type MarketSlugItem struct { TenantName string `json:"tenant_name"` ServiceAlias string `json:"service_alias"` Logger event.Logger `json:"logger"` EventID string `json:"event_id"` Operator string `json:"operator"` DeployVersion string `json:"deploy_version"` TenantID string `json:"tenant_id"` ServiceID string `json:"service_id"` Action string `json:"action"` TGZPath string SlugInfo struct { SlugPath string `json:"slug_path"` FTPHost string `json:"ftp_host"` FTPPort string `json:"ftp_port"` FTPUser string `json:"ftp_username"` FTPPassword string `json:"ftp_password"` } `json:"slug_info"` }
MarketSlugItem MarketSlugItem
func NewMarketSlugItem ¶
func NewMarketSlugItem(in []byte) (*MarketSlugItem, error)
NewMarketSlugItem 创建实体
func (*MarketSlugItem) UpdateVersionInfo ¶
func (i *MarketSlugItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error
UpdateVersionInfo 更新任务执行结果
type PluginShareItem ¶
type PluginShareItem struct { string `json:"hub_url"` HubUser string `json:"hub_user"` HubPassword string `json:"hub_password"` Namespace string `json:"namespace"` IsTrust bool `json:"is_trust,omitempty"` } `json:"image_info,omitempty"` }HubURL
PluginShareItem PluginShareItem
func (*PluginShareItem) ErrorCallBack ¶
func (i *PluginShareItem) ErrorCallBack(err error)
ErrorCallBack if run error will callback
func (*PluginShareItem) GetLogger ¶
func (i *PluginShareItem) GetLogger() event.Logger
GetLogger GetLogger
type RegionServiceSnapshot ¶
type RegionServiceSnapshot struct { ServiceID string Service *dbmodel.TenantServices ServiceProbe []*dbmodel.TenantServiceProbe LBMappingPort []*dbmodel.TenantServiceLBMappingPort ServiceEnv []*dbmodel.TenantServiceEnvVar ServiceLabel []*dbmodel.TenantServiceLable ServiceMntRelation []*dbmodel.TenantServiceMountRelation PluginRelation []*dbmodel.TenantServicePluginRelation ServiceRelation []*dbmodel.TenantServiceRelation ServiceStatus string ServiceVolume []*dbmodel.TenantServiceVolume ServicePort []*dbmodel.TenantServicesPort Versions []*dbmodel.VersionInfo }
RegionServiceSnapshot RegionServiceSnapshot
type RestoreResult ¶
type RestoreResult struct { Status string `json:"status"` Message string `json:"message"` CreateTime time.Time `json:"create_time"` ServiceChange map[string]*Info `json:"service_change"` BackupID string `json:"backup_id"` RestoreMode string `json:"restore_mode"` EventID string `json:"event_id"` RestoreID string `json:"restore_id"` CacheDir string `json:"cache_dir"` }
RestoreResult RestoreResult
type Service ¶
type Service struct { Image string `yaml:"image"` ContainerName string `yaml:"container_name,omitempty"` Restart string `yaml:"restart,omitempty"` NetworkMode string `yaml:"network_mode,omitempty"` Volumes []string `yaml:"volumes,omitempty"` Command string `yaml:"command,omitempty"` Environment map[string]string `yaml:"environment,omitempty"` Loggin struct { Driver string `yaml:"driver,omitempty"` Options struct { MaxSize string `yaml:"max-size,omitempty"` MaxFile string `yaml:"max-file,omitempty"` } } `yaml:"logging,omitempty"` }
Service service
type ServiceCheckInput ¶
type ServiceCheckInput struct { CheckUUID string `json:"uuid"` //检测来源类型 SourceType string `json:"source_type"` // 检测来源定义, // 代码: https://github.com/shurcooL/githubql.git master // docker-run: docker run --name xxx nginx:latest nginx // docker-compose: compose全文 SourceBody string `json:"source_body"` Username string `json:"username"` Password string `json:"password"` TenantID string EventID string `json:"event_id"` }
ServiceCheckInput 任务输入数据
type ServiceCheckResult ¶
type ServiceCheckResult struct { //检测状态 Success Failure CheckStatus string `json:"check_status"` ErrorInfos parser.ParseErrorList `json:"error_infos"` ServiceInfo []parser.ServiceInfo `json:"service_info"` }
ServiceCheckResult 应用检测结果
func CreateResult ¶
func CreateResult(ErrorInfos parser.ParseErrorList, ServiceInfo []parser.ServiceInfo) (ServiceCheckResult, error)
CreateResult 创建检测结果
type ShareStatus ¶
type ShareStatus struct {}
ShareStatus share status result ShareStatus share status result
func (ShareStatus) String ¶
func (s ShareStatus) String() string
type SlugShareItem ¶
type SlugShareItem struct { string `json:"service_key" ` AppVersion string `json:"app_version" ` EventID string `json:"event_id"` ShareUser string `json:"share_user"` ShareScope string `json:"share_scope"` SlugInfo struct { Namespace string `json:"namespace"` FTPHost string `json:"ftp_host"` FTPPort string `json:"ftp_port"` FTPUser string `json:"ftp_username"` FTPPassword string `json:"ftp_password"` } `json:"slug_info,omitempty"` } `json:"share_info"` }ServiceKey
SlugShareItem SlugShareItem
func NewSlugShareItem ¶
func NewSlugShareItem(in []byte, etcdCli *clientv3.Client) (*SlugShareItem, error)
NewSlugShareItem 创建实体
func (*SlugShareItem) CheckMD5FileExist ¶
func (i *SlugShareItem) CheckMD5FileExist(md5path, packageName string) bool
CheckMD5FileExist CheckMD5FileExist
func (*SlugShareItem) ShareToLocal ¶
func (i *SlugShareItem) ShareToLocal() error
ShareToLocal ShareToLocal
func (*SlugShareItem) UpdateShareStatus ¶
func (i *SlugShareItem) UpdateShareStatus(status string) error
UpdateShareStatus 更新任务执行结果
type SourceCodeBuildItem ¶
type SourceCodeBuildItem struct { Namespace string `json:"namespace"` TenantName string `json:"tenant_name"` ServiceAlias string `json:"service_alias"` Action string `json:"action"` DestImage string `json:"dest_image"` Logger event.Logger `json:"logger"` EventID string `json:"event_id"` CacheDir string `json:"cache_dir"` //SourceDir string `json:"source_dir"` TGZDir string `json:"tgz_dir"` DockerClient *client.Client TenantID string ServiceID string DeployVersion string Lang string Runtime string BuildEnvs map[string]string CodeSouceInfo sources.CodeSourceInfo RepoInfo *sources.RepostoryBuildInfo // contains filtered or unexported fields }
SourceCodeBuildItem SouceCodeBuildItem
func NewSouceCodeBuildItem ¶
func NewSouceCodeBuildItem(in []byte) *SourceCodeBuildItem
NewSouceCodeBuildItem create
func (*SourceCodeBuildItem) IsDockerfile ¶
func (i *SourceCodeBuildItem) IsDockerfile() bool
IsDockerfile CheckDockerfile
func (*SourceCodeBuildItem) Run ¶
func (i *SourceCodeBuildItem) Run(timeout time.Duration) error
Run Run
func (*SourceCodeBuildItem) UpdateBuildVersionInfo ¶
func (i *SourceCodeBuildItem) UpdateBuildVersionInfo(res *build.Response) error
UpdateBuildVersionInfo update service build version info to db
func (*SourceCodeBuildItem) UpdateCheckResult ¶
func (i *SourceCodeBuildItem) UpdateCheckResult(result *dbmodel.CodeCheckResult) error
UpdateCheckResult UpdateCheckResult
func (*SourceCodeBuildItem) UpdateVersionInfo ¶
func (i *SourceCodeBuildItem) UpdateVersionInfo(vi *dbmodel.VersionInfo) error
UpdateVersionInfo Update build application service version info
type TaskWorker ¶
type TaskWorker interface { Run(timeout time.Duration) error GetLogger() event.Logger Name() string Stop() error //ErrorCallBack if run error will callback ErrorCallBack(err error) }
TaskWorker worker interface
func BackupAPPNewCreater ¶
func BackupAPPNewCreater(in []byte, m *exectorManager) (TaskWorker, error)
BackupAPPNewCreater create
func BackupAPPRestoreCreater ¶
func BackupAPPRestoreCreater(in []byte, m *exectorManager) (TaskWorker, error)
BackupAPPRestoreCreater create
func NewExportApp ¶
func NewExportApp(in []byte, m *exectorManager) (TaskWorker, error)
NewExportApp create
func NewImportApp ¶
func NewImportApp(in []byte, m *exectorManager) (TaskWorker, error)
NewImportApp create
func SharePluginItemCreater ¶
func SharePluginItemCreater(in []byte, m *exectorManager) (TaskWorker, error)
SharePluginItemCreater create