task

package
v1.15.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IToi

func IToi(before interface{}, after interface{}) error

Types

type Artifact

type Artifact struct {
	TaskType   config.TaskType `bson:"type"                          json:"type"`
	Enabled    bool            `bson:"enabled"                       json:"enabled"`
	TaskStatus config.Status   `bson:"status"                        json:"status"`
	Name       string          `bson:"name"                          json:"name"`
	Image      string          `bson:"image"                         json:"image"`
	RegistryID string          `bson:"registry_id"                   json:"registry_id"`
	Timeout    int             `bson:"timeout,omitempty"             json:"timeout,omitempty"`
	Error      string          `bson:"error,omitempty"               json:"error,omitempty"`
	StartTime  int64           `bson:"start_time,omitempty"          json:"start_time,omitempty"`
	EndTime    int64           `bson:"end_time,omitempty"            json:"end_time,omitempty"`
	LogFile    string          `bson:"log_file"                      json:"log_file"`
	IsRestart  bool            `bson:"is_restart"                    json:"is_restart"`
}

func (*Artifact) ToSubTask

func (d *Artifact) ToSubTask() (map[string]interface{}, error)

type ArtifactInfo added in v1.6.0

type ArtifactInfo struct {
	URL          string `bson:"url"                 json:"url"`
	WorkflowName string `bson:"workflow_name"       json:"workflow_name"`
	TaskID       int64  `bson:"task_id"             json:"task_id"`
	FileName     string `bson:"file_name"           json:"file_name"`
}

type ArtifactPackage added in v1.8.0

type ArtifactPackage struct {
	TaskType   config.TaskType `bson:"type"                           json:"type"`
	TaskStatus config.Status   `bson:"status"                         json:"status"`
	Enabled    bool            `bson:"enabled"                        json:"enabled"`
	Timeout    int             `bson:"timeout,omitempty"              json:"timeout,omitempty"`
	Error      string          `bson:"error,omitempty"                json:"error,omitempty"`
	StartTime  int64           `bson:"start_time,omitempty"           json:"start_time,omitempty"`
	EndTime    int64           `bson:"end_time,omitempty"             json:"end_time,omitempty"`
	LogFile    string          `bson:"log_file"                       json:"log_file"`
	Progress   string          `bson:"progress"                       json:"progress"`

	// source images
	Images []*models.ImagesByService `bson:"images" json:"images"`
	// source registries need auth to pull images
	SourceRegistries []string `bson:"source_registries" json:"source_registries"`
	// target registries to push images
	TargetRegistries []string `bson:"target_registries" json:"target_registries"`
}

func (*ArtifactPackage) GetProgress added in v1.8.0

func (ri *ArtifactPackage) GetProgress() ([]*ServicePackageResult, error)

func (*ArtifactPackage) ToSubTask added in v1.8.0

func (ri *ArtifactPackage) ToSubTask() (map[string]interface{}, error)

type Build

type Build struct {
	TaskType    config.TaskType `bson:"type"                       json:"type"`
	Enabled     bool            `bson:"enabled"                    json:"enabled"`
	TaskStatus  config.Status   `bson:"status"                     json:"status"`
	ProductName string          `bson:"product_name"               json:"product_name"`
	// 新增一个service表示服务名称
	Service string `bson:"service"                    json:"service"`
	// 该名称实际为服务组件名称
	ServiceName       string                      `bson:"service_name"               json:"service_name"`
	ServiceType       string                      `bson:"service_type"               json:"service_type"`
	EnvName           string                      `bson:"env_name"                   json:"env_name"`
	Namespace         string                      `bson:"namespace"                  json:"namespace"`
	Timeout           int                         `bson:"timeout"                    json:"timeout,omitempty"`
	Error             string                      `bson:"error,omitempty"            json:"error,omitempty"`
	StartTime         int64                       `bson:"start_time"                 json:"start_time,omitempty"`
	EndTime           int64                       `bson:"end_time"                   json:"end_time,omitempty"`
	JobCtx            JobCtx                      `bson:"job_ctx"                    json:"job_ctx"`
	DockerBuild       *DockerBuild                `bson:"docker_build,omitempty"     json:"docker_build,omitempty"`
	InstallItems      []*models.Item              `bson:"install_items"              json:"install_items"`
	BuildOS           string                      `bson:"build_os"                   json:"build_os,omitempty"`
	ImageFrom         string                      `bson:"image_from"                 json:"image_from,omitempty"`
	ImageID           string                      `bson:"image_id"                   json:"image_id"`
	ResReq            setting.Request             `bson:"res_req"                    json:"res_req"`
	ResReqSpec        setting.RequestSpec         `bson:"res_req_spec"               json:"res_req_spec"`
	LogFile           string                      `bson:"log_file"                   json:"log_file"`
	InstallCtx        []*models.Install           `bson:"-"                          json:"install_ctx,omitempty"`
	Registries        []*models.RegistryNamespace `bson:"-"                   json:"registries"`
	StaticCheckStatus *StaticCheckStatus          `bson:"static_check_status,omitempty" json:"static_check_status,omitempty"`
	UTStatus          *UTStatus                   `bson:"ut_status,omitempty" json:"ut_status,omitempty"`
	DockerBuildStatus *DockerBuildStatus          `bson:"docker_build_status,omitempty" json:"docker_build_status,omitempty"`
	BuildStatus       *BuildStatus                `bson:"build_status,omitempty" json:"build_status,omitempty"`
	IsRestart         bool                        `bson:"is_restart"                      json:"is_restart"`
	// Get the host bound to the environment of the cloud host service configuration
	EnvHostInfo  map[string][]string `bson:"env_host_info,omitempty"         json:"env_host_info,omitempty"`
	EnvHostNames map[string][]string `bson:"env_host_names,omitempty"        json:"env_host_names,omitempty"`
	ArtifactInfo *ArtifactInfo       `bson:"artifact_info,omitempty"         json:"artifact_info,omitempty"`
	ClusterID    string              `bson:"cluster_id,omitempty"            json:"cluster_id,omitempty"`

	// New since V1.10.0.
	Cache        types.Cache        `bson:"cache"                           json:"cache"`
	CacheEnable  bool               `bson:"cache_enable"                    json:"cache_enable"`
	CacheDirType types.CacheDirType `bson:"cache_dir_type"                  json:"cache_dir_type"`
	CacheUserDir string             `bson:"cache_user_dir"                  json:"cache_user_dir"`
}

func (*Build) ToSubTask

func (b *Build) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type BuildStatus

type BuildStatus struct {
	StepStatus
}

type BuildStep

type BuildStep struct {
	BuildType  string `bson:"type"                         json:"type"`
	Scripts    string `bson:"scripts"                      json:"scripts"`
	MainGoFile string `bson:"main,omitempty"               json:"main,omitempty"`
}

type CallbackPayload added in v1.8.0

type CallbackPayload struct {
	QRCodeURL string `bson:"QR_code_URL,omitempty" json:"QR_code_URL,omitempty"`
}

type Deploy

type Deploy struct {
	TaskType         config.TaskType              `bson:"type"                          json:"type"`
	Enabled          bool                         `bson:"enabled"                       json:"enabled"`
	TaskStatus       config.Status                `bson:"status"                        json:"status"`
	Namespace        string                       `bson:"namespace"                     json:"namespace"`
	EnvName          string                       `bson:"env_name"                      json:"env_name"`
	ProductName      string                       `bson:"product_name"                  json:"product_name"`
	ServiceName      string                       `bson:"service_name"                  json:"service_name"`
	ServiceType      string                       `bson:"service_type"                  json:"service_type"`
	ServiceRevision  int64                        `bson:"service_revision,omitempty"    json:"service_revision,omitempty"`
	ReleaseName      string                       `bson:"release_name"                  json:"release_name"`
	ContainerName    string                       `bson:"container_name"                json:"container_name"`
	Image            string                       `bson:"image"                         json:"image"`
	Timeout          int                          `bson:"timeout,omitempty"             json:"timeout,omitempty"`
	Error            string                       `bson:"error,omitempty"               json:"error,omitempty"`
	StartTime        int64                        `bson:"start_time,omitempty"          json:"start_time,omitempty"`
	EndTime          int64                        `bson:"end_time,omitempty"            json:"end_time,omitempty"`
	ClusterID        string                       `bson:"cluster_id,omitempty"          json:"cluster_id,omitempty"`
	ReplaceResources []Resource                   `bson:"replace_resources"             json:"replace_resources"`
	SkipWaiting      bool                         `bson:"skipWaiting"                   json:"skipWaiting"`
	IsRestart        bool                         `bson:"is_restart"                    json:"is_restart"`
	ResetImage       bool                         `bson:"reset_image"                   json:"reset_image"`
	ResetImagePolicy setting.ResetImagePolicyType `bson:"reset_image_policy"            json:"reset_image_policy"`
}

Deploy 容器部署任务

func (*Deploy) SetImage

func (d *Deploy) SetImage(image string)

SetImage ...

func (*Deploy) SetNamespace

func (d *Deploy) SetNamespace(namespace string)

SetNamespace ...

func (*Deploy) ToSubTask

func (d *Deploy) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type DistributeInfo added in v1.9.9

type DistributeInfo struct {
	Image               string `bson:"image" json:"image"`
	ReleaseName         string `bson:"release_name" json:"release_name"`
	DistributeStartTime int64  `bson:"distribute_start_time" json:"distribute_start_time"`
	DistributeEndTime   int64  `bson:"distribute_end_time"   json:"distribute_end_time"`
	DistributeStatus    string `bson:"distribute_status"     json:"distribute_status"`
	DeployEnabled       bool   `bson:"deploy_enabled"        json:"deploy_enabled"`
	DeployEnv           string `bson:"deploy_env"            json:"deploy_env"`
	DeployServiceType   string `json:"deploy_service_type"   yaml:"deploy_service_type"`
	DeployContainerName string `json:"deploy_container_name" yaml:"deploy_container_name"`
	DeployServiceName   string `json:"deploy_service_name"   yaml:"deploy_service_name"`
	DeployClusterID     string `json:"deploy_cluster_id"     yaml:"deploy_cluster_id"`
	DeployNamespace     string `bson:"deploy_namespace"      json:"deploy_namespace"`
	DeployStartTime     int64  `bson:"deploy_start_time"     json:"deploy_start_time"`
	DeployEndTime       int64  `bson:"deploy_end_time"       json:"deploy_end_time"`
	DeployStatus        string `bson:"deploy_status"         json:"deploy_status"`
	RepoID              string `bson:"repo_id"               json:"repo_id"`
}

type DistributeToS3

type DistributeToS3 struct {
	TaskType       config.TaskType `bson:"type"                           json:"type"`
	Enabled        bool            `bson:"enabled"                        json:"enabled"`
	TaskStatus     config.Status   `bson:"status"                         json:"status"`
	PackageFile    string          `bson:"package_file"                   json:"package_file"`
	ProductName    string          `bson:"product_name"                   json:"product_name"`
	ServiceName    string          `bson:"service_name"                   json:"service_name"`
	RemoteFileKey  string          `bson:"remote_file_key"                json:"remote_file_key,omitempty"`
	Timeout        int             `bson:"timeout,omitempty"              json:"timeout,omitempty"`
	Error          string          `bson:"error,omitempty"                json:"error,omitempty"`
	StartTime      int64           `bson:"start_time,omitempty"           json:"start_time,omitempty"`
	EndTime        int64           `bson:"end_time,omitempty"             json:"end_time,omitempty"`
	DestStorageURL string          `bson:"dest_storage_url"               json:"dest_storage_url"`
	//SrcStorageUrl  string `bson:"src_storage_url"                json:"src_storage_url"`
	S3StorageID string `bson:"s3_storage_id"                  json:"s3_storage_id"`
}

func (*DistributeToS3) SetPackageFile

func (d *DistributeToS3) SetPackageFile(packageFile string)

func (*DistributeToS3) ToSubTask

func (d *DistributeToS3) ToSubTask() (map[string]interface{}, error)

type DockerBuild

type DockerBuild struct {
	TaskType   config.TaskType `bson:"type"                    json:"type"`
	Enabled    bool            `bson:"enabled"                 json:"enabled"`
	TaskStatus config.Status   `bson:"status"                  json:"status"`
	WorkDir    string          `bson:"work_dir"                json:"work_dir"`             // Dockerfile 路径
	DockerFile string          `bson:"docker_file"             json:"docker_file"`          // Dockerfile 名称, 默认为Dockerfile
	BuildArgs  string          `bson:"build_args,omitempty"    json:"build_args,omitempty"` // Docker build可变参数
	Image      string          `bson:"image"                   json:"image"`
	OnSetup    string          `bson:"setup,omitempty"         json:"setup,omitempty"`
	Timeout    int             `bson:"timeout"                 json:"timeout,omitempty"`
	Error      string          `bson:"error"                   json:"error,omitempty"`
	StartTime  int64           `bson:"start_time"              json:"start_time,omitempty"`
	EndTime    int64           `bson:"end_time"                json:"end_time,omitempty"`
	JobName    string          `bson:"job_name"                json:"job_name"`
	LogFile    string          `bson:"log_file"                json:"log_file"`
}

func (*DockerBuild) ToSubTask

func (db *DockerBuild) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type DockerBuildCtx

type DockerBuildCtx struct {
	Source                string `yaml:"source" bson:"source" json:"source"`
	WorkDir               string `yaml:"work_dir" bson:"work_dir" json:"work_dir"`
	DockerFile            string `yaml:"docker_file" bson:"docker_file" json:"docker_file"`
	ImageName             string `yaml:"image_name" bson:"image_name" json:"image_name"`
	BuildArgs             string `yaml:"build_args" bson:"build_args" json:"build_args"`
	ImageReleaseTag       string `yaml:"image_release_tag,omitempty" bson:"image_release_tag,omitempty" json:"image_release_tag"`
	DockerTemplateContent string `yaml:"docker_template_content" bson:"docker_template_content" json:"docker_template_content"`
}

DockerBuildCtx ... Docker build参数 WorkDir: docker build执行路径 DockerFile: dockerfile名称, 默认为Dockerfile ImageBuild: build image镜像全称, e.g. xxx.com/release-candidates/image:tag

func (*DockerBuildCtx) GetDockerFile

func (buildCtx *DockerBuildCtx) GetDockerFile() string

GetDockerFile ...

type DockerBuildStatus

type DockerBuildStatus struct {
	StepStatus
	ImageName    string `bson:"image_name" json:"image_name"`
	RegistryRepo string `bson:"registry_repo" json:"registry_repo"`
}

type Error added in v1.9.0

type Error struct {
	Message string `bson:"message"  json:"message" xml:"message,attr"`
	Type    string `bson:"type"     json:"type"    xml:"type,attr"`
	Text    string `bson:"text"     json:"text"    xml:",chardata"`
}

type Extension added in v1.9.9

type Extension struct {
	TaskType     config.TaskType  `bson:"type"                       json:"type"`
	Enabled      bool             `bson:"enabled"                    json:"enabled"`
	TaskStatus   config.Status    `bson:"status"                     json:"status"`
	URL          string           `bson:"url"                        json:"url"`
	Path         string           `bson:"path,omitempty"             json:"path,omitempty"`
	IsCallback   bool             `bson:"is_callback"                json:"is_callback"`
	Headers      []*models.KeyVal `bson:"headers,omitempty"          json:"headers"`
	Payload      string           `bson:"payload"                    json:"payload"`
	ResponseBody *string          `bson:"response_body"              json:"response_body"`
	ResponseCode *int             `bson:"response_code"              json:"response_code"`
	ServiceInfos []*ServiceInfo   `bson:"service_infos"              json:"service_infos"`
	Timeout      int              `bson:"timeout"                    json:"timeout,omitempty"`
	IsRestart    bool             `bson:"is_restart"                 json:"is_restart"`
	Error        string           `bson:"error,omitempty"            json:"error,omitempty"`
	StartTime    int64            `bson:"start_time"                 json:"start_time,omitempty"`
	EndTime      int64            `bson:"end_time"                   json:"end_time,omitempty"`
}

func (*Extension) ToSubTask added in v1.9.9

func (t *Extension) ToSubTask() (map[string]interface{}, error)

type Failure added in v1.9.0

type Failure struct {
	Message string `bson:"message"  json:"message" xml:"message,attr"`
	Type    string `bson:"type"     json:"type"    xml:"type,attr"`
	Text    string `bson:"text"     json:"text"    xml:",chardata"`
}

type FileArchiveCtx

type FileArchiveCtx struct {
	FileLocation string `yaml:"file_location" bson:"file_location" json:"file_location"`
	FileName     string `yaml:"file_name" bson:"file_name" json:"file_name"`
}

type ImageData added in v1.8.0

type ImageData struct {
	ImageUrl       string `bson:"image_url" json:"image_url"`
	ImageName      string `bson:"image_name" json:"image_name"`
	ImageNamespace string `bson:"image_namespace" json:"image_namespace"`
	ImageTag       string `bson:"image_tag" json:"image_tag"`
}

type JenkinsBuild

type JenkinsBuild struct {
	TaskType           config.TaskType             `bson:"type"                    json:"type"`
	Enabled            bool                        `bson:"enabled"                 json:"enabled"`
	TaskStatus         config.Status               `bson:"status"                  json:"status"`
	ServiceName        string                      `bson:"service_name"            json:"service_name"`
	Service            string                      `bson:"service"                 json:"service"`
	OnSetup            string                      `bson:"setup,omitempty"         json:"setup,omitempty"`
	Timeout            int                         `bson:"timeout,omitempty"       json:"timeout,omitempty"`
	Error              string                      `bson:"error,omitempty"         json:"error,omitempty"`
	ResReq             setting.Request             `bson:"res_req"                 json:"res_req"`
	ResReqSpec         setting.RequestSpec         `bson:"res_req_spec"            json:"res_req_spec"`
	JenkinsIntegration *JenkinsIntegration         `bson:"-"                       json:"jenkins_integration"`
	JenkinsBuildArgs   *JenkinsBuildArgs           `bson:"-"                       json:"jenkins_build_args"`
	Registries         []*models.RegistryNamespace `bson:"registries"              json:"registries"`
	StartTime          int64                       `bson:"start_time,omitempty"    json:"start_time,omitempty"`
	EndTime            int64                       `bson:"end_time,omitempty"      json:"end_time,omitempty"`
	LogFile            string                      `bson:"log_file"                json:"log_file"`
	Image              string                      `bson:"image,omitempty"         json:"image,omitempty"`
	IsRestart          bool                        `bson:"is_restart"              json:"is_restart"`
}

JenkinsBuild ...

func (*JenkinsBuild) SetIntegration

func (j *JenkinsBuild) SetIntegration(jenkinsIntegration *JenkinsIntegration)

SetIntegration ...

func (*JenkinsBuild) SetJenkinsBuildArgs

func (j *JenkinsBuild) SetJenkinsBuildArgs(jenkinsBuildArgs *JenkinsBuildArgs)

SetIntegration ...

func (*JenkinsBuild) ToSubTask

func (j *JenkinsBuild) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type JenkinsBuildArgs

type JenkinsBuildArgs struct {
	JobName            string                     `bson:"job_name"            json:"job_name"`
	JenkinsBuildParams []*types.JenkinsBuildParam `bson:"jenkins_build_param" json:"jenkins_build_params"`
}

type JenkinsIntegration

type JenkinsIntegration struct {
	URL      string `bson:"url"                   json:"url"`
	Username string `bson:"username"              json:"username"`
	Password string `bson:"password"              json:"password"`
}

type Jira

type Jira struct {
	TaskType   config.TaskType     `bson:"type"                     json:"type"`
	Enabled    bool                `bson:"enabled"                  json:"enabled"`
	TaskStatus config.Status       `bson:"status"                   json:"status"`
	Builds     []*types.Repository `bson:"builds,omitempty"         json:"builds,omitempty"`
	// TODO: (min) move JiraIssue back to this file
	Issues    []*models.JiraIssue `bson:"issues,omitempty"         json:"issues,omitempty"`
	Timeout   int                 `bson:"timeout,omitempty"        json:"timeout,omitempty"`
	Error     string              `bson:"error,omitempty"          json:"error,omitempty"`
	StartTime int64               `bson:"start_time,omitempty"     json:"start_time,omitempty"`
	EndTime   int64               `bson:"end_time,omitempty"       json:"end_time,omitempty"`
}

func (*Jira) ToSubTask

func (j *Jira) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type JobCtx

type JobCtx struct {
	EnableProxy bool          `bson:"enable_proxy"                   json:"enable_proxy"`
	Proxy       *models.Proxy `bson:"proxy"                          json:"proxy"`

	// TODO: Deprecated.
	CleanWorkspace bool `bson:"clean_workspace"                json:"clean_workspace"`

	// BuildJobCtx
	Builds     []*types.Repository `bson:"builds"                         json:"builds"`
	BuildSteps []*BuildStep        `bson:"build_steps,omitempty"          json:"build_steps"`
	SSHs       []*SSH              `bson:"sshs,omitempty"                 json:"sshs"`
	// Envs stores user defined env key val for build
	// TODO: 之后可以不用keystore, 将用户敏感信息保存在此字段
	EnvVars     []*models.KeyVal `bson:"envs,omitempty"                 json:"envs"`
	UploadPkg   bool             `bson:"upload_pkg"                     json:"upload_pkg"`
	PackageFile string           `bson:"package_file,omitempty"         json:"package_file,omitempty"`
	Image       string           `bson:"image,omitempty"                json:"image,omitempty"`

	// TestJobCtx
	TestThreshold  int    `bson:"test_threshold"                 json:"test_threshold"`
	TestResultPath string `bson:"test_result_path,omitempty"     json:"test_result_path,omitempty"`
	TestReportPath string `bson:"test_report_path"               json:"test_report_path"`
	TestJobName    string `bson:"test_job_name,omitempty"        json:"test_job_name,omitempty"`
	// DockerBuildCtx
	DockerBuildCtx *DockerBuildCtx `bson:"docker_build_ctx,omitempty" json:"docker_build_ctx,omitempty"`
	FileArchiveCtx *FileArchiveCtx `bson:"file_archive_ctx,omitempty" json:"file_archive_ctx,omitempty"`
	// TestType
	TestType      string   `bson:"test_type"                       json:"test_type"`
	Caches        []string `bson:"caches" json:"caches"`
	ArtifactPath  string   `bson:"artifact_path,omitempty"  json:"artifact_path,omitempty"`
	ArtifactPaths []string `bson:"artifact_paths,omitempty" json:"artifact_paths,omitempty"`
	IsHasArtifact bool     `bson:"is_has_artifact" json:"is_has_artifact"`

	// ClassicBuild used by qbox build
	ClassicBuild    bool   `bson:"classic_build"                  json:"classic_build"`
	PostScripts     string `bson:"post_scripts,omitempty"         json:"post_scripts"`
	PMDeployScripts string `bson:"pm_deploy_scripts,omitempty"    json:"pm_deploy_scripts"`

	// Upload To S3 related context
	UploadEnabled     bool                             `bson:"upload_enabled"      json:"upload_enabled"`
	UploadStorageInfo *types.ObjectStorageInfo         `bson:"upload_storage_info" json:"upload_storage_info"`
	UploadInfo        []*types.ObjectStoragePathDetail `bson:"upload_info"         json:"upload_info"`
}

type JobCtxBuilder

type JobCtxBuilder struct {
	JobName       string
	ArchiveBucket string
	ArchiveFile   string
	PipelineCtx   *PipelineCtx
	JobCtx        JobCtx
	Installs      []*models.Install
}

JobCtxBuilder ...

type PerformanceTestSuite added in v1.9.0

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 PipelineCtx

type PipelineCtx struct {
	DockerHost        string
	Workspace         string
	DistDir           string
	DockerMountDir    string
	ConfigMapMountDir string
	MultiRun          bool
}

type ReleaseImage

type ReleaseImage struct {
	TaskType     config.TaskType `bson:"type"                           json:"type"`
	Enabled      bool            `bson:"enabled"                        json:"enabled"`
	TaskStatus   config.Status   `bson:"status"                         json:"status"`
	ImageTest    string          `bson:"image_test"                     json:"image_test"`
	ImageRelease string          `bson:"image_release"                  json:"image_release"`
	ImageRepo    string          `bson:"image_repo"                     json:"image_repo"`
	Timeout      int             `bson:"timeout,omitempty"              json:"timeout,omitempty"`
	Error        string          `bson:"error,omitempty"                json:"error,omitempty"`
	StartTime    int64           `bson:"start_time,omitempty"           json:"start_time,omitempty"`
	EndTime      int64           `bson:"end_time,omitempty"             json:"end_time,omitempty"`
	LogFile      string          `bson:"log_file"                       json:"log_file"`

	// destinations to distribute images
	Releases []models.RepoImage `bson:"releases"                 json:"releases"`

	// New Version field
	ProductName    string            `bson:"product_name"    json:"product_name"`
	SourceImage    string            `bson:"source_image"    json:"source_image"`
	DistributeInfo []*DistributeInfo `bson:"distribute_info" json:"distribute_info"`
}

ReleaseImage 线上镜像分发任务

func (*ReleaseImage) SetImage

func (ri *ReleaseImage) SetImage(image string)

SetImage ...

func (*ReleaseImage) ToSubTask

func (ri *ReleaseImage) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type ReleaseImageItem

type ReleaseImageItem struct {
	RepoID string `bson:"id" json:"id"`
	Image  string `bson:"image" json:"image"`
}

type Repo

type Repo struct {
	Source  string `bson:"source" json:"source"`
	Address string `bson:"address" json:"address"`
	Owner   string `bson:"owner" json:"owner"`
	Name    string `bson:"name" json:"name"`
}

type RepoCoverage

type RepoCoverage struct {
	Repo

	NoStmt       int `bson:"no_stmt" json:"no_stmt"`
	NoMissedStmt int `bson:"no_missed_stmt" json:"no_missed_stmt"`
}

type RepoStaticCheck

type RepoStaticCheck struct {
	Repo
	SecurityMeasureCount int `bson:"security_measure_count" json:"security_measure_count"`
	IssueMeasureCount    int `bson:"issue_measure_count" json:"issue_measure_count"`
}

type Resource

type Resource struct {
	Name      string `json:"name" bson:"name"`
	Kind      string `json:"kind" bson:"kind"`
	Container string `json:"container" bson:"container"`
	Origin    string `json:"origin" bson:"origin"`
}

type SSH

type SSH struct {
	ID         string `json:"id"`
	Name       string `json:"name"`
	UserName   string `json:"user_name"`
	IP         string `json:"ip"`
	Port       int64  `json:"port"`
	IsProd     bool   `json:"is_prod"`
	Label      string `json:"label"`
	PrivateKey string `json:"private_key"`
}

type Scanning added in v1.9.9

type Scanning struct {
	TaskType   config.TaskType     `bson:"type"            json:"type"`
	Status     config.Status       `bson:"status"          json:"status,omitempty"`
	ScanningID string              `bson:"scanning_id"     json:"scanning_id"`
	Name       string              `bson:"name"            json:"name"`
	Error      string              `bson:"error,omitempty" json:"error,omitempty"`
	ImageInfo  string              `bson:"image_info"      json:"image_info"`
	SonarInfo  *types.SonarInfo    `bson:"sonar_info"      json:"sonar_info"`
	Repos      []*types.Repository `bson:"repos"           json:"repos"`
	Proxy      *models.Proxy       `bson:"proxy"           json:"proxy"`
	ClusterID  string              `bson:"cluster_id"      json:"cluster_id"`
	// ResReq defines job requested resources
	ResReq     setting.Request             `bson:"res_req"       json:"res_req"`
	ResReqSpec setting.RequestSpec         `bson:"res_req_spec"  json:"res_req_spec"`
	Timeout    int64                       `bson:"timeout"       json:"timeout"`
	Registries []*models.RegistryNamespace `bson:"-"             json:"registries"`
	// Parameter is for sonarQube type only
	Parameter string `bson:"parameter" json:"parameter"`
	// Script is for other type only
	Script string `bson:"script" json:"script"`
}

func (*Scanning) ToSubTask added in v1.9.9

func (t *Scanning) ToSubTask() (map[string]interface{}, error)

type Security

type Security struct {
	TaskType   config.TaskType `bson:"type"                          json:"type"`
	Enabled    bool            `bson:"enabled"                       json:"enabled"`
	TaskStatus config.Status   `bson:"status"                        json:"status"`
	ImageName  string          `bson:"image_name"                    json:"image_name"`
	ImageID    string          `bson:"image_id"                      json:"image_id"`
	Timeout    int             `bson:"timeout,omitempty"             json:"timeout,omitempty"`
	Error      string          `bson:"error,omitempty"               json:"error,omitempty"`
	StartTime  int64           `bson:"start_time,omitempty"          json:"start_time,omitempty"`
	EndTime    int64           `bson:"end_time,omitempty"            json:"end_time,omitempty"`
	LogFile    string          `bson:"log_file"                      json:"log_file"`
	Summary    map[string]int  `bson:"summary"                       json:"summary"`
}

func (*Security) SetImageName

func (s *Security) SetImageName(imageName string)

func (*Security) ToSubTask

func (s *Security) ToSubTask() (map[string]interface{}, error)

type ServiceInfo added in v1.9.9

type ServiceInfo struct {
	ServiceName   string `bson:"service_name"              json:"service_name"`
	ServiceModule string `bson:"service_module"            json:"service_module"`
	Image         string `bson:"image"                     json:"image"`
}

type ServicePackageResult added in v1.8.0

type ServicePackageResult struct {
	ServiceName string       `json:"service_name"`
	Result      string       `json:"result"`
	ErrorMsg    string       `json:"error_msg"`
	ImageData   []*ImageData `json:"image_data"`
}

type Skipped added in v1.9.0

type Skipped struct {
}

type StaticCheckStatus

type StaticCheckStatus struct {
	StepStatus
	Repos []RepoStaticCheck `bson:"repos" json:"repos"`
}

type StepStatus

type StepStatus struct {
	StartTime int64         `bson:"start_time"                 json:"start_time"`
	EndTime   int64         `bson:"end_time"                   json:"end_time"`
	Status    config.Status `bson:"status"                     json:"status"`
}

type Task

type Task struct {
	ID           primitive.ObjectID       `bson:"_id,omitempty"             json:"id,omitempty"`
	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"`
	Description  string                   `bson:"description,omitempty"     json:"description,omitempty"`
	TaskCreator  string                   `bson:"task_creator"              json:"task_creator,omitempty"`
	TaskRevoker  string                   `bson:"task_revoker,omitempty"    json:"task_revoker,omitempty"`
	CreateTime   int64                    `bson:"create_time"               json:"create_time,omitempty"`
	StartTime    int64                    `bson:"start_time"                json:"start_time,omitempty"`
	EndTime      int64                    `bson:"end_time"                  json:"end_time,omitempty"`
	SubTasks     []map[string]interface{} `bson:"sub_tasks"                 json:"sub_tasks"`
	Stages       []*models.Stage          `bson:"stages"                    json:"stages"`
	ReqID        string                   `bson:"req_id,omitempty"          json:"req_id,omitempty"`
	AgentHost    string                   `bson:"agent_host,omitempty"      json:"agent_host,omitempty"`
	DockerHost   string                   `bson:"-"                         json:"docker_host,omitempty"`
	TeamName     string                   `bson:"team,omitempty"            json:"team,omitempty"`
	IsDeleted    bool                     `bson:"is_deleted"                json:"is_deleted"`
	IsArchived   bool                     `bson:"is_archived"               json:"is_archived"`
	AgentID      string                   `bson:"agent_id"                  json:"agent_id"`
	// 是否允许同时运行多次
	MultiRun bool `bson:"multi_run"                 json:"multi_run"`
	// target 服务名称, k8s为容器名称, 物理机为服务名
	Target string `bson:"target,omitempty"                    json:"target"`
	// 使用预定义编译管理模块中的内容生成SubTasks,
	// 查询条件为 服务模板名称: ServiceTmpl, 版本: BuildModuleVer
	// 如果为空,则使用pipeline自定义SubTasks
	BuildModuleVer string `bson:"build_module_ver,omitempty"                 json:"build_module_ver"`
	ServiceName    string `bson:"service_name,omitempty"              json:"service_name,omitempty"`
	// TaskArgs 单服务工作流任务参数
	TaskArgs *models.TaskArgs `bson:"task_args,omitempty"         json:"task_args,omitempty"`
	// WorkflowArgs 多服务工作流任务参数
	WorkflowArgs *models.WorkflowTaskArgs `bson:"workflow_args"         json:"workflow_args,omitempty"`
	// TestArgs 测试任务参数
	TestArgs *models.TestTaskArgs `bson:"test_args,omitempty"         json:"test_args,omitempty"`
	// ScanningArgs argument for scanning tasks
	ScanningArgs *models.ScanningArgs `bson:"scanning_args,omitempty" json:"scanning_args,omitempty"`
	// ServiceTaskArgs 脚本部署工作流任务参数
	ServiceTaskArgs *models.ServiceTaskArgs `bson:"service_args,omitempty"         json:"service_args,omitempty"`
	// ArtifactPackageTaskArgs arguments for artifact-package type tasks
	ArtifactPackageTaskArgs *models.ArtifactPackageTaskArgs `bson:"artifact_package_args,omitempty"         json:"artifact_package_args,omitempty"`
	// ConfigPayload 系统配置信息
	ConfigPayload *models.ConfigPayload      `bson:"configpayload"                  json:"config_payload,omitempty"`
	Error         string                     `bson:"error,omitempty"                json:"error,omitempty"`
	Services      [][]*models.ProductService `bson:"services"                       json:"services"`
	Render        *models.RenderInfo         `bson:"render"                         json:"render"`
	StorageURI    string                     `bson:"storage_uri,omitempty"          json:"storage_uri,omitempty"`
	// interface{} 为types.TestReport
	TestReports      map[string]interface{}       `bson:"test_reports,omitempty" json:"test_reports,omitempty"`
	RwLock           sync.Mutex                   `bson:"-"                      json:"-"`
	ResetImage       bool                         `bson:"resetImage"             json:"resetImage"`
	ResetImagePolicy setting.ResetImagePolicyType `bson:"reset_image_policy"     json:"reset_image_policy"`
	TriggerBy        *models.TriggerBy            `bson:"trigger_by,omitempty"   json:"trigger_by,omitempty"`
	Features         []string                     `bson:"features"               json:"features"`
	IsRestart        bool                         `bson:"is_restart"             json:"is_restart"`
	StorageEndpoint  string                       `bson:"storage_endpoint"       json:"storage_endpoint"`
}

func (Task) TableName

func (Task) TableName() string

type TaskOpt added in v1.9.9

type TaskOpt struct {
	Task           *Task           `json:"task"`
	EnvName        string          `json:"env_name"`
	ServiceName    string          `json:"service_name"`
	ServiceInfos   *[]*ServiceInfo `json:"service_infos"`
	IsWorkflowTask bool            `json:"is_workflow_task"`
	ImageName      string          `json:"image_name"`
}

type TestCase added in v1.9.0

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 added in v1.9.0

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 added in v1.9.0

type TestSuite struct {
	// totalNum=tests+skips successNum=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:"-"`
}

type Testing

type Testing struct {
	TaskType     config.TaskType   `bson:"type"                            json:"type"`
	Enabled      bool              `bson:"enabled"                         json:"enabled"`
	TaskStatus   config.Status     `bson:"status"                          json:"status"`
	TestName     string            `bson:"test_name"                       json:"test_name"`
	Timeout      int               `bson:"timeout,omitempty"               json:"timeout,omitempty"`
	Error        string            `bson:"error,omitempty"                 json:"error,omitempty"`
	StartTime    int64             `bson:"start_time,omitempty"            json:"start_time,omitempty"`
	EndTime      int64             `bson:"end_time,omitempty"              json:"end_time,omitempty"`
	JobCtx       JobCtx            `bson:"job_ctx"                         json:"job_ctx"`
	InstallItems []*models.Item    `bson:"install_items"                   json:"install_items"`
	InstallCtx   []*models.Install `bson:"-"                               json:"install_ctx"`
	BuildOS      string            `bson:"build_os"                        json:"build_os,omitempty"`
	ImageFrom    string            `bson:"image_from"                      json:"image_from,omitempty"`
	ImageID      string            `bson:"image_id"                        json:"image_id"`
	// ResReq defines job requested resources
	ResReq         setting.Request             `bson:"res_req"                         json:"res_req"`
	ResReqSpec     setting.RequestSpec         `bson:"res_req_spec"                    json:"res_req_spec"`
	LogFile        string                      `bson:"log_file"                        json:"log_file"`
	TestModuleName string                      `bson:"test_module_name"                json:"test_module_name"`
	ReportReady    bool                        `bson:"report_ready"                    json:"report_ready"`
	IsRestart      bool                        `bson:"is_restart"                      json:"is_restart"`
	Registries     []*models.RegistryNamespace `bson:"-"                               json:"registries"`
	ClusterID      string                      `bson:"cluster_id,omitempty"            json:"cluster_id,omitempty"`
	Namespace      string                      `bson:"namespace"                       json:"namespace"`

	// New since V1.10.0.
	Cache        types.Cache        `bson:"cache"               json:"cache"`
	CacheEnable  bool               `bson:"cache_enable"        json:"cache_enable"`
	CacheDirType types.CacheDirType `bson:"cache_dir_type"      json:"cache_dir_type"`
	CacheUserDir string             `bson:"cache_user_dir"      json:"cache_user_dir"`
}

func (*Testing) ToSubTask

func (t *Testing) ToSubTask() (map[string]interface{}, error)

type Trigger added in v1.8.0

type Trigger struct {
	TaskType        config.TaskType  `bson:"type"                       json:"type"`
	Enabled         bool             `bson:"enabled"                    json:"enabled"`
	TaskStatus      config.Status    `bson:"status"                     json:"status"`
	URL             string           `bson:"url,omitempty"              json:"url,omitempty"`
	Path            string           `bson:"path,omitempty"             json:"path,omitempty"`
	IsCallback      bool             `bson:"is_callback,omitempty"      json:"is_callback,omitempty"`
	CallbackType    string           `bson:"callback_type,omitempty"    json:"callback_type,omitempty"`
	CallbackPayload *CallbackPayload `bson:"callback_payload,omitempty" json:"callback_payload,omitempty"`
	Headers         []*models.KeyVal `bson:"headers,omitempty"          json:"headers,omitempty"`
	Timeout         int              `bson:"timeout"                    json:"timeout,omitempty"`
	IsRestart       bool             `bson:"is_restart"                 json:"is_restart"`
	Error           string           `bson:"error,omitempty"            json:"error,omitempty"`
	StartTime       int64            `bson:"start_time"                 json:"start_time,omitempty"`
	EndTime         int64            `bson:"end_time"                   json:"end_time,omitempty"`
}

func (*Trigger) ToSubTask added in v1.8.0

func (t *Trigger) ToSubTask() (map[string]interface{}, error)

ToSubTask ...

type UTStatus

type UTStatus struct {
	StepStatus

	Repos []RepoCoverage `bson:"repos" json:"repos"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL