Documentation ¶
Index ¶
- Constants
- Variables
- type AppEntity
- func (t *AppEntity) FormatKey(app, pkgName string) string
- func (t *AppEntity) FormatLocalVersionPackagePath(pkgName string) string
- func (t *AppEntity) FormatRemoteVersionPackagePath(pkgName string) string
- func (t *AppEntity) FormatRemoteVersionPackageWorkspace(pkgName string) string
- func (t *AppEntity) FormatTemporaryBuildPath(buildId int64) string
- func (t *AppEntity) FormatVersionPackageName(buildId int64, branch, commit string) string
- func (t *AppEntity) GenLocalVersionPackagePath(buildId int64, branch, commit string) string
- type AuditEntity
- type BaseEntity
- type BuildEntity
- type ClusterEntity
- type DeploymentEntity
- type EnvEntity
- type Event
- type JobEntity
- type JobStepEntity
- type MemberEntity
- type NotifyConfig
- type PkgEntity
- type PkgStorageConfig
- type PkgStorageConfigLocal
- type PkgStorageConfigOss
- type ProjectEntity
- type ProjectRoleEntity
- type ProjectRolePermEntity
- type SystemEntity
- type UserEntity
Constants ¶
View Source
const ( REPO_TYPE_GIT = "git" REPO_TYPE_SVN = "svn" )
View Source
const ( AUDIT_STATUS_WAITING = 10 AUDIT_STATUS_PASS = DEPLOYMENT_STATUS_AUDIT_PASS AUDIT_STATUS_REJECT = DEPLOYMENT_STATUS_AUDIT_REJECT AUDIT_STATUS_CANCELED = DEPLOYMENT_STATUS_CANCELED )
View Source
const ( BUILD_STATUS_CREATED = 10 BUILD_STATUS_BUIDING = 20 BUILD_STATUS_BUILD_SUCC = 30 BUILD_STATUS_BUILD_FAILED = 40 BUILD_STATUS_PACK_SUCC = 50 BUILD_STATUS_PACK_FAILED = 60 BUILD_STATUS_PKG_PUSH_SUCC = 70 BUILD_STATUS_PKG_PUSH_FAILED = 80 )
View Source
const ( FILE_DEPLOY_MODE_FULL = 1 FILE_DEPLOY_MODE_DELTA = 2 DEPLOYMENT_STATUS_CREATED = 10 DEPLOYMENT_STATUS_NO_AUDIT = 20 DEPLOYMENT_STATUS_WAIT_AUDIT = 30 DEPLOYMENT_STATUS_AUDIT_PASS = 40 DEPLOYMENT_STATUS_AUDIT_REJECT = 50 DEPLOYMENT_STATUS_CANCELED = 60 DEPLOYMENT_STATUS_DEALING = 70 DEPLOYMENT_STATUS_SUCC = 80 DEPLOYMENT_STATUS_FAILED = 90 )
View Source
const ( JOB_STATUS_CREATED = 10 JOB_STATUS_READY = 20 JOB_STATUS_DEALING = 30 JOB_STATUS_SUCC = 40 JOB_STATUS_FAILED = 50 )
View Source
const ( JOB_STEP_STATUS_DEALING = 10 JOB_STEP_STATUS_SUCC = 20 JOB_STEP_STATUS_FAILED = 30 // JOB_STEPS JOB_STEP_INIT_WORKSPACE = 10 JOB_STEP_SYNC_VERISON_PACKAGE = 20 JOB_STEP_UNPACK_VERISON_PACKAGE = 30 JOB_STEP_CMD_BEFORE_DEPLOY = 40 JOB_STEP_DO_DEPLOY = 50 JOB_STEP_CMD_AFTER_DEPLOY = 60 JOB_STEP_CMD_HEALTH_CHECK = 70 JOB_STEP_CMD_ONLINE = 80 JOB_STEP_END_CLEAN = 90 )
View Source
const ( // project permission PERM_PROJECT_CREATE = "project.create" PERM_PROJECT_UPDATE = "project.update" // project member permissions PERM_MEMBER_ADD = "member.add" PERM_MEMBER_REMOVE = "member.remove" // tips: change other member's role PERM_MEMBER_CHANGE_ROLE = "member.change.role" // app permissions PERM_APP_CREATE = "app.create" PERM_APP_UPDATE = "app.update" PERM_APP_DELETE = "app.delete" // app's env permission PERM_ENV_CREATE = "env.create" PERM_ENV_UPDATE = "env.update" PERM_ENV_DELETE = "env.delete" // permission to configure environment's audit // and permission pass or reject the environment's deployments PERM_ENV_AUDIT = "env.audit" // app's cluster permissions PERM_CLUSTER_CREATE = "cluster.create" PERM_CLUSTER_UPDATE = "cluster.update" PERM_CLUSTER_DELETE = "cluster.delete" // deployment's permissions PERM_DEPLOYMENT_CREAET = "deployment.create" )
View Source
const ( // if git url is http(s), need to check which auth type is configured. // if git url is SSH, use host's ssh public key and no need to check auth type. GIT_CI_AUTH_TYPE_BASIC = 1 GIT_CI_AUTH_TYPE_TOKEN = 2 PKG_STORAGE_TYPE_LOCAL = "local" PKG_STORAGE_TYPE_OSS = "oss" PKG_STORAGE_TYPE_COS = "cos" PKG_STORAGE_TYPE_AWS_S3 = "aws-s3" )
View Source
const ( ROLE_ADMIN = "admin" ROLE_USER = "user" )
Variables ¶
View Source
var InitEnvs = []string{ lang.I("env.dev"), lang.I("env.test"), lang.I("env.staging"), lang.I("env.prod"), }
init environments while create app
View Source
var PERM_LABELS = map[string]string{ PERM_PROJECT_CREATE: lang.I("project.create"), PERM_PROJECT_UPDATE: lang.I("project.update"), PERM_MEMBER_ADD: lang.I("member.add"), PERM_MEMBER_REMOVE: lang.I("member.remove"), PERM_MEMBER_CHANGE_ROLE: lang.I("member.change.role"), PERM_APP_CREATE: lang.I("app.create"), PERM_APP_UPDATE: lang.I("app.update"), PERM_APP_DELETE: lang.I("app.delete"), PERM_ENV_CREATE: lang.I("env.create"), PERM_ENV_UPDATE: lang.I("env.update"), PERM_ENV_DELETE: lang.I("env.delete"), PERM_ENV_AUDIT: lang.I("env.audit"), PERM_CLUSTER_CREATE: lang.I("cluster.create"), PERM_CLUSTER_UPDATE: lang.I("cluster.update"), PERM_CLUSTER_DELETE: lang.I("cluster.delete"), PERM_DEPLOYMENT_CREAET: lang.I("deployment.create"), }
permission labels
Functions ¶
This section is empty.
Types ¶
type AppEntity ¶
type AppEntity struct { BaseEntity Uid int64 `json:"uid"` ProjectId int64 `json:"project_id"` Name string `json:"name"` Description string `json:"description"` DeployType int `json:"deploy_type"` AppType int `json:"app_type"` AppConfig string `json:"app_config"` CmdBuild string `json:"cmd_build"` RepoUrl string `json:"repo_url"` RepoUsername string `json:"repo_username"` RepoPassword string `json:"repo_password"` PublicKey string `json:"public_key"` RepoType string `json:"repo_type"` LocalRepoWorkspace string `json:"local_repo_workspace"` LocalBuildWorkspace string `json:"local_build_workspace"` LocalPkgWorkspace string `json:"local_pkg_workspace"` Excludes string `json:"excludes"` Files string `json:"files"` CmdBeforeDeploy string `json:"cmd_before_deploy"` CmdAfterDeploy string `json:"cmd_after_deploy"` CmdHealthCheck string `json:"cmd_health_check"` CmdOnline string `json:"cmd_online"` CmdTimeout int `json:"cmd_timeout"` CmdGetPid string `json:"cmd_get_pid"` DeployUser string `json:"deploy_user"` DeployPath string `json:"deploy_path"` RemotePkgWorkspace string `json:"remote_pkg_workspace"` }
func (*AppEntity) FormatKey ¶
format package file name key for package repository, e.g: oss/cos/aws s3
func (*AppEntity) FormatLocalVersionPackagePath ¶
format local version package path, e.g: /data/nvwa/demo-01/....tar.gz
func (*AppEntity) FormatRemoteVersionPackagePath ¶
format remote version package path, e.g:/data/nvwa/demo-01/{pkgName}
func (*AppEntity) FormatRemoteVersionPackageWorkspace ¶
format remote version package workspace, e.g:/data/nvwa/demo-01/{version}/
func (*AppEntity) FormatTemporaryBuildPath ¶
format temporary build path
func (*AppEntity) FormatVersionPackageName ¶
format version package name
type AuditEntity ¶
type BaseEntity ¶
type BuildEntity ¶
type BuildEntity struct { BaseEntity AppId int64 `json:"app_id"` Uid int64 `json:"uid"` Branch string `json:"branch"` Tag string `json:"tag"` CommitId string `json:"commit_id"` PackageName string `json:"package_name"` JenkinsBuildNum int `json:"jenkins_build_num"` Log string `json:"log"` Notified bool `json:"notified"` Status int `json:"status"` }
type ClusterEntity ¶
type DeploymentEntity ¶
type DeploymentEntity struct { BaseEntity ProjectId int64 `json:"project_id"` AppId int64 `json:"app_id"` Uid int64 `json:"uid"` EnvId int64 `json:"env_id"` PkgId int64 `json:"pkg_id"` Pkg string `json:"pkg"` ClusterIds string `json:"cluster_ids"` ClusterHosts string `json:"cluster_hosts"` IsAutoDeploy bool `json:"is_auto_deploy"` IsAllCluster bool `json:"is_all_cluster"` LinkId string `json:"link_id"` Branch string `json:"branch"` CommitId string `json:"commit_id"` FileList string `json:"file_list"` FileDeployMode int `json:"file_deploy_mode"` LatestLinkId string `json:"latest_link_id"` IsNeedAudit bool `json:"is_need_audit"` Status int `json:"status"` }
func (*DeploymentEntity) GetVersion ¶
func (t *DeploymentEntity) GetVersion() string
type Event ¶
type Event struct { BaseEntity ProjectId int64 `json:"project_id"` AppId int64 `json:"app_id"` Uid int64 `json:"uid"` Content int `json:"content"` }
type JobEntity ¶
type JobEntity struct { BaseEntity DeploymentId int64 `json:"deployment_id"` AppId int64 `json:"app_id"` EnvId int64 `json:"env_id"` ClusterId int64 `json:"cluster_id"` AllHosts string `json:"all_hosts"` DeployHosts string `json:"deploy_hosts"` ExcludeHosts string `json:"exclude_hosts"` Status int `json:"status"` }
type JobStepEntity ¶
type MemberEntity ¶
type MemberEntity struct { BaseEntity ProjectId int64 `json:"project_id"` Uid int64 `json:"uid"` ProjectRoleId int64 `json:"project_role_id"` }
type NotifyConfig ¶
type PkgStorageConfig ¶
type PkgStorageConfig struct { // local config Local *PkgStorageConfigLocal `json:",omitempty"` // oss config Oss *PkgStorageConfigOss `json:"oss,omitempty"` }
type PkgStorageConfigLocal ¶
type PkgStorageConfigLocal struct{}
type PkgStorageConfigOss ¶
type ProjectEntity ¶
type ProjectEntity struct { BaseEntity Name string `json:"name"` Description string `json:"description"` Uid int64 `json:"uid"` }
type ProjectRoleEntity ¶
type ProjectRoleEntity struct { BaseEntity Name string `json:"name"` }
type ProjectRolePermEntity ¶
type ProjectRolePermEntity struct { BaseEntity ProjectRoleId int64 `json:"project_role_id"` Perm string `json:"perm"` }
type SystemEntity ¶
type SystemEntity struct { BaseEntity Version string `json:"version"` PkgRootPath string `json:"pkg_root_path"` DeployRootPath string `json:"deploy_root_path"` CustomDeployPath bool `json:"custom_deploy_path"` DeployUser string `json:"deploy_user"` CustomDeployUser bool `json:"custom_deploy_user"` PkgLimit int `json:"pkg_limit"` DefaultProjectRoleId int `json:"default_project_role_id"` UseJenkins bool `json:"use_jenkins"` JenkinsUrl string `json:"jenkins_url"` JenkinsTemplate string `json:"jenkins_template"` JenkinsCredentialId string `json:"jenkins_credential_id"` JenkinsUser string `json:"jenkins_user"` JenkinsPassword string `json:"jenkins_password"` RepoRootPath string `json:"repo_root_path"` PkgStorageType string `json:"pkg_storage_type"` PkgStorageConfig string `json:"pkg_storage_config"` GitCIAuthType int `json:"git_ci_auth_type"` GitCIUser string `json:"git_ci_user"` GitCIPassword string `json:"git_ci_password"` GitCIToken string `json:"git_ci_token"` NotifyEnableTypes string `json:"notify_enable_types"` NotifyConfig string `json:"notify_config"` }
func (*SystemEntity) DecodePkgStorageConfig ¶
func (t *SystemEntity) DecodePkgStorageConfig() (*PkgStorageConfig, error)
Decode PkgStorageConfig
func (*SystemEntity) FormatJenkinsTemplate ¶
func (t *SystemEntity) FormatJenkinsTemplate(app *AppEntity) (string, error)
type UserEntity ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.