task

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2022 License: Apache-2.0 Imports: 9 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 AdvancedConfig added in v1.8.0

type AdvancedConfig struct {
	Strategy    string                     `json:"strategy,omitempty"      bson:"strategy,omitempty"`
	NodeLabels  []*NodeSelectorRequirement `json:"node_labels,omitempty"   bson:"node_labels,omitempty"`
	Tolerations string                     `json:"tolerations"             bson:"tolerations"`
}

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 ArtifactArgs

type ArtifactArgs struct {
	Name         string      `bson:"name"                      json:"name"`
	ImageName    string      `bson:"image_name,omitempty"      json:"image_name,omitempty"`
	ServiceName  string      `bson:"service_name"              json:"service_name"`
	Image        string      `bson:"image"                     json:"image"`
	Deploy       []DeployEnv `bson:"deploy"                    json:"deploy"`
	WorkflowName string      `bson:"workflow_name,omitempty"   json:"workflow_name,omitempty"`
	TaskID       int64       `bson:"task_id,omitempty"         json:"task_id,omitempty"`
	FileName     string      `bson:"file_name,omitempty"       json:"file_name,omitempty"`
	URL          string      `bson:"url,omitempty"             json:"url,omitempty"`
}

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"`
	Enabled    bool            `bson:"enabled"                        json:"enabled"`
	TaskStatus config.Status   `bson:"status"                         json:"status"`
	Progress   string          `bson:"progress"                       json:"progress"`
	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"`

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

func (*ArtifactPackage) ToSubTask added in v1.8.0

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

type ArtifactPackageTaskArgs added in v1.8.0

type ArtifactPackageTaskArgs struct {
	ProductName      string             `bson:"product_name"      json:"product_name"`
	Images           []*ImagesByService `bson:"images"            json:"images"`
	SourceRegistries []string           `bson:"source_registries" json:"source_registries"`
	TargetRegistries []string           `bson:"target_registries" json:"target_registries"`
}

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      []*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        []*Install           `bson:"-"                          json:"install_ctx,omitempty"`
	Registries        []*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"`

	// New since V1.16.0, determines is dockerDaemon on host node is used in pod
	UseHostDockerDaemon bool `bson:"use_host_docker_daemon,omitempty" json:"use_host_docker_daemon,omitempty"`
}

func (*Build) ToSubTask

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

ToSubTask ...

type BuildArgs

type BuildArgs struct {
	Repos []*Repository `bson:"repos"               json:"repos"`
}

type BuildConfig

type BuildConfig struct {
	KubeNamespace string
}

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

type CallbackArgs struct {
	CallbackUrl  string                 `bson:"callback_url" json:"callback_url"`   // url-encoded full path
	CallbackVars map[string]interface{} `bson:"callback_vars" json:"callback_vars"` // custom defied vars, will be set to body of callback request
}

type CallbackPayload added in v1.8.0

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

type CallbackPayloadObj added in v1.8.0

type CallbackPayloadObj struct {
	TaskName      string           `json:"task_name"`
	ProjectName   string           `json:"project_name"`
	TaskID        int              `json:"task_id"`
	Type          string           `json:"type"`
	Status        string           `json:"status"`
	StatusMessage string           `json:"status_message"`
	Payload       *CallbackPayload `json:"payload"`
}

type ConfigPayload

type ConfigPayload struct {
	APIToken           string             `json:"api_token"`
	Proxy              Proxy              `json:"proxy"`
	S3Storage          S3Config           `json:"s3_storage"`
	Github             GithubConfig       `json:"github"`
	Gitlab             GitlabConfig       `json:"gitlab"`
	Build              BuildConfig        `json:"build"`
	Test               TestConfig         `json:"test"`
	Registry           RegistryConfig     `json:"registry"`
	Release            ReleaseConfig      `json:"release"`
	JenkinsBuildConfig JenkinsBuildConfig `json:"jenkins_build_config"`
	// 推送线上镜像需要的用户名密码, 根据pipeline镜像发布模块动态配置
	ImageRelease ImageReleaseConfig `json:"image_release"`
	Docker       DockerConfig       `json:"docker"`

	ClassicBuild bool `json:"classic_build"`

	CustomDNSSupported bool `json:"custom_dns_supported"`
	HubServerAddr      string
	DeployClusterID    string
	AesKey             string `json:"aes_key"`

	RepoConfigs map[string]*RegistryNamespace

	// IgnoreCache means ignore docker build cache
	IgnoreCache bool `json:"ignore_cache"`

	// ResetCache means ignore workspace cache
	ResetCache  bool          `json:"reset_cache"`
	PrivateKeys []*PrivateKey `json:"private_keys"`
	K8SClusters []*K8SCluster `json:"k8s_clusters"`

	RegistryID string `json:"registry_id"`

	// build concurrency settings
	BuildConcurrency int64 `json:"build_concurrency"`
}

func (*ConfigPayload) GetGitKnownHost

func (cp *ConfigPayload) GetGitKnownHost() string

type Container

type Container struct {
	Name  string `bson:"name"           json:"name"`
	Image string `bson:"image"          json:"image"`
}

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"`
	RelatedPodLabels []map[string]string          `bson:"-"                             json:"-"`
	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 DeployArgs

type DeployArgs struct {
	// 目标部署环境
	Namespace string `json:"namespace"`
	// 镜像或者二进制名称后缀, 一般为branch或者PR
	Tag string `json:"suffix"`
	// 部署镜像名称
	// 格式: xxx.com/{namespace}/{service name}:{timestamp}-{suffix}}
	// timestamp format: 20060102150405
	Image string `json:"image"`
	// 部署二进制包名称
	// 格式: {service name}-{timestamp}-{suffix}}.tar.gz
	// timestamp format: 20060102150405
	PackageFile string `json:"package_file"`
}

type DeployEnv

type DeployEnv struct {
	Env         string `json:"env"`
	Type        string `json:"type"`
	ProductName string `json:"product_name,omitempty"`
}

type DistributeInfo added in v1.9.9

type DistributeInfo struct {
	Image               string `json:"image"                 yaml:"image"`
	ReleaseName         string `json:"release_name"          yaml:"release_name"`
	DistributeStartTime int64  `json:"distribute_start_time" yaml:"distribute_start_time"`
	DistributeEndTime   int64  `json:"distribute_end_time"   yaml:"distribute_end_time"`
	DistributeStatus    string `json:"distribute_status"     yaml:"distribute_status"`
	DeployEnabled       bool   `json:"deploy_enabled"        yaml:"deploy_enabled"`
	DeployEnv           string `json:"deploy_env"            yaml:"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 `json:"deploy_namespace"      yaml:"deploy_namespace"`
	DeployStartTime     int64  `json:"deploy_start_time"     yaml:"deploy_start_time"`
	DeployEndTime       int64  `json:"deploy_end_time"       yaml:"deploy_end_time"`
	DeployStatus        string `json:"deploy_status"         yaml:"deploy_status"`
	RepoID              string `json:"repo_id"               yaml:"repo_id"`

	//RepoAK and RepoSK is used for docker login, it is determined runtime, not passed by message so no json is required
	RepoAK string `json:"-"  yaml:"repo_ak"`
	RepoSK string `json:"-"  yaml:"repo_sk"`
}

DistributeInfo will be convert into yaml, adding yaml

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)

SetPackageFile ...

func (*DistributeToS3) ToSubTask

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

ToSubTask ...

type DockerBuild

type DockerBuild struct {
	Source     string          `bson:"source"                  json:"source"` // Dockerfile source
	TemplateID string          `bson:"template_id"             json:"template_id"`
	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)

type DockerBuildCtx

type DockerBuildCtx struct {
	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"`
	Source                string `yaml:"source" bson:"source" json:"source"`
	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 DockerConfig

type DockerConfig struct {
	HostList []string
}

type EnvConfig

type EnvConfig struct {
	EnvName string   `bson:"env_name,omitempty" json:"env_name"`
	HostIDs []string `bson:"host_ids,omitempty" json:"host_ids"`
}

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)

ToSubTask ...

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 GithubConfig

type GithubConfig struct {
	// github API access token
	AccessToken string `json:"access_token"`
	// github ssh key with base64 encoded
	SSHKey string `json:"ssh_key"`
	// github knownhost
	KnownHost string `json:"known_host"`
	// github app private key
	AppKey string `json:"app_key"`
	// gihhub app id
	AppID int `json:"app_id"`
}

type GitlabConfig

type GitlabConfig struct {
	APIServer string
	// Github API access token
	AccessToken string
	// gitlab ssh key with base64 encoded
	SSHKey string
	// gitlab knownhost
	KnownHost string
}

type HookPayload

type HookPayload struct {
	Owner      string `bson:"owner"          json:"owner,omitempty"`
	Repo       string `bson:"repo"           json:"repo,omitempty"`
	Branch     string `bson:"branch"         json:"branch,omitempty"`
	Ref        string `bson:"ref"            json:"ref,omitempty"`
	IsPr       bool   `bson:"is_pr"          json:"is_pr,omitempty"`
	CheckRunID int64  `bson:"check_run_id"   json:"check_run_id,omitempty"`
	DeliveryID string `bson:"delivery_id"    json:"delivery_id,omitempty"`
}

type ImageData added in v1.8.0

type ImageData struct {
	ImageUrl   string `bson:"image_url"   json:"image_url"      yaml:"image_url"`
	ImageName  string `bson:"image_name"  json:"image_name"     yaml:"image_name"`
	ImageTag   string `bson:"image_tag"   json:"image_tag"      yaml:"image_tag"`
	CustomTag  string `bson:"custom_tag"  json:"custom_tag"     yaml:"custom_tag"`
	RegistryID string `bson:"registry_id" json:"registry_id"    yaml:"registry_id"`
}

type ImageReleaseConfig

type ImageReleaseConfig struct {
	Addr      string
	AccessKey string
	SecretKey string
}

type ImagesByService added in v1.8.0

type ImagesByService struct {
	ServiceName string       `bson:"service_name" json:"service_name" yaml:"service_name"`
	Images      []*ImageData `bson:"images"       json:"images"       yaml:"images"`
}

type Install

type Install struct {
	ObjectIDHex  string   `bson:"-"                      json:"-"`
	Name         string   `bson:"name"                   json:"name"`
	Version      string   `bson:"version"                json:"version"`
	Scripts      string   `bson:"scripts"                json:"scripts"`
	UpdateTime   int64    `bson:"update_time"            json:"update_time"`
	UpdateBy     string   `bson:"update_by"              json:"update_by"`
	Envs         []string `bson:"env"                    json:"env"`
	BinPath      string   `bson:"bin_path"               json:"bin_path"`
	Enabled      bool     `bson:"enabled"                json:"enabled"`
	DownloadPath string   `bson:"download_path"          json:"download_path"`
}

type Item

type Item struct {
	Name    string `bson:"name"                   json:"name"`
	Version string `bson:"version"                json:"version"`
}

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:"jenkins_integration"     json:"jenkins_integration"`
	JenkinsBuildArgs   *JenkinsBuildArgs    `bson:"jenkins_build_args"      json:"jenkins_build_args"`
	Registries         []*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)

type JenkinsBuildArgs

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

type JenkinsBuildConfig

type JenkinsBuildConfig struct {
	JenkinsBuildImage string
}

type JenkinsBuildParam

type JenkinsBuildParam struct {
	Name  string      `json:"name"`
	Value interface{} `json:"value"`
}

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     []*Repository   `bson:"builds,omitempty"         json:"builds,omitempty"`
	// TODO: (min) move JiraIssue back to this file
	Issues    []*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)

type JiraIssue

type JiraIssue struct {
	ID          string `bson:"id,omitempty"                    json:"id,omitempty"`
	Key         string `bson:"key,omitempty"                   json:"key,omitempty"`
	URL         string `bson:"url,omitempty"                   json:"url,omitempty"`
	Summary     string `bson:"summary"                         json:"summary"`
	Description string `bson:"description,omitempty"           json:"description,omitempty"`
	Priority    string `bson:"priority,omitempty"              json:"priority,omitempty"`
	Creator     string `bson:"creator,omitempty"               json:"creator,omitempty"`
	Assignee    string `bson:"assignee,omitempty"              json:"assignee,omitempty"`
	Reporter    string `bson:"reporter,omitempty"              json:"reporter,omitempty"`
}

type JobCtx

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

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

	// BuildJobCtx
	Builds     []*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     []*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,omitempty"     json:"test_report_path,omitempty"`
	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"`

	// TODO: Deprecated.
	Caches []string `bson:"caches" json:"caches"`

	// buildV3
	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                             `json:"upload_enabled"`
	UploadStorageInfo *types.ObjectStorageInfo         `json:"upload_storage_info"`
	UploadInfo        []*types.ObjectStoragePathDetail `json:"upload_info"`
}

type JobCtxBuilder

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

type K8SCluster added in v1.8.0

type K8SCluster struct {
	ID             string          `json:"id,omitempty"                bson:"id,omitempty"`
	Name           string          `json:"name"                        bson:"name"`
	AdvancedConfig *AdvancedConfig `json:"advanced_config,omitempty"   bson:"advanced_config,omitempty"`
}

type KeyVal

type KeyVal struct {
	Key          string               `bson:"key"                 json:"key"`
	Value        string               `bson:"value"               json:"value"`
	Type         ParameterSettingType `bson:"type,omitempty"                json:"type,omitempty"`
	ChoiceOption []string             `bson:"choice_option,omitempty"       json:"choice_option,omitempty"`
	IsCredential bool                 `bson:"is_credential"       json:"is_credential"`
}

type NodeSelectorRequirement added in v1.8.0

type NodeSelectorRequirement struct {
	Key      string                      `json:"key"`
	Value    []string                    `json:"value"`
	Operator corev1.NodeSelectorOperator `json:"operator"`
}

type ParameterSettingType added in v1.9.0

type ParameterSettingType string
const (
	StringType ParameterSettingType = "string"
	ChoiceType ParameterSettingType = "choice"
)

type PipelineCtx

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

	// New since V1.10.0.
	Cache        types.Cache
	CacheEnable  bool
	CacheDirType types.CacheDirType
	CacheUserDir string

	UseHostDockerDaemon bool
}

type PrivateKey added in v1.2.0

type PrivateKey struct {
	Name string `json:"name"`
}

type ProductService

type ProductService struct {
	ServiceName string           `bson:"service_name"               json:"service_name"`
	ProductName string           `bson:"product_name"               json:"product_name"`
	Type        string           `bson:"type"                       json:"type"`
	Revision    int64            `bson:"revision"                   json:"revision"`
	Containers  []*Container     `bson:"containers"                 json:"containers,omitempty"`
	Configs     []*ServiceConfig `bson:"configs,omitempty"          json:"configs,omitempty"`
	Render      *RenderInfo      `bson:"render,omitempty"           json:"render,omitempty"` // 记录每个服务render信息 便于更新单个服务
	EnvConfigs  []*EnvConfig     `bson:"-"                          json:"env_configs,omitempty"`
}

type Proxy

type Proxy struct {
	//ID primitive.ObjectID `bson:"_id,omitempty"           json:"id,omitempty"`
	// http或socks5 暂时只支持http代理
	Type         string `bson:"type"                         json:"type"`
	Address      string `bson:"address"                      json:"address"`
	Port         int    `bson:"port"                         json:"port"`
	NeedPassword bool   `bson:"need_password"                json:"need_password"`
	Username     string `bson:"username"                     json:"username"`
	Password     string `bson:"password"                     json:"password"`
	// 代理用途,app表示应用代理,repo表示代码库代理。保留字段,暂时默认设置为default,以后可能用到。
	Usage                  string `bson:"usage"                        json:"usage"`
	EnableRepoProxy        bool   `bson:"enable_repo_proxy"            json:"enable_repo_proxy"`
	EnableApplicationProxy bool   `bson:"enable_application_proxy"     json:"enable_application_proxy"`
	CreateTime             int64  `bson:"create_time"                  json:"create_time"`
	UpdateTime             int64  `bson:"update_time"                  json:"update_time"`
	UpdateBy               string `bson:"update_by"                    json:"update_by"`
}

func (*Proxy) GetProxyURL

func (p *Proxy) GetProxyURL() string

func (Proxy) TableName

func (Proxy) TableName() string

type ProxyConfig

type ProxyConfig struct {
	HTTPAddr   string
	HTTPSAddr  string
	Socks5Addr string
	NoProxy    string
}

type RegistryConfig

type RegistryConfig struct {
	Addr        string
	AccessKey   string
	SecretKey   string
	Namespace   string
	RepoAddress string
}

type RegistryNamespace

type RegistryNamespace struct {
	ID          string `bson:"_id,omitempty"               json:"id,omitempty"`
	RegAddr     string `bson:"reg_addr"                    json:"reg_addr"`
	RegType     string `bson:"reg_type"                    json:"reg_type"`
	RegProvider string `bson:"reg_provider"                json:"reg_provider"`
	IsDefault   bool   `bson:"is_default"                  json:"is_default"`
	Namespace   string `bson:"namespace"                   json:"namespace"`
	AccessKey   string `bson:"access_key"                  json:"access_key"`
	SecretKey   string `bson:"secret_key"                  json:"secret_key"`
	Region      string `bson:"region,omitempty"            json:"region,omitempty"`
	UpdateTime  int64  `bson:"update_time"                 json:"update_time"`
	UpdateBy    string `bson:"update_by"                   json:"update_by"`
}

type ReleaseConfig

type ReleaseConfig struct {
	// ReaperImage sets build job image
	// e.g. xxx.com/resources/reaper-plugin:1.0.0
	ReaperImage string
	// ReaperBinaryFile sets download url of reaper binary file in build job
	// e.g. http://resource.koderover.com/reaper-20201014203000
	ReaperBinaryFile string
	// PredatorImage sets docker build image
	// e.g. xxx.com/resources/predator-plugin:v0.1.0
	PredatorImage string
	// PackagerImage sets docker build image
	// e.g. xxx.com/resources/packager-plugin:v0.1.0
	PackagerImage string
}

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 []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)

func (*ReleaseImage) ToSubTask

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

type ReleaseImageItem

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

type RenderInfo

type RenderInfo struct {
	Name        string `bson:"name"                     json:"name"`
	Revision    int64  `bson:"revision"                 json:"revision"`
	ProductTmpl string `bson:"product_tmpl"             json:"product_tmpl"`
	Description string `bson:"description"              json:"description"`
}

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 RepoImage

type RepoImage struct {
	RepoID    string `json:"repo_id" bson:"repo_id"`
	Name      string `json:"name" bson:"name" yaml:"name"`
	Username  string `json:"-" yaml:"username"`
	Password  string `json:"-" yaml:"password"`
	Host      string `json:"host" yaml:"host"`
	Namespace string `json:"namespace" yaml:"namespace"`
}

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 Repository

type Repository struct {
	// Source is github, gitlab
	Source        string `bson:"source,omitempty"          json:"source,omitempty"`
	RepoOwner     string `bson:"repo_owner"                json:"repo_owner"`
	RepoName      string `bson:"repo_name"                 json:"repo_name"`
	RepoNamespace string `bson:"repo_namespace"            json:"repo_namespace"`
	RemoteName    string `bson:"remote_name,omitempty"     json:"remote_name,omitempty"`
	Branch        string `bson:"branch"                    json:"branch"`
	PR            int    `bson:"pr,omitempty"              json:"pr,omitempty"`
	PRs           []int  `bson:"prs,omitempty"             json:"prs,omitempty"`
	Tag           string `bson:"tag,omitempty"             json:"tag,omitempty"`
	CommitID      string `bson:"commit_id,omitempty"       json:"commit_id,omitempty"`
	CommitMessage string `bson:"commit_message,omitempty"  json:"commit_message,omitempty"`
	CheckoutPath  string `bson:"checkout_path,omitempty"   json:"checkout_path,omitempty"`
	SubModules    bool   `bson:"submodules,omitempty"      json:"submodules,omitempty"`
	// UseDefault defines if the repo can be configured in start pipeline task page
	UseDefault bool `bson:"use_default,omitempty"          json:"use_default,omitempty"`
	// IsPrimary used to generated image and package name, each build has one primary repo
	IsPrimary  bool `bson:"is_primary"                     json:"is_primary"`
	CodehostID int  `bson:"codehost_id"                    json:"codehost_id"`
	// add
	OauthToken  string `bson:"oauth_token"                  json:"oauth_token"`
	Address     string `bson:"address"                      json:"address"`
	AuthorName  string `bson:"author_name,omitempty"        json:"author_name,omitempty"`
	CheckoutRef string `bson:"checkout_ref,omitempty"       json:"checkout_ref,omitempty"`
	Username    string `bson:"username,omitempty"           json:"username,omitempty"`
	Password    string `bson:"password,omitempty"           json:"password,omitempty"`
	ProjectUUID string `bson:"project_uuid,omitempty"       json:"project_uuid,omitempty"`
	RepoUUID    string `bson:"repo_uuid,omitempty"          json:"repo_uuid,omitempty"`
	RepoID      string `bson:"repo_id,omitempty"            json:"repo_id,omitempty"`
	EnableProxy bool   `bson:"enable_proxy,omitempty"       json:"enable_proxy,omitempty"`
	// The address of the code base input of the other type
	AuthType           types.AuthType `bson:"auth_type,omitempty"             json:"auth_type,omitempty"`
	SSHKey             string         `bson:"ssh_key,omitempty"               json:"ssh_key,omitempty"`
	PrivateAccessToken string         `bson:"private_access_token,omitempty"  json:"private_access_token,omitempty"`
}

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 S3Config

type S3Config struct {
	Ak       string
	Sk       string
	Endpoint string
	Bucket   string
	Path     string
	Protocol string
	Provider int8
	Region   string
}

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 []*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"`
	PreScript        string     `bson:"pre_script"            json:"pre_script"`
	CheckQualityGate bool       `bson:"check_quality_gate"    json:"check_quality_gate"`
	InstallCtx       []*Install `bson:"-"                     json:"install_ctx"`
}

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 ServiceConfig

type ServiceConfig struct {
	ConfigName string `bson:"config_name"           json:"config_name"`
	Revision   int64  `bson:"revision"              json:"revision"`
}

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 ServiceTaskArgs

type ServiceTaskArgs struct {
	ProductName        string   `bson:"product_name"            json:"product_name"`
	ServiceName        string   `bson:"service_name"            json:"service_name"`
	Revision           int64    `bson:"revision"                json:"revision"`
	BuildName          string   `bson:"build_name"              json:"build_name"`
	EnvNames           []string `bson:"env_names"               json:"env_names"`
	ServiceTaskCreator string   `bson:"service_task_creator"    json:"service_task_creator"`
	Namespace          string   `bson:"namespace"               json:"namespace"`
	K8sNamespace       string   `bson:"k8s_namespace"           json:"k8s_namespace"`
	Updatable          bool     `bson:"updatable"               json:"updatable"`
}

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 TargetArgs

type TargetArgs struct {
	Name             string            `bson:"name"                          json:"name"`
	ImageName        string            `bson:"image_name"                    json:"image_name"`
	ServiceName      string            `bson:"service_name"                  json:"service_name"`
	ServiceType      string            `bson:"service_type,omitempty"        json:"service_type,omitempty"`
	ProductName      string            `bson:"product_name"                  json:"product_name"`
	Build            *BuildArgs        `bson:"build"                         json:"build"`
	Deploy           []DeployEnv       `bson:"deploy"                        json:"deploy"`
	Image            string            `bson:"image,omitempty"               json:"image,omitempty"`
	BinFile          string            `bson:"bin_file"                      json:"bin_file"`
	Envs             []*KeyVal         `bson:"envs"                          json:"envs"`
	HasBuild         bool              `bson:"has_build"                     json:"has_build"`
	JenkinsBuildArgs *JenkinsBuildArgs `bson:"jenkins_build_args,omitempty"  json:"jenkins_build_args,omitempty"`
}

type Task

type Task 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"`
	PipelineDisplayName string                   `bson:"pipeline_display_name"     json:"pipeline_display_name"`
	Namespace           string                   `bson:"namespace,omitempty"       json:"namespace,omitempty"`
	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              []*common.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"`
	TeamID              int                      `bson:"team_id,omitempty"         json:"team_id,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"`
	// is allowed to run multiple times
	MultiRun bool `bson:"multi_run"                 json:"multi_run"`
	// target is container name when k8s, service name when pm
	Target string `bson:"target,omitempty"                    json:"target"`
	// generate SubTasks with predefine build module,
	// query filter param:  ServiceTmpl,  BuildModuleVer
	// if nil,use pipeline self define SubTasks
	BuildModuleVer string `bson:"build_module_ver,omitempty"                 json:"build_module_ver"`
	ServiceName    string `bson:"service_name,omitempty"              json:"service_name,omitempty"`
	// TaskArgs single workflow args
	TaskArgs *TaskArgs `bson:"task_args,omitempty"         json:"task_args,omitempty"`
	// WorkflowArgs multi workflow args
	WorkflowArgs *WorkflowTaskArgs `bson:"workflow_args"         json:"workflow_args,omitempty"`
	// TestArgs test workflow args
	TestArgs *TestTaskArgs `bson:"test_args,omitempty"         json:"test_args,omitempty"`
	// ServiceTaskArgs sh deploy args
	ServiceTaskArgs *ServiceTaskArgs `bson:"service_args,omitempty"         json:"service_args,omitempty"`
	// ArtifactPackageTaskArgs arguments for artifact-package type tasks
	ArtifactPackageTaskArgs *ArtifactPackageTaskArgs `bson:"artifact_package_args,omitempty"         json:"artifact_package_args,omitempty"`
	// ConfigPayload system config info
	ConfigPayload *ConfigPayload      `json:"config_payload,omitempty"`
	Error         string              `bson:"error,omitempty"                json:"error,omitempty"`
	Services      [][]*ProductService `bson:"services"                  json:"services"`
	Render        *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        *TriggerBy                   `json:"trigger_by,omitempty" bson:"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"`
	ArtifactInfo     *ArtifactInfo                `bson:"artifact_info"               json:"artifact_info"`
}

func (Task) TableName

func (Task) TableName() string

type TaskArgs

type TaskArgs struct {
	ProductName    string        `bson:"product_name"            json:"product_name"`
	PipelineName   string        `bson:"pipeline_name"           json:"pipeline_name"`
	Builds         []*Repository `bson:"builds"                  json:"builds"`
	BuildArgs      []*KeyVal     `bson:"build_args"              json:"build_args"`
	Deploy         DeployArgs    `bson:"deploy"                  json:"deploy"`
	Test           TestArgs      `bson:"test"                    json:"test,omitempty"`
	HookPayload    *HookPayload  `bson:"hook_payload"            json:"hook_payload,omitempty"`
	TaskCreator    string        `bson:"task_creator"            json:"task_creator,omitempty"`
	ReqID          string        `bson:"req_id"                  json:"req_id"`
	IsQiNiu        bool          `bson:"is_qiniu"                json:"is_qiniu"`
	NotificationID string        `bson:"notification_id"         json:"notification_id"`
}

type TaskOutput added in v1.8.0

type TaskOutput struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

type TestArgs

type TestArgs struct {
	Namespace      string        `bson:"namespace" json:"namespace"`
	TestModuleName string        `bson:"test_module_name" json:"test_module_name"`
	Envs           []*KeyVal     `bson:"envs" json:"envs"`
	Builds         []*Repository `bson:"builds" json:"builds"`
}

type TestConfig

type TestConfig struct {
	KubeNamespace string
}

type TestTaskArgs

type TestTaskArgs struct {
	ProductName     string `bson:"product_name"            json:"product_name"`
	TestName        string `bson:"test_name"               json:"test_name"`
	TestTaskCreator string `bson:"test_task_creator"       json:"test_task_creator"`
	NotificationID  string `bson:"notification_id"         json:"notification_id"`
	ReqID           string `bson:"req_id"                  json:"req_id"`
	// webhook触发测试任务时,触发任务的repo、prID和commitID
	MergeRequestID string `bson:"merge_request_id" json:"merge_request_id"`
	CommitID       string `bson:"commit_id"        json:"commit_id"`
	Source         string `bson:"source"           json:"source"`
	CodehostID     int    `bson:"codehost_id"      json:"codehost_id"`
	RepoOwner      string `bson:"repo_owner"       json:"repo_owner"`
	RepoName       string `bson:"repo_name"        json:"repo_name"`
}

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 []*Item         `bson:"install_items"                   json:"install_items"`
	InstallCtx   []*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     []*RegistryNamespace `bson:"-"                               json:"registries"`
	ClusterID      string               `bson:"cluster_id"                      json:"cluster_id"`
	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 TriggerBy

type TriggerBy struct {
	// 触发此次任务的代码库信息
	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"`
	Source     string `json:"source,omitempty" bson:"source,omitempty"`
	// 触发此次任务的merge request id,用于判断多个任务对应的commit是否属于同一个merge request
	MergeRequestID string `json:"merge_request_id,omitempty" bson:"merge_request_id,omitempty"`
	// 触发此次任务的commit id
	CommitID string `json:"commit_id,omitempty" bson:"commit_id,omitempty"`
}

type UTStatus

type UTStatus struct {
	StepStatus

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

type VersionArgs

type VersionArgs struct {
	Enabled bool     `bson:"enabled" json:"enabled"`
	Version string   `bson:"version" json:"version"`
	Desc    string   `bson:"desc"    json:"desc"`
	Labels  []string `bson:"labels"  json:"labels"`
}

type WebhookPayload added in v1.8.0

type WebhookPayload struct {
	EventName      string         `json:"event_name"`
	ProjectName    string         `json:"project_name"`
	TaskName       string         `json:"task_name"`
	TaskID         int64          `json:"task_id"`
	TaskOutput     []*TaskOutput  `json:"task_output,omitempty"`
	TaskEnvs       []*KeyVal      `json:"task_envs,omitempty"`
	ServiceInfos   []*ServiceInfo `json:"service_infos"`
	Creator        string         `json:"creator"`
	WorkflowStatus config.Status  `json:"workflow_status"`
}

type WorkflowTaskArgs

type WorkflowTaskArgs struct {
	WorkflowName    string `bson:"workflow_name"                json:"workflow_name"`
	ProductTmplName string `bson:"product_tmpl_name"            json:"product_tmpl_name"`
	Description     string `bson:"description,omitempty"        json:"description,omitempty"`
	//为了兼容老数据,namespace可能会存多个环境名称,用逗号隔开
	Namespace          string          `bson:"namespace"                    json:"namespace"`
	BaseNamespace      string          `bson:"base_namespace,omitempty"     json:"base_namespace,omitempty"`
	EnvRecyclePolicy   string          `bson:"env_recycle_policy,omitempty" json:"env_recycle_policy,omitempty"`
	EnvUpdatePolicy    string          `bson:"env_update_policy,omitempty"  json:"env_update_policy,omitempty"`
	Target             []*TargetArgs   `bson:"targets"                      json:"targets"`
	Artifact           []*ArtifactArgs `bson:"artifact_args"                json:"artifact_args"`
	Tests              []*TestArgs     `bson:"tests"                        json:"tests"`
	VersionArgs        *VersionArgs    `bson:"version_args,omitempty"       json:"version_args,omitempty"`
	ReqID              string          `bson:"req_id"                       json:"req_id"`
	RegistryID         string          `bson:"registry_id,omitempty"        json:"registry_id,omitempty"`
	StorageID          string          `bson:"storage_id,omitempty"         json:"storage_id,omitempty"`
	DistributeEnabled  bool            `bson:"distribute_enabled"           json:"distribute_enabled"`
	WorklowTaskCreator string          `bson:"workflow_task_creator"        json:"workflow_task_creator"`
	// Ignore docker build cache
	IgnoreCache bool `json:"ignore_cache" bson:"ignore_cache"`
	// Ignore workspace cache and reset volume
	ResetCache bool `json:"reset_cache" bson:"reset_cache"`

	// NotificationId is the id of scmnotify.Notification
	NotificationID string `bson:"notification_id" json:"notification_id"`

	// webhook触发工作流任务时,触发任务的repo信息、prID和commitID
	MergeRequestID string `bson:"merge_request_id" json:"merge_request_id"`
	CommitID       string `bson:"commit_id"        json:"commit_id"`
	Source         string `bson:"source"           json:"source"`
	CodehostID     int    `bson:"codehost_id"      json:"codehost_id"`
	RepoOwner      string `bson:"repo_owner"       json:"repo_owner"`
	RepoNamespace  string `bson:"repo_namespace"   json:"repo_namespace"`
	RepoName       string `bson:"repo_name"        json:"repo_name"`
	Committer      string `bson:"committer,omitempty"        json:"committer,omitempty"`
	//github check run
	HookPayload *HookPayload `bson:"hook_payload"            json:"hook_payload,omitempty"`
	// 请求模式,openAPI表示外部客户调用
	RequestMode string `json:"request_mode,omitempty"`
	IsParallel  bool   `json:"is_parallel" bson:"is_parallel"`

	Callback *CallbackArgs `bson:"callback"                    json:"callback"`
}

Jump to

Keyboard shortcuts

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