Documentation ¶
Index ¶
- type Archive
- type ArtifactInfo
- type ArtifactPackagerContext
- type Commit
- type Config
- type Container
- type Context
- type CustomYaml
- type DockerRegistry
- type EnvConfig
- type EnvStatus
- type EnvVar
- type Error
- type Failure
- type GUIConfig
- type GinkgoTest
- type Git
- type HelmChart
- type ImagePathSpec
- type Install
- type ItReport
- type Notify
- type PerformanceTestSuite
- type PipelineStatusCtx
- type PmHealthCheck
- type Port
- type PredatorContext
- type Product
- type ProductAuth
- type Proxy
- type RenderChart
- type RenderKV
- type RenderSet
- type Repo
- type Service
- type ServiceTmpl
- type Skipped
- type Spec
- type TestCase
- type TestReport
- type TestSuite
- type TestSuiteSummary
- type TestSuites
- type YamlPreview
- type YamlPreviewForPorts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Archive ¶
type Archive struct { Dir string `yaml:"dir"` File string `yaml:"file"` TestReportFile string `yaml:"test_report_file"` }
Archive ...
type ArtifactInfo ¶ added in v1.6.0
type ArtifactPackagerContext ¶ added in v1.8.0
type ArtifactPackagerContext struct { JobType string `yaml:"job_type"` ProgressFile string `yaml:"progress_file"` Images []*task.ImagesByService `yaml:"images"` SourceRegistries []*DockerRegistry `yaml:"source_registries"` TargetRegistries []*DockerRegistry `yaml:"target_registries"` }
type Commit ¶
type Commit struct { SHA string `bson:"sha" json:"sha"` Message string `bson:"message" json:"message"` }
Commit ...
type Config ¶
type Config struct { ConfigName string `bson:"config_name" json:"config_name"` Revision int64 `bson:"revision" json:"revision"` }
Config ...
type Container ¶
type Container struct { Name string `bson:"name" json:"name"` Image string `bson:"image" json:"image"` ImagePath *ImagePathSpec `bson:"image_path,omitempty" json:"imagePath,omitempty"` }
Container ...
type Context ¶
type Context struct { // API token 服务访问使用的api token APIToken string `yaml:"api_token"` // Workspace 容器工作目录 [必填] Workspace string `yaml:"workspace"` // TODO: Deprecated. // CleanWorkspace 是否清理工作目录 [选填, 默认为 false] CleanWorkspace bool `yaml:"clean_workspace"` // Paths 执行脚本Path Paths string `yaml:"-"` // Proxy 翻墙配置信息 Proxy *Proxy `yaml:"proxy"` // Envs 用户注入环境变量, 包括安装脚本环境变量 [optional] Envs EnvVar `yaml:"envs"` // SecretEnvs 用户注入敏感信息环境变量, value不能在stdout stderr中输出 [optional] SecretEnvs EnvVar `yaml:"secret_envs"` // Installs 安装程序脚本 [optional] Installs []*Install `yaml:"installs"` // Repos 用户需要下载的repos Repos []*Repo `yaml:"repos"` // Scripts 执行主要编译脚本 Scripts []string `yaml:"scripts"` // PostScripts 后置编译脚本 PostScripts []string `yaml:"post_scripts"` // PMDeployScripts 物理机部署脚本 PMDeployScripts []string `yaml:"pm_deploy_scripts"` // SSH ssh连接参数 SSHs []*task.SSH `yaml:"sshs"` // GinkgoTest 执行 ginkgo test 配置 GinkgoTest *GinkgoTest `yaml:"ginkgo_test"` // Archive: 归档配置 [optional] Archive *Archive `yaml:"archive"` // DockerRegistry: 镜像仓库配置 [optional] DockerRegistry *DockerRegistry `yaml:"docker_registry"` // DockerBuildContext image 构建context DockerBuildCtx *task.DockerBuildCtx `yaml:"docker_build_ctx"` // FileArchiveCtx 二进制包构建 FileArchiveCtx *task.FileArchiveCtx `yaml:"file_archive_ctx"` // Git Github/Gitlab 配置 Git *Git `yaml:"git"` // Caches Caches配置 Caches []string `yaml:"caches"` // testType TestType string `yaml:"test_type"` // Classic build ClassicBuild bool `yaml:"classic_build"` // StorageURI StorageURI string `yaml:"storage_uri"` // PipelineName PipelineName string `yaml:"pipeline_name"` // TaskID TaskID int64 `yaml:"task_id"` // ServiceName ServiceName string `yaml:"service_name"` // ResetCache ignore workspace cache [runtime] ResetCache bool `yaml:"reset_cache"` // IgnoreCache ignore docker build cache [runtime] IgnoreCache bool `yaml:"ignore_cache"` StorageEndpoint string `yaml:"storage_endpoint"` StorageAK string `yaml:"storage_ak"` StorageSK string `yaml:"storage_sk"` StorageBucket string `yaml:"storage_bucket"` StorageProvider int8 `yaml:"storage_provider"` StorageRegion string `yaml:"storage_region"` ArtifactInfo *ArtifactInfo `yaml:"artifact_info"` ArtifactPath string `yaml:"artifact_path"` AesKey string `yaml:"aes_key"` // New since V1.10.0. CacheEnable bool `yaml:"cache_enable"` Cache types.Cache `yaml:"cache"` CacheDirType types.CacheDirType `yaml:"cache_dir_type"` CacheUserDir string `yaml:"cache_user_dir"` // Upload To S3 related context UploadEnabled bool `yaml:"upload_enabled"` UploadStorageInfo *types.ObjectStorageInfo `yaml:"upload_storage_info"` UploadInfo []*types.ObjectStoragePathDetail `yaml:"upload_info"` // scanner used flag ScannerFlag bool `yaml:"scanner_flag"` ScannerType string `yaml:"scanner_type"` SonarParameter string `yaml:"sonar_parameter"` SonarServer string `yaml:"sonar_server"` SonarLogin string `yaml:"sonar_login"` SonarCheckQualityGate bool `yaml:"sonar_check_quality_gate"` }
Context ...
type CustomYaml ¶ added in v1.6.0
type DockerRegistry ¶
type DockerRegistry struct { RegistryID string `yaml:"registry_id"` Host string `yaml:"host"` Namespace string `yaml:"namespace"` UserName string `yaml:"username"` Password string `yaml:"password"` }
DockerRegistry 推送镜像到 docker registry 配置
type EnvStatus ¶
type EnvStatus struct { HostID string `bson:"host_id,omitempty" json:"host_id"` EnvName string `bson:"env_name,omitempty" json:"env_name"` Address string `bson:"address,omitempty" json:"address"` Status string `bson:"status,omitempty" json:"status"` PmHealthCheck *PmHealthCheck `bson:"health_checks,omitempty" json:"health_checks"` }
type GUIConfig ¶
type GUIConfig struct { Deployment interface{} `bson:"deployment,omitempty" json:"deployment,omitempty"` Ingress interface{} `bson:"ingress,omitempty" json:"ingress,omitempty"` Service interface{} `bson:"service,omitempty" json:"service,omitempty"` }
type GinkgoTest ¶
type GinkgoTest struct { ResultPath string `yaml:"result_path"` TestReportPath string `yaml:"test_report_path"` ArtifactPaths []string `yaml:"artifact_paths"` }
GinkgoTest ...
type Git ¶
type Git struct { UserName string `yaml:"username"` Email string `yaml:"email"` GithubHost string `yaml:"github_host"` GithubSSHKey string `yaml:"github_ssh_key"` GitlabHost string `yaml:"gitlab_host"` // encoded in base64 GitlabSSHKey string `yaml:"gitlab_ssh_key"` GitKnownHost string `yaml:"git_known_host"` }
Git ...
type ImagePathSpec ¶ added in v1.5.0
type ImagePathSpec struct { Repo string `bson:"repo,omitempty" json:"repo,omitempty"` Image string `bson:"image,omitempty" json:"image,omitempty"` Tag string `bson:"tag,omitempty" json:"tag,omitempty"` }
ImagePathSpec paths in yaml used to parse image
type Install ¶
type Install struct { // 安装名称 Name string `yaml:"name"` // 安装版本 Version string `yaml:"version"` // 安装脚本 Scripts []string `yaml:"scripts"` // 可执行文件目录 BinPath string `yaml:"bin_path"` // Optional: 安装脚本环境变量 Envs EnvVar `yaml:"envs"` // 安装包位置 Download string `yaml:"download"` }
Install ...
type ItReport ¶
type ItReport struct { PipelineName string `bson:"pipeline_name" json:"pipeline_name"` PipelineTaskID int64 `bson:"pipeline_task_id" json:"pipeline_task_id"` TestName string `bson:"test_name" json:"test_name"` TestJobName string `bson:"test_job_name" json:"test_job_name"` TestSuiteSummary TestSuiteSummary `bson:"testsuite" json:"testsuite"` PerformanceTestSuite []*PerformanceTestSuite `bson:"performace_test_suite" json:"performace_test_suite"` Created int64 `bson:"create,omitempty" json:"create,omitempty"` Error string `bson:"error,omitempty" json:"error,omitempty"` }
type Notify ¶
type Notify struct { //ID bson.ObjectId `bson:"_id" json:"id"` // 主键 Type config.NotifyType `bson:"type" json:"type"` // 消息类型 Receiver string `bson:"receiver" json:"receiver"` // 发送者 Content interface{} `bson:"content" json:"content"` // 消息内容 CreateTime int64 `bson:"create_time" json:"create_time"` // 消息创建时间 IsRead bool `bson:"is_read" json:"is_read"` // 是否已读 }
type PerformanceTestSuite ¶
type PerformanceTestSuite struct { Label string `bson:"label" json:"label"` Samples string `bson:"samples" json:"samples"` Average string `bson:"average" json:"average"` Min string `bson:"min" json:"min"` Max string `bson:"max" json:"max"` Line string `bson:"line" json:"line"` StdDev string `bson:"std_dev" json:"stdDev"` Error string `bson:"error" json:"error"` Throughput string `bson:"throughput" json:"throughput"` ReceivedKb string `bson:"received_kb" json:"receivedKb"` AvgByte string `bson:"avg_byte" json:"avgByte"` }
type PipelineStatusCtx ¶
type PipelineStatusCtx struct { TaskID int64 `bson:"task_id" json:"task_id"` ProductName string `bson:"product_name" json:"product_name"` PipelineName string `bson:"pipeline_name" json:"pipeline_name"` Type config.PipelineType `bson:"type" json:"type"` Status config.Status `bson:"status" json:"status,omitempty"` TeamName string `bson:"team" json:"team"` Stages []*common.Stage `bson:"stages" json:"stages"` }
// AnnouncementCtx ...
type AnnouncementCtx struct { Title string `bson:"title" json:"title"` // 公告标题 Priority int `bson:"priority" json:"priority"` // 公告级别 Content string `bson:"content" json:"content"` // 公告内容 StartTime int64 `bson:"start_time" json:"start_time"` // 公告开始时间 EndTime int64 `bson:"end_time" json:"end_time"` // 公告结束时间 }
PipelineStatusCtx ...
type PmHealthCheck ¶
type PmHealthCheck struct { Protocol string `bson:"protocol,omitempty" json:"protocol,omitempty"` Port int `bson:"port,omitempty" json:"port,omitempty"` Path string `bson:"path,omitempty" json:"path,omitempty"` TimeOut int64 `bson:"time_out,omitempty" json:"time_out,omitempty"` Interval uint64 `bson:"interval,omitempty" json:"interval,omitempty"` HealthyThreshold int `bson:"healthy_threshold,omitempty" json:"healthy_threshold,omitempty"` UnhealthyThreshold int `bson:"unhealthy_threshold,omitempty" json:"unhealthy_threshold,omitempty"` CurrentHealthyNum int `bson:"current_healthy_num,omitempty" json:"current_healthy_num,omitempty"` CurrentUnhealthyNum int `bson:"current_unhealthy_num,omitempty" json:"current_unhealthy_num,omitempty"` }
type PredatorContext ¶
type PredatorContext struct { JobType string `yaml:"job_type"` DockerRegistry *DockerRegistry `yaml:"docker_registry"` DockerBuildCtx *task.DockerBuildCtx `yaml:"build_ctx"` OnSetup string `yaml:"setup,omitempty"` ReleaseImages []task.RepoImage `yaml:"release_images"` DistributeInfo []*task.DistributeInfo `yaml:"distribute_info"` }
type Product ¶
type Product struct { //ID bson.ObjectId `bson:"_id,omitempty" json:"id"` ProductName string `bson:"product_name" json:"product_name"` CreateTime int64 `bson:"create_time" json:"create_time"` UpdateTime int64 `bson:"update_time" json:"update_time"` Namespace string `bson:"namespace,omitempty" json:"namespace,omitempty"` Status string `bson:"status" json:"status"` Revision int64 `bson:"revision" json:"revision"` Enabled bool `bson:"enabled" json:"enabled"` EnvName string `bson:"env_name" json:"env_name"` UpdateBy string `bson:"update_by" json:"update_by"` Auth []*ProductAuth `bson:"auth" json:"auth"` Visibility string `bson:"-" json:"visibility"` Services [][]*Service `bson:"services" json:"services"` Render *task.RenderInfo `bson:"render" json:"render"` Error string `bson:"error" json:"error"` Vars []*RenderKV `bson:"vars,omitempty" json:"vars,omitempty"` ChartInfos []*RenderChart `bson:"-" json:"chart_infos,omitempty"` IsPublic bool `bson:"is_public" json:"isPublic"` RoleIDs []int64 `bson:"role_ids" json:"roleIds"` ClusterID string `bson:"cluster_id,omitempty" json:"cluster_id,omitempty"` RecycleDay int `bson:"recycle_day" json:"recycle_day"` Source string `bson:"source" json:"source"` ServiceDeployStrategy map[string]string `bson:"service_deploy_strategy" json:"service_deploy_strategy"` // used for cache //KubeClient kubecli.Client `bson:"-" json:"-"` //HelmClient helmclient.Client `bson:"-" json:"-"` // TODO: temp flag IsForkedProduct bool `bson:"-" json:"-"` }
func (*Product) GetServiceMap ¶ added in v1.7.1
type ProductAuth ¶
type ProductAuth struct { Type config.ProductAuthType `bson:"type" json:"type"` Name string `bson:"name" json:"name"` Permissions []config.ProductPermission `bson:"permissions" json:"permissions"` }
type Proxy ¶
type Proxy struct { Type string `yaml:"type"` Address string `yaml:"address"` Port int `yaml:"port"` NeedPassword bool `yaml:"need_password"` Username string `yaml:"username"` Password string `yaml:"password"` EnableRepoProxy bool `yaml:"enable_repo_proxy"` EnableApplicationProxy bool `yaml:"enable_application_proxy"` }
Proxy 翻墙配置信息
func (*Proxy) GetProxyURL ¶
type RenderChart ¶
type RenderChart struct { ServiceName string `json:"service_name,omitempty"` ChartVersion string `json:"chart_version,omitempty"` ValuesYaml string `json:"values_yaml,omitempty"` OverrideYaml *CustomYaml `json:"override_yaml,omitempty"` OverrideValues string `json:"override_values,omitempty"` }
func (*RenderChart) GetOverrideYaml ¶ added in v1.5.0
func (rc *RenderChart) GetOverrideYaml() string
type RenderSet ¶
type RenderSet struct { // Name = EnvName == "" ? ProductTmpl : (EnvName + "-" + ProductTempl) Name string `bson:"name" json:"name"` Revision int64 `bson:"revision" json:"revision"` // 可以为空,空时为产品模板默认的渲染集,非空时为环境的渲染集 EnvName string `bson:"env_name,omitempty" json:"env_name,omitempty"` ProductTmpl string `bson:"product_tmpl" json:"product_tmpl"` Team string `bson:"team,omitempty" json:"team,omitempty"` UpdateTime int64 `bson:"update_time" json:"update_time"` UpdateBy string `bson:"update_by" json:"update_by"` IsDefault bool `bson:"is_default" json:"is_default"` // 是否是默认配置 DefaultValues string `bson:"default_values,omitempty" json:"default_values,omitempty"` //环境默认变量 ›yaml content //KVs []*RenderKV `bson:"kvs,omitempty" json:"kvs,omitempty"` ChartInfos []*RenderChart `bson:"chart_infos,omitempty" json:"chart_infos,omitempty"` Description string `bson:"description,omitempty" json:"description,omitempty"` }
RenderSet ...
type Repo ¶
type Repo struct { Source string `yaml:"source"` Address string `yaml:"address"` Owner string `yaml:"owner"` Namespace string `yaml:"namespace"` Name string `yaml:"name"` RemoteName string `yaml:"remote_name"` Branch string `yaml:"branch"` PR int `yaml:"pr"` PRs []int `yaml:"prs"` Tag string `yaml:"tag"` CheckoutPath string `yaml:"checkout_path"` SubModules bool `yaml:"submodules"` OauthToken string `yaml:"oauthToken"` User string `yaml:"username"` Password string `yaml:"password"` CheckoutRef string `yaml:"checkout_ref"` EnableProxy bool `yaml:"enable_proxy"` AuthType types.AuthType `yaml:"auth_type,omitempty"` SSHKey string `yaml:"ssh_key,omitempty"` PrivateAccessToken string `yaml:"private_access_token,omitempty"` }
Repo ...
func (*Repo) PRRef ¶
PRRef returns refs format It will check repo provider type, by default returns github refs format.
e.g. github returns refs/pull/1/head e.g. gitlab returns merge-requests/1/head
type Service ¶
type Service struct { ServiceName string `bson:"service_name" json:"service_name"` Type string `bson:"type" json:"type"` Revision int64 `bson:"revision" json:"revision"` Containers []*Container `bson:"containers" json:"containers,omitempty"` Configs []*Config `bson:"configs,omitempty" json:"configs,omitempty"` Render *task.RenderInfo `bson:"render,omitempty" json:"render,omitempty"` // 记录每个服务render信息 便于更新单个服务 EnvConfigs []*EnvConfig `bson:"-" json:"env_configs,omitempty"` }
type ServiceTmpl ¶
type ServiceTmpl struct { ServiceName string `bson:"service_name" json:"service_name"` Type string `bson:"type" json:"type"` Team string `bson:"team,omitempty" json:"team,omitempty"` ProductName string `bson:"product_name" json:"product_name"` Revision int64 `bson:"revision" json:"revision"` Source string `bson:"source,omitempty" json:"source,omitempty"` GUIConfig *GUIConfig `bson:"gui_config,omitempty" json:"gui_config,omitempty"` Yaml string `bson:"yaml,omitempty" json:"yaml"` SrcPath string `bson:"src_path,omitempty" json:"src_path,omitempty"` Commit *Commit `bson:"commit,omitempty" json:"commit,omitempty"` KubeYamls []string `bson:"-" json:"-"` Hash string `bson:"hash256,omitempty" json:"hash256,omitempty"` CreateTime int64 `bson:"create_time" json:"create_time"` CreateBy string `bson:"create_by" json:"create_by"` Containers []*Container `bson:"containers,omitempty" json:"containers,omitempty"` Description string `bson:"description,omitempty" json:"description,omitempty"` Visibility string `bson:"visibility,omitempty" json:"visibility,omitempty"` Status string `bson:"status,omitempty" json:"status,omitempty"` GerritRepoName string `bson:"gerrit_repo_name,omitempty" json:"gerrit_repo_name,omitempty"` GerritBranchName string `bson:"gerrit_branch_name,omitempty" json:"gerrit_branch_name,omitempty"` GerritRemoteName string `bson:"gerrit_remote_name,omitempty" json:"gerrit_remote_name,omitempty"` GerritPath string `bson:"gerrit_path,omitempty" json:"gerrit_path,omitempty"` GerritCodeHostID int `bson:"gerrit_codeHost_id,omitempty" json:"gerrit_codeHost_id,omitempty"` BuildName string `bson:"build_name,omitempty" json:"build_name,omitempty"` HealthChecks []*PmHealthCheck `bson:"health_checks,omitempty" json:"health_checks,omitempty"` HelmChart *HelmChart `bson:"helm_chart,omitempty" json:"helm_chart,omitempty"` EnvConfigs []*EnvConfig `bson:"env_configs,omitempty" json:"env_configs,omitempty"` EnvStatuses []*EnvStatus `bson:"env_statuses,omitempty" json:"env_statuses,omitempty"` CodehostID int `bson:"codehost_id,omitempty" json:"codehost_id,omitempty"` RepoOwner string `bson:"repo_owner,omitempty" json:"repo_owner,omitempty"` RepoName string `bson:"repo_name,omitempty" json:"repo_name,omitempty"` BranchName string `bson:"branch_name,omitempty" json:"branch_name,omitempty"` LoadPath string `bson:"load_path,omitempty" json:"load_path,omitempty"` LoadFromDir bool `bson:"is_dir,omitempty" json:"is_dir"` WorkloadType string `bson:"workload_type,omitempty" json:"workload_type,omitempty"` EnvName string `bson:"env_name,omitempty" json:"env_name,omitempty"` }
Service : service template struct Service template config has 3 types mainly. 1. Kubernetes service, and yaml+config is held in spock: type == "k8s"; source == "spock"; yaml != "" 2. Kubernetes service, and yaml+config is held in gitlab: type == "k8s"; source == "gitlab"; src_path != ""
type TestCase ¶
type TestCase struct { Name string `bson:"tc_name" json:"tc_name" xml:"name,attr"` ClassName string `bson:"classname" json:"classname" xml:"classname,attr"` Time float64 `bson:"time" json:"time" xml:"time,attr"` Failure *Failure `bson:"failure,omitempty" json:"failure" xml:"failure,omitempty"` Skipped *Skipped `bson:"skipped,omitempty" json:"skipped" xml:"skipped,omitempty"` SystemOut string `bson:"system_out,omitempty" json:"system_out" xml:"system-out,omitempty"` SystemErr string `bson:"system-err,omitempty" json:"system_err" xml:"system-err,omitempty"` Error *Error `bson:"error,omitempty" json:"error" xml:"error,omitempty"` }
type TestReport ¶
type TestReport struct { FunctionTestSuite *TestSuite `bson:"function_test_suite,omitempty" json:"functionTestSuite,omitempty"` PerformanceTestSuites []*PerformanceTestSuite `bson:"performance_test_suite,omitempty" json:"performanceTestSuite,omitempty"` Security map[string]map[string]int `bson:"security,omitempty" json:"security,omitempty"` }
type TestSuite ¶
type TestSuite struct { // 总数=tests+skips 成功=tests-failures-errors Tests int `bson:"tests" json:"tests" xml:"tests,attr"` Failures int `bson:"failures" json:"failures" xml:"failures,attr"` Successes int `bson:"successes,omitempty" json:"successes,omitempty" xml:"successes,attr,omitempty"` Skips int `bson:"skips" json:"skips" xml:"skips,attr"` Errors int `bson:"errors,omitempty" json:"errors" xml:"errors,attr,omitempty"` Time float64 `bson:"time" json:"time" xml:"time,attr"` SystemOut string `bson:"system_out,omitempty" json:"system_out" xml:"system-out,omitempty"` SystemErr string `bson:"system-err,omitempty" json:"system_err" xml:"system-err,omitempty"` TestCases []TestCase `bson:"testcase" json:"testcase" xml:"testcase"` SuiteType string `bson:"-" json:"-" xml:"-"` Name string `bson:"name" json:"-" xml:"-"` }
TestSuite ...
type TestSuiteSummary ¶
type TestSuiteSummary struct { Tests int `bson:"tests" json:"tests" xml:"tests,attr"` Failures int `bson:"failures" json:"failures" xml:"failures,attr"` Skips int `bson:"skips" json:"skips" xml:"skips,attr"` Errors int `bson:"errors" json:"errors" xml:"errors,attr"` Time float64 `bson:"time" json:"time" xml:"time,attr"` }
type TestSuites ¶
type TestSuites struct { Tests int `bson:"tests" json:"tests" xml:"tests,attr"` Skips int `bson:"skips" json:"skips" xml:"skips,attr"` Failures int `bson:"failures" json:"failures" xml:"failures,attr"` Errors int `bson:"errors,omitempty" json:"errors" xml:"errors,attr,omitempty"` Time float64 `bson:"time" json:"time" xml:"time,attr"` TestSuites []*TestSuite `bson:"testsuite" json:"testsuite" xml:"testsuite"` }
TestSuites ...
type YamlPreview ¶
type YamlPreview struct {
Kind string `bson:"-" json:"kind"`
}