Documentation ¶
Index ¶
- Constants
- Variables
- func AddJiraSubTask(moduleName, target, serviceName, productName string, log *zap.SugaredLogger) (map[string]interface{}, error)
- func AddPipelineJiraSubTask(pipeline *commonmodels.Pipeline, log *zap.SugaredLogger) (map[string]interface{}, error)
- func AddSubtaskToStage(stages *[]*commonmodels.Stage, subTask map[string]interface{}, target string)
- func BlockedTaskQueue() ([]*task.Task, error)
- func BuildModuleToSubTasks(args *commonmodels.BuildModuleArgs, log *zap.SugaredLogger) ([]map[string]interface{}, error)
- func Clean(task *task.Task)
- func CleanWorkflow3(task *task.Task)
- func ConvertQueueToTask(queueTask *commonmodels.Queue) *task.Task
- func ConvertTaskToQueue(task *task.Task) *commonmodels.Queue
- func CopyPipeline(oldPipelineName, newPipelineName, username string, log *zap.SugaredLogger) error
- func CopyWorkflow(oldWorkflowName, newWorkflowName, username string, log *zap.SugaredLogger) error
- func CreateArtifactPackageTask(args *commonmodels.ArtifactPackageTaskArgs, taskCreator string, ...) (int64, error)
- func CreateFavoritePipeline(args *commonmodels.Favorite, log *zap.SugaredLogger) error
- func CreateGerritWebhook(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
- func CreateTask(t *task.Task) error
- func CreateWorkflow(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
- func CreateWorkflowV3(user string, workflowModel *commonmodels.WorkflowV3, logger *zap.SugaredLogger) (string, error)
- func DeleteCronjob(parentName, parentType string) error
- func DeleteFavoritePipeline(args *commonrepo.FavoriteArgs) error
- func DeleteGerritWebhook(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
- func DeleteWorkflowV3(id string, logger *zap.SugaredLogger) error
- func EnsureBuildResp(mb *commonmodels.Build)
- func EnsureSubTasksResp(subTasks []map[string]interface{})
- func EnsureSubTasksV3Resp(subTasks []map[string]interface{})
- func EnsureTaskResp(mt *commonmodels.Testing)
- func EnsureTestingResp(mt *commonmodels.Testing)
- func FindWorkflow(workflowName string, log *zap.SugaredLogger) (*commonmodels.Workflow, error)
- func FmtBuilds(builds []*types.Repository, log *zap.SugaredLogger)
- func GePackageFileContent(pipelineName string, taskID int64, log *zap.SugaredLogger) ([]byte, string, error)
- func GetArtifactAndS3Info(pipelineName, dir string, taskID int64, log *zap.SugaredLogger) (*s3.S3, *s3tool.Client, []string, error)
- func GetArtifactFileContent(pipelineName string, taskID int64, log *zap.SugaredLogger) ([]byte, error)
- func GetImage(registry *commonmodels.RegistryNamespace, suffix string) string
- func GetLink(p *task.Task, baseURI string, taskType config.PipelineType) string
- func GetPackageFile(suffix string) string
- func GetPipeline(userID, pipelineName string, log *zap.SugaredLogger) (*commonmodels.Pipeline, error)
- func GetPipelineTaskV2(taskID int64, pipelineName string, typeString config.PipelineType, ...) (*task.Task, error)
- func GetRaw(name, productName string, log *zap.SugaredLogger) (*commonmodels.Testing, error)
- func GetS3RelStorage(logger *zap.SugaredLogger) (*commonmodels.S3Storage, error)
- func GetS3Storage(id string, logger *zap.SugaredLogger) (*commonmodels.S3Storage, error)
- func GetServiceNames(p *commonmodels.Product) []string
- func GetTesting(name, productName string, log *zap.SugaredLogger) (*commonmodels.Testing, error)
- func GetWorkflowTaskV3(taskID int64, pipelineName string, typeString config.PipelineType, ...) (*task.Task, error)
- func GetWorkflowTaskV3Callback(taskID int64, pipelineName string, logger *zap.SugaredLogger) (*commonmodels.CallbackRequest, error)
- func HandleCronjob(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
- func InitPipelineController()
- func InitQueue() error
- func IsProductAuthed(username, productOwner, productName string, perm config.ProductPermission, ...) bool
- func JenkinsBuildModuleToSubTasks(jenkinsBuildOption *JenkinsBuildOption, log *zap.SugaredLogger) ([]map[string]interface{}, error)
- func ListBuildDetail(name, targets string, log *zap.SugaredLogger) ([]*commonmodels.Build, error)
- func ListFavoritePipelines(args *commonrepo.FavoriteArgs) ([]*commonmodels.Favorite, error)
- func ListPipelines(log *zap.SugaredLogger) ([]*commonmodels.Pipeline, error)
- func ListTasks() []*task.Task
- func ListTestWorkflows(testName string, projects []string, log *zap.SugaredLogger) (workflows []*commonmodels.Workflow, err error)
- func NextWaitingTask() (*task.Task, error)
- func ParallelRunningAndQueuedTasks(currentTask *task.Task) bool
- func PendingPipelineTasks() []*task.Task
- func PendingTasks() []*task.Task
- func PipelineTaskSender()
- func PresetWorkflowArgs(namespace, workflowName string, log *zap.SugaredLogger) (*commonmodels.WorkflowTaskArgs, error)
- func Push(pt *task.Task) error
- func RenamePipeline(oldName, newName string, log *zap.SugaredLogger) error
- func RestartPipelineTaskV2(userName string, taskID int64, pipelineName string, ...) error
- func RestartWorkflowTaskV3(userName string, taskID int64, workflowName string, ...) error
- func RunningAndQueuedTasks() []*task.Task
- func RunningPipelineTasks() []*task.Task
- func RunningTasks() []*task.Task
- func SetCandidateRegistry(payload *commonmodels.ConfigPayload, log *zap.SugaredLogger) error
- func SetTriggerBuilds(builds []*types.Repository, buildArgs []*types.Repository, ...) error
- func SubScribeNSQ() error
- func TestArgsToTestSubtask(args *commonmodels.TestTaskArgs, pt *task.Task, log *zap.SugaredLogger) (*task.Testing, error)
- func UIType(pipelineType config.PipelineType) string
- func UpdateCronjob(parentName, parentType, productName string, ...) (deleteList []string, err error)
- func UpdateGerritWebhook(currentWorkflow *commonmodels.Workflow, log *zap.SugaredLogger) error
- func UpdateQueue(task *task.Task) bool
- func UpdateTask(t *task.Task) error
- func UpdateTaskAgent(taskID int64, pipelineName string, createTime int64, agentID string) error
- func UpdateWorkflow(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
- func UpdateWorkflowV3(id, user string, workflowModel *commonmodels.WorkflowV3, ...) error
- func UpsertPipeline(args *commonmodels.Pipeline, log *zap.SugaredLogger) error
- type ByStageKind
- type ByTaskKind
- type CancelMessage
- type ContainerNotFound
- type CreateTaskResp
- func AddDataToArgsOrCreateReleaseImageTask(args *commonmodels.WorkflowTaskArgs, log *zap.SugaredLogger) (*CreateTaskResp, error)
- func CreateArtifactWorkflowTask(args *commonmodels.WorkflowTaskArgs, taskCreator string, ...) (*CreateTaskResp, error)
- func CreatePipelineTask(args *commonmodels.TaskArgs, log *zap.SugaredLogger) (*CreateTaskResp, error)
- func CreateServiceTask(args *commonmodels.ServiceTaskArgs, log *zap.SugaredLogger) ([]*CreateTaskResp, error)
- func CreateWorkflowTask(args *commonmodels.WorkflowTaskArgs, taskCreator string, ...) (*CreateTaskResp, error)
- type CronjobWorkflowArgs
- type DeployEnv
- type EnvStatus
- type ExternalParamMapping
- type ExternalSetting
- type GoCacheManager
- type ImageIllegal
- type ItReportHandler
- type JenkinsBuildOption
- type KV
- type PRCommit
- type ParameterSetting
- type ParameterSettingType
- type PipelinePreview
- type PreSetResp
- type Preview
- type ProductNameWithType
- type Queue
- func (q *Queue) BlockedTaskQueue() ([]*task.Task, error)
- func (q *Queue) List() []*task.Task
- func (q *Queue) NextWaitingTask() (*task.Task, error)
- func (q *Queue) Push(pt *task.Task) error
- func (q *Queue) Remove(task *task.Task) error
- func (q *Queue) Update(task *task.Task) bool
- func (q *Queue) UpdateAgent(taskID int64, pipelineName string, createTime int64, agentID string) error
- type RepoCommit
- type ServiceTaskPreview
- type TaskAckHandler
- type TaskInfo
- type TaskNotificationHandler
- type TaskResp
- type TaskResult
- type TaskV2Info
- type Workflow
- type WorkflowV3
- type WorkflowV3Brief
- type WorkflowV3TaskArgs
Constants ¶
const (
ClusterStorageEP = "nfs-server"
)
const (
NameSpaceRegexString = "[^a-z0-9.-]"
)
const SplitSymbol = "&"
Variables ¶
var (
NameSpaceRegex = regexp.MustCompile(NameSpaceRegexString)
)
var SubtaskOrder = map[config.TaskType]int{ config.TaskType("jira"): 1, config.TaskType("pipeline"): 2, config.TaskType("buildv2"): 3, config.TaskType("buildv3"): 4, config.TaskType("jenkins_build"): 5, config.TaskType("docker_build"): 6, config.TaskType("archive"): 7, config.TaskType("artifact"): 8, config.TaskType("artifact_deploy"): 9, config.TaskType("deploy"): 10, config.TaskType("testingv2"): 11, config.TaskType("security"): 12, config.TaskType("distribute2kodo"): 13, config.TaskType("release_image"): 14, config.TaskType("reset_image"): 15, config.TaskType("trigger"): 16, }
Functions ¶
func AddJiraSubTask ¶
func AddJiraSubTask(moduleName, target, serviceName, productName string, log *zap.SugaredLogger) (map[string]interface{}, error)
func AddPipelineJiraSubTask ¶
func AddPipelineJiraSubTask(pipeline *commonmodels.Pipeline, log *zap.SugaredLogger) (map[string]interface{}, error)
func AddSubtaskToStage ¶
func AddSubtaskToStage(stages *[]*commonmodels.Stage, subTask map[string]interface{}, target string)
func BlockedTaskQueue ¶
func BuildModuleToSubTasks ¶
func BuildModuleToSubTasks(args *commonmodels.BuildModuleArgs, log *zap.SugaredLogger) ([]map[string]interface{}, error)
func CleanWorkflow3 ¶ added in v1.8.0
func ConvertQueueToTask ¶
func ConvertQueueToTask(queueTask *commonmodels.Queue) *task.Task
func ConvertTaskToQueue ¶
func ConvertTaskToQueue(task *task.Task) *commonmodels.Queue
func CopyPipeline ¶ added in v1.2.0
func CopyPipeline(oldPipelineName, newPipelineName, username string, log *zap.SugaredLogger) error
func CopyWorkflow ¶
func CopyWorkflow(oldWorkflowName, newWorkflowName, username string, log *zap.SugaredLogger) error
func CreateArtifactPackageTask ¶ added in v1.8.0
func CreateArtifactPackageTask(args *commonmodels.ArtifactPackageTaskArgs, taskCreator string, log *zap.SugaredLogger) (int64, error)
get global config payload
func CreateFavoritePipeline ¶
func CreateFavoritePipeline(args *commonmodels.Favorite, log *zap.SugaredLogger) error
func CreateGerritWebhook ¶
func CreateGerritWebhook(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
func CreateTask ¶
CreateTask 接受create task请求, 保存task到数据库, 发送task到queue
func CreateWorkflow ¶
func CreateWorkflow(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
func CreateWorkflowV3 ¶ added in v1.8.0
func CreateWorkflowV3(user string, workflowModel *commonmodels.WorkflowV3, logger *zap.SugaredLogger) (string, error)
func DeleteCronjob ¶
func DeleteFavoritePipeline ¶
func DeleteFavoritePipeline(args *commonrepo.FavoriteArgs) error
func DeleteGerritWebhook ¶
func DeleteGerritWebhook(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
DeleteGerritWebhook 删除gerrit webhook
func DeleteWorkflowV3 ¶ added in v1.8.0
func DeleteWorkflowV3(id string, logger *zap.SugaredLogger) error
func EnsureBuildResp ¶
func EnsureBuildResp(mb *commonmodels.Build)
func EnsureSubTasksResp ¶
func EnsureSubTasksResp(subTasks []map[string]interface{})
EnsureSubTasksResp 确保SubTask中敏感信息和其他不必要信息不返回给前端
func EnsureSubTasksV3Resp ¶ added in v1.8.0
func EnsureSubTasksV3Resp(subTasks []map[string]interface{})
EnsureSubTasksResp 确保SubTask中敏感信息和其他不必要信息不返回给前端
func EnsureTaskResp ¶
func EnsureTaskResp(mt *commonmodels.Testing)
func EnsureTestingResp ¶
func EnsureTestingResp(mt *commonmodels.Testing)
func FindWorkflow ¶
func FindWorkflow(workflowName string, log *zap.SugaredLogger) (*commonmodels.Workflow, error)
func FmtBuilds ¶
func FmtBuilds(builds []*types.Repository, log *zap.SugaredLogger)
replace gitInfo with codehostID
func GePackageFileContent ¶ added in v1.2.0
func GetArtifactAndS3Info ¶ added in v1.6.0
func GetArtifactFileContent ¶
func GetImage ¶
func GetImage(registry *commonmodels.RegistryNamespace, suffix string) string
GetImage suffix 可以是 branch name 或者 pr number
func GetPackageFile ¶
GetPackageFile suffix 可以是 branch name 或者 pr number
func GetPipeline ¶ added in v1.2.0
func GetPipeline(userID, pipelineName string, log *zap.SugaredLogger) (*commonmodels.Pipeline, error)
func GetPipelineTaskV2 ¶
func GetPipelineTaskV2(taskID int64, pipelineName string, typeString config.PipelineType, log *zap.SugaredLogger) (*task.Task, error)
func GetRaw ¶
func GetRaw(name, productName string, log *zap.SugaredLogger) (*commonmodels.Testing, error)
GetRaw find the testing module with secret env not masked
func GetS3RelStorage ¶
func GetS3RelStorage(logger *zap.SugaredLogger) (*commonmodels.S3Storage, error)
GetS3RelStorage find the default s3storage
func GetS3Storage ¶
func GetS3Storage(id string, logger *zap.SugaredLogger) (*commonmodels.S3Storage, error)
func GetServiceNames ¶
func GetServiceNames(p *commonmodels.Product) []string
func GetTesting ¶
func GetTesting(name, productName string, log *zap.SugaredLogger) (*commonmodels.Testing, error)
func GetWorkflowTaskV3 ¶ added in v1.8.0
func GetWorkflowTaskV3(taskID int64, pipelineName string, typeString config.PipelineType, log *zap.SugaredLogger) (*task.Task, error)
func GetWorkflowTaskV3Callback ¶ added in v1.8.0
func GetWorkflowTaskV3Callback(taskID int64, pipelineName string, logger *zap.SugaredLogger) (*commonmodels.CallbackRequest, error)
func HandleCronjob ¶
func HandleCronjob(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
func InitPipelineController ¶
func InitPipelineController()
func IsProductAuthed ¶
func IsProductAuthed(username, productOwner, productName string, perm config.ProductPermission, log *zap.SugaredLogger) bool
IsProductAuthed 查询指定产品是否授权给用户, 或者用户所在的组 TODO: REVERT Auth is diabled
func JenkinsBuildModuleToSubTasks ¶
func JenkinsBuildModuleToSubTasks(jenkinsBuildOption *JenkinsBuildOption, log *zap.SugaredLogger) ([]map[string]interface{}, error)
func ListBuildDetail ¶
func ListBuildDetail(name, targets string, log *zap.SugaredLogger) ([]*commonmodels.Build, error)
func ListFavoritePipelines ¶
func ListFavoritePipelines(args *commonrepo.FavoriteArgs) ([]*commonmodels.Favorite, error)
func ListPipelines ¶ added in v1.2.0
func ListPipelines(log *zap.SugaredLogger) ([]*commonmodels.Pipeline, error)
func ListTestWorkflows ¶ added in v1.7.0
func ListTestWorkflows(testName string, projects []string, log *zap.SugaredLogger) (workflows []*commonmodels.Workflow, err error)
func PendingPipelineTasks ¶
func PendingTasks ¶
func PipelineTaskSender ¶
func PipelineTaskSender()
PipelineTaskSender 监控warpdrive空闲情况, 如果有空闲, 则发现下一个waiting task给warpdrive 并将task状态设置为queued
func PresetWorkflowArgs ¶
func PresetWorkflowArgs(namespace, workflowName string, log *zap.SugaredLogger) (*commonmodels.WorkflowTaskArgs, error)
PresetWorkflowArgs 返回工作流详细信息
func RenamePipeline ¶ added in v1.2.0
func RenamePipeline(oldName, newName string, log *zap.SugaredLogger) error
func RestartPipelineTaskV2 ¶
func RestartPipelineTaskV2(userName string, taskID int64, pipelineName string, typeString config.PipelineType, log *zap.SugaredLogger) error
func RestartWorkflowTaskV3 ¶ added in v1.8.0
func RestartWorkflowTaskV3(userName string, taskID int64, workflowName string, typeString config.PipelineType, log *zap.SugaredLogger) error
func RunningAndQueuedTasks ¶
func RunningPipelineTasks ¶
func RunningTasks ¶
func SetCandidateRegistry ¶
func SetCandidateRegistry(payload *commonmodels.ConfigPayload, log *zap.SugaredLogger) error
func SetTriggerBuilds ¶
func SetTriggerBuilds(builds []*types.Repository, buildArgs []*types.Repository, log *zap.SugaredLogger) error
外部触发任务设置build参数
func SubScribeNSQ ¶
func SubScribeNSQ() error
func TestArgsToTestSubtask ¶
func TestArgsToTestSubtask(args *commonmodels.TestTaskArgs, pt *task.Task, log *zap.SugaredLogger) (*task.Testing, error)
func UIType ¶
func UIType(pipelineType config.PipelineType) string
func UpdateCronjob ¶
func UpdateCronjob(parentName, parentType, productName string, schedule *commonmodels.ScheduleCtrl, log *zap.SugaredLogger) (deleteList []string, err error)
func UpdateGerritWebhook ¶
func UpdateGerritWebhook(currentWorkflow *commonmodels.Workflow, log *zap.SugaredLogger) error
UpdateGerritWebhook 更新gerrit webhook
func UpdateQueue ¶
func UpdateTask ¶
func UpdateTaskAgent ¶
func UpdateWorkflow ¶
func UpdateWorkflow(workflow *commonmodels.Workflow, log *zap.SugaredLogger) error
func UpdateWorkflowV3 ¶ added in v1.8.0
func UpdateWorkflowV3(id, user string, workflowModel *commonmodels.WorkflowV3, logger *zap.SugaredLogger) error
func UpsertPipeline ¶ added in v1.2.0
func UpsertPipeline(args *commonmodels.Pipeline, log *zap.SugaredLogger) error
Types ¶
type ByStageKind ¶
type ByStageKind []*commonmodels.Stage
func (ByStageKind) Len ¶
func (a ByStageKind) Len() int
func (ByStageKind) Less ¶
func (a ByStageKind) Less(i, j int) bool
func (ByStageKind) Swap ¶
func (a ByStageKind) Swap(i, j int)
type ByTaskKind ¶
type ByTaskKind []map[string]interface{}
func (ByTaskKind) Len ¶
func (a ByTaskKind) Len() int
func (ByTaskKind) Less ¶
func (a ByTaskKind) Less(i, j int) bool
func (ByTaskKind) Swap ¶
func (a ByTaskKind) Swap(i, j int)
type CancelMessage ¶
type ContainerNotFound ¶
type ContainerNotFound struct { ServiceName string Container string EnvName string ProductName string }
func (*ContainerNotFound) Error ¶
func (c *ContainerNotFound) Error() string
type CreateTaskResp ¶
type CreateTaskResp struct { ProjectName string `json:"project_name"` PipelineName string `json:"pipeline_name"` TaskID int64 `json:"task_id"` }
func AddDataToArgsOrCreateReleaseImageTask ¶ added in v1.8.0
func AddDataToArgsOrCreateReleaseImageTask(args *commonmodels.WorkflowTaskArgs, log *zap.SugaredLogger) (*CreateTaskResp, error)
add data to workflow args or create release image task
func CreateArtifactWorkflowTask ¶
func CreateArtifactWorkflowTask(args *commonmodels.WorkflowTaskArgs, taskCreator string, log *zap.SugaredLogger) (*CreateTaskResp, error)
func CreatePipelineTask ¶
func CreatePipelineTask(args *commonmodels.TaskArgs, log *zap.SugaredLogger) (*CreateTaskResp, error)
func CreateServiceTask ¶ added in v1.2.0
func CreateServiceTask(args *commonmodels.ServiceTaskArgs, log *zap.SugaredLogger) ([]*CreateTaskResp, error)
func CreateWorkflowTask ¶
func CreateWorkflowTask(args *commonmodels.WorkflowTaskArgs, taskCreator string, log *zap.SugaredLogger) (*CreateTaskResp, error)
type CronjobWorkflowArgs ¶
type CronjobWorkflowArgs struct {
Target []*commonmodels.TargetArgs `bson:"targets" json:"targets"`
}
func GetWorkflowArgs ¶
func GetWorkflowArgs(productName, namespace string, log *zap.SugaredLogger) (*CronjobWorkflowArgs, error)
GetWorkflowArgs 返回工作流详细信息
type EnvStatus ¶
type EnvStatus struct { EnvName string `json:"env_name,omitempty"` Status string `json:"status"` ErrMessage string `json:"err_message"` }
func AutoCreateWorkflow ¶
func AutoCreateWorkflow(productName string, log *zap.SugaredLogger) *EnvStatus
type ExternalParamMapping ¶ added in v1.8.0
type ExternalSetting ¶ added in v1.8.0
type GoCacheManager ¶
type GoCacheManager struct{}
GoCacheManager is deprecated
func NewGoCacheManager ¶
func NewGoCacheManager() *GoCacheManager
func (*GoCacheManager) Archive ¶
func (gcm *GoCacheManager) Archive(source, dest string) error
type ImageIllegal ¶
type ImageIllegal struct { }
func (*ImageIllegal) Error ¶
func (c *ImageIllegal) Error() string
type ItReportHandler ¶
type ItReportHandler struct {
// contains filtered or unexported fields
}
func (*ItReportHandler) HandleMessage ¶
func (h *ItReportHandler) HandleMessage(message *nsq.Message) error
type JenkinsBuildOption ¶
type JenkinsBuildOption struct { Version string Target string ServiceName string ProductName string JenkinsBuildArgs *commonmodels.JenkinsBuildArgs }
type PRCommit ¶
type PRCommit struct { ID string `json:"id"` Title string `json:"title"` AuthorName string `json:"author_name"` CreatedAt *time.Time `json:"created_at"` CheckoutRef string `json:"checkout_ref"` }
func GetLatestPRCommitList ¶
func GetLatestPrCommit ¶
type ParameterSetting ¶ added in v1.8.0
type ParameterSetting struct { // External type parameter will NOT use this key. Key string `json:"key"` Type ParameterSettingType `json:"type"` //DefaultValue is the DefaultValue string `json:"default_value"` // choiceOption Are all options enumerated ChoiceOption []string `json:"choice_option"` // ExternalSetting It is the configuration of the external system to obtain the variable ExternalSetting *ExternalSetting `json:"external_setting"` }
type ParameterSettingType ¶ added in v1.8.0
type ParameterSettingType string
const ( StringType ParameterSettingType = "string" ChoiceType ParameterSettingType = "choice" ExternalType ParameterSettingType = "external" )
type PipelinePreview ¶ added in v1.2.0
type PipelinePreview struct { ProductName string `bson:"product_name" json:"product_name"` Name string `bson:"name" json:"name"` TeamName string `bson:"team_name" json:"team_name"` SubTasks []map[string]interface{} `bson:"sub_tasks" json:"sub_tasks"` Types []string `bson:"-" json:"types"` UpdateBy string `bson:"update_by" json:"update_by,omitempty"` UpdateTime int64 `bson:"update_time" json:"update_time,omitempty"` IsFavorite bool `bson:"is_favorite" json:"is_favorite"` LastestTask *commonmodels.TaskInfo `bson:"-" json:"lastest_task"` LastSucessTask *commonmodels.TaskInfo `bson:"-" json:"last_task_success"` LastFailureTask *commonmodels.TaskInfo `bson:"-" json:"last_task_failure"` TotalDuration int64 `bson:"-" json:"total_duration"` TotalNum int `bson:"-" json:"total_num"` TotalSuccess int `bson:"-" json:"total_success"` }
func ListPipelinesPreview ¶ added in v1.2.0
func ListPipelinesPreview(userID string, log *zap.SugaredLogger) ([]*PipelinePreview, error)
type PreSetResp ¶
type PreSetResp struct { Target *commonmodels.ServiceModuleTarget `json:"target"` BuildModuleVers []string `json:"build_module_vers"` Deploy []DeployEnv `json:"deploy"` Repos []*types.Repository `json:"repos"` }
func PreSetWorkflow ¶
func PreSetWorkflow(productName string, log *zap.SugaredLogger) ([]*PreSetResp, error)
type Preview ¶
type Preview struct { Name string `json:"name"` WorkflowType config.PipelineType `json:"workflow_type"` }
type ProductNameWithType ¶
type ProductNameWithType struct { Name string `json:"name"` Type string `json:"type"` Namespace string `json:"namespace"` }
func ListOldEnvsByServiceName ¶
func ListOldEnvsByServiceName(serviceName string, log *zap.SugaredLogger) []ProductNameWithType
func ListPipelineUpdatableProductNames ¶ added in v1.2.0
func ListPipelineUpdatableProductNames(userName, pipelineName string, log *zap.SugaredLogger) ([]ProductNameWithType, error)
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func NewPipelineQueue ¶
func NewPipelineQueue(log *zap.SugaredLogger) *Queue
func (*Queue) BlockedTaskQueue ¶
BlockedTaskQueue ...
func (*Queue) NextWaitingTask ¶
NextWaitingTask 查询下一个等待的task
type RepoCommit ¶
type RepoCommit struct { ID string `json:"id"` Title string `json:"title"` AuthorName string `json:"author_name"` CreatedAt *time.Time `json:"created_at"` Message string `json:"message"` }
RepoCommit : Repository commit struct
func QueryByBranch ¶
func QueryByBranch(id int, owner, name, branch string, log *zap.SugaredLogger) (*RepoCommit, error)
func QueryByTag ¶
func QueryByTag(id int, owner, name, tag string, log *zap.SugaredLogger) (*RepoCommit, error)
type ServiceTaskPreview ¶
type ServiceTaskPreview struct { Workflows []*Preview `json:"workflows"` Targets []commonmodels.ServiceModuleTarget `json:"targets"` }
func ListServiceWorkflows ¶
func ListServiceWorkflows(productName, envName, serviceName, serviceType string, log *zap.SugaredLogger) (*ServiceTaskPreview, error)
type TaskAckHandler ¶
type TaskAckHandler struct { TestTaskStatColl *commonrepo.TestTaskStatColl // contains filtered or unexported fields }
func NewTaskAckHandler ¶
func NewTaskAckHandler(maxInFlight int, log *zap.SugaredLogger) *TaskAckHandler
func (*TaskAckHandler) HandleMessage ¶
func (h *TaskAckHandler) HandleMessage(message *nsq.Message) error
HandleMessage 接收 warpdrive 回传 pipeline task 消息 1. 更新 queue pipeline task 2. 更新 数据库 pipeline task 3. 如果 pipeline task 完成, 检查是否有 blocked pipeline task, 检查是否可以unblock, 从queue中移除task
- pipeline 完成状态包括:passed, failed, timeout
4. 更新 数据库 proudct 5. 更新历史piplinetask的状态为archived(默认只留下最近的一百个task)
type TaskNotificationHandler ¶
type TaskNotificationHandler struct {
// contains filtered or unexported fields
}
TaskNotificationHandler ...
func (*TaskNotificationHandler) HandleMessage ¶
func (h *TaskNotificationHandler) HandleMessage(message *nsq.Message) error
HandleMessage ...
type TaskResp ¶ added in v1.8.0
func CreateWorkflowTaskV3 ¶ added in v1.8.0
func CreateWorkflowTaskV3(args *commonmodels.WorkflowV3Args, username, reqID string, log *zap.SugaredLogger) (*TaskResp, error)
type TaskResult ¶
type TaskResult struct { Data []*commonrepo.TaskPreview `bson:"data" json:"data"` StartAt int `bson:"start_at" json:"start_at"` MaxResult int `bson:"max_result" json:"max_result"` Total int `bson:"total" json:"total"` }
TaskResult ...
func ListPipelineTasksV2Result ¶
func ListPipelineTasksV2Result(name string, typeString config.PipelineType, maxResult, startAt int, log *zap.SugaredLogger) (*TaskResult, error)
ListPipelineTasksV2Result 工作流任务分页信息
func ListWorkflowTasksV3Result ¶ added in v1.8.0
func ListWorkflowTasksV3Result(name string, typeString config.PipelineType, maxResult, startAt int, log *zap.SugaredLogger) (*TaskResult, error)
ListWorkflowTasksV3Result 工作流任务分页信息
type TaskV2Info ¶
type TaskV2Info struct { TaskID int64 `json:"task_id"` Status string `json:"status"` CreateTime int64 `json:"create_time"` StartTime int64 `json:"start_time"` EndTime int64 `json:"end_time"` URL string `json:"url"` }
func FindTasks ¶
func FindTasks(commitID string, log *zap.SugaredLogger) ([]*TaskV2Info, error)
type Workflow ¶ added in v1.7.1
type Workflow struct { Name string `json:"name"` ProjectName string `json:"projectName"` UpdateTime int64 `json:"updateTime"` CreateTime int64 `json:"createTime"` UpdateBy string `json:"updateBy,omitempty"` Schedules *commonmodels.ScheduleCtrl `json:"schedules,omitempty"` SchedulerEnabled bool `json:"schedulerEnabled"` EnabledStages []string `json:"enabledStages"` IsFavorite bool `json:"isFavorite"` RecentTask *TaskInfo `json:"recentTask"` RecentSuccessfulTask *TaskInfo `json:"recentSuccessfulTask"` RecentFailedTask *TaskInfo `json:"recentFailedTask"` AverageExecutionTime float64 `json:"averageExecutionTime"` SuccessRate float64 `json:"successRate"` Description string `json:"description,omitempty"` }
func ListWorkflows ¶
type WorkflowV3 ¶ added in v1.8.0
type WorkflowV3 struct { ID string `json:"id"` Name string `json:"name"` ProjectName string `json:"project_name"` Description string `json:"description"` Parameters []*ParameterSetting `json:"parameters"` SubTasks []map[string]interface{} `json:"sub_tasks"` }
func GetWorkflowV3Detail ¶ added in v1.8.0
func GetWorkflowV3Detail(id string, logger *zap.SugaredLogger) (*WorkflowV3, error)
type WorkflowV3Brief ¶ added in v1.8.0
type WorkflowV3Brief struct { ID string `json:"id"` Name string `json:"name"` ProjectName string `json:"project_name"` }
func ListWorkflowsV3 ¶ added in v1.8.0
func ListWorkflowsV3(projectName string, pageNum, pageSize int64, logger *zap.SugaredLogger) ([]*WorkflowV3Brief, int64, error)
type WorkflowV3TaskArgs ¶ added in v1.8.0
type WorkflowV3TaskArgs struct { Type string `json:"type"` Key string `json:"key,omitempty"` Value string `json:"value,omitempty"` Choice []string `json:"choice,omitempty"` Options []map[string]interface{} `json:"options,omitempty"` }
func GetWorkflowV3Args ¶ added in v1.8.0
func GetWorkflowV3Args(id string, logger *zap.SugaredLogger) ([]*WorkflowV3TaskArgs, error)
Source Files ¶
- artifact_task.go
- cache_manager.go
- convert.go
- cronjob.go
- favorite_pipeline.go
- gerrit.go
- github.go
- gitlab.go
- nsq_handlers.go
- pipeline.go
- pipeline_cleaner.go
- pipeline_controller.go
- pipeline_queue.go
- pipeline_status.go
- pipeline_task.go
- pipeline_validation.go
- service_task.go
- sort.go
- sse.go
- types.go
- utils.go
- workflow.go
- workflow_task.go
- workflow_task_v3.go
- workflow_v3.go