Documentation
¶
Index ¶
- Constants
- Variables
- func CancelPipeline(pipelineId uint64) errors.Error
- func CancelTask(taskId uint64) errors.Error
- func ComputePipelineStatus(pipeline *models.Pipeline, isCancelled bool) (string, errors.Error)
- func CreateApiKey(user *common.User, apiKeyInput *models.ApiInputApiKey) (*models.ApiOutputApiKey, errors.Error)
- func CreateBlueprint(blueprint *models.Blueprint) errors.Error
- func CreateDbPipeline(newPipeline *models.NewPipeline) (pipeline *models.Pipeline, err errors.Error)
- func CreatePipeline(newPipeline *models.NewPipeline, shouldSanitize bool) (*models.Pipeline, errors.Error)
- func CreateProject(projectInput *models.ApiInputProject) (*models.ApiOutputProject, errors.Error)
- func DeleteApiKey(id uint64) errors.Error
- func DeleteBlueprint(id uint64) errors.Error
- func DeleteProject(name string) errors.Error
- func ExecuteMigration() errors.Error
- func GeneratePlanJsonV200(projectName string, connections []*coreModels.BlueprintConnection, ...) (coreModels.PipelinePlan, errors.Error)
- func GetApiKeys(query *ApiKeysQuery) ([]*models.ApiKey, int64, errors.Error)
- func GetBasicRes() context.BasicRes
- func GetBlueprint(blueprintId uint64, shouldSanitize bool) (*models.Blueprint, errors.Error)
- func GetBlueprintByProjectName(projectName string) (*models.Blueprint, errors.Error)
- func GetBlueprints(query *BlueprintQuery, shouldSanitize bool) ([]*models.Blueprint, int64, errors.Error)
- func GetDbPipeline(pipelineId uint64) (*models.Pipeline, errors.Error)
- func GetDbPipelines(query *PipelineQuery) ([]*models.Pipeline, int64, errors.Error)
- func GetLatestTasksOfPipeline(pipeline *models.Pipeline) ([]*models.Task, errors.Error)
- func GetMigrator() plugin.Migrator
- func GetPipeline(pipelineId uint64, shouldSanitize bool) (*models.Pipeline, errors.Error)
- func GetPipelineLogger(pipeline *models.Pipeline) log.Logger
- func GetPipelineLogsArchivePath(pipeline *models.Pipeline) (string, errors.Error)
- func GetPipelines(query *PipelineQuery, shouldSanitize bool) ([]*models.Pipeline, int64, errors.Error)
- func GetPluginsApiResources() (map[string]map[string]map[string]plugin.ApiResourceHandler, errors.Error)
- func GetProject(name string) (*models.ApiOutputProject, errors.Error)
- func GetProjects(query *ProjectQuery) ([]*models.ApiOutputProject, int64, errors.Error)
- func GetRepos() ([]*code.Repo, int64, errors.Error)
- func GetStore(storeKey string) (*models.Store, errors.Error)
- func GetSubTasksInfo(pipelineId uint64, shouldSanitize bool, tx dal.Dal) (*models.SubTasksOuput, errors.Error)
- func GetTask(taskId uint64) (*models.Task, errors.Error)
- func GetTasks(query *TaskQuery) ([]*models.Task, int64, errors.Error)
- func GetTasksWithLastStatus(pipelineId uint64, shouldSanitize bool, tx dal.Dal) ([]*models.Task, errors.Error)
- func Health() (string, errors.Error)
- func Init()
- func InitResources()
- func InsertRow(table string, rows []map[string]interface{}) (int64, errors.Error)
- func MakePlanForBlueprint(blueprint *models.Blueprint, syncPolicy *models.SyncPolicy) (models.PipelinePlan, errors.Error)
- func MigrationRequireConfirmation() bool
- func NotifyExternal(pipelineId uint64) errors.Error
- func ParallelizePipelinePlans(plans ...models.PipelinePlan) models.PipelinePlan
- func PatchBlueprint(id uint64, body map[string]interface{}) (*models.Blueprint, errors.Error)
- func PatchProject(name string, body map[string]interface{}) (*models.ApiOutputProject, errors.Error)
- func PutApiKey(user *common.User, id uint64) (*models.ApiOutputApiKey, errors.Error)
- func PutStore(storeKey string, storeValue *models.Store) (*models.Store, errors.Error)
- func Ready() (string, errors.Error)
- func ReloadBlueprints() (err errors.Error)
- func RerunPipeline(pipelineId uint64, task *models.Task) (tasks []*models.Task, err errors.Error)
- func RerunTask(taskId uint64) (*models.Task, errors.Error)
- func RunPipelineInQueue(pipelineMaxParallel int64)
- func RunTasksStandalone(parentLogger log.Logger, taskIds []uint64) errors.Error
- func SanitizeBlueprint(blueprint *models.Blueprint) error
- func SanitizePipeline(pipeline *models.Pipeline) error
- func SanitizePluginOption(pluginName string, option map[string]interface{}) (map[string]interface{}, error)
- func SanitizeTask(pipelineTask *models.PipelineTask) (*models.PipelineTask, error)
- func SequencializePipelinePlans(plans ...models.PipelinePlan) models.PipelinePlan
- func TriggerBlueprint(id uint64, syncPolicy *models.SyncPolicy, shouldSanitize bool) (*models.Pipeline, errors.Error)
- func VerifyStruct(v interface{}) errors.Error
- type ApiKeysQuery
- type BlueprintJob
- type BlueprintQuery
- type NotificationService
- type Pagination
- type PipelineNotification
- type PipelineQuery
- type ProjectQuery
- type RunningTask
- func (rt *RunningTask) Add(taskId uint64, cancel context.CancelFunc) errors.Error
- func (rt *RunningTask) FillProgressDetailToTasks(tasks []*models.Task)
- func (rt *RunningTask) GetProgressDetail(taskId uint64) *models.TaskProgressDetail
- func (rt *RunningTask) Remove(taskId uint64) (context.CancelFunc, errors.Error)
- type RunningTaskData
- type TaskQuery
Constants ¶
const ( SERVICE_STATUS_INIT = "initializing" SERVICE_STATUS_WAIT_CONFIRM = "waiting for migration confirmation" SERVICE_STATUS_MIGRATING = "migrating" SERVICE_STATUS_READY = "ready" )
Variables ¶
var (
ErrEmptyPlan = errors.Default.New("empty plan")
)
Functions ¶
func ComputePipelineStatus ¶
ComputePipelineStatus determines pipleline status by its latest(rerun included) tasks statuses 1. TASK_COMPLETED: all tasks were executed sucessfully 2. TASK_FAILED: SkipOnFail=false with failed task(s) 3. TASK_PARTIAL: SkipOnFail=true with failed task(s)
func CreateApiKey ¶
func CreateApiKey(user *common.User, apiKeyInput *models.ApiInputApiKey) (*models.ApiOutputApiKey, errors.Error)
CreateApiKey accepts an api key instance and insert it to database
func CreateBlueprint ¶
CreateBlueprint accepts a Blueprint instance and insert it to database
func CreateDbPipeline ¶
func CreateDbPipeline(newPipeline *models.NewPipeline) (pipeline *models.Pipeline, err errors.Error)
CreateDbPipeline returns a NewPipeline
func CreatePipeline ¶
func CreatePipeline(newPipeline *models.NewPipeline, shouldSanitize bool) (*models.Pipeline, errors.Error)
CreatePipeline and return the model
func CreateProject ¶
func CreateProject(projectInput *models.ApiInputProject) (*models.ApiOutputProject, errors.Error)
CreateProject accepts a project instance and insert it to database
func DeleteApiKey ¶
func ExecuteMigration ¶
ExecuteMigration executes all pending migration scripts and initialize services module
func GeneratePlanJsonV200 ¶
func GeneratePlanJsonV200( projectName string, connections []*coreModels.BlueprintConnection, metrics map[string]json.RawMessage, skipCollectors bool, ) (coreModels.PipelinePlan, errors.Error)
GeneratePlanJsonV200 generates pipeline plan according v2.0.0 definition
func GetApiKeys ¶
GetApiKeys returns a paginated list of api keys based on `query`
func GetBasicRes ¶
GetBasicRes returns the context.BasicRes instance used by services module
func GetBlueprint ¶
GetBlueprint returns the detail of a given Blueprint ID
func GetBlueprintByProjectName ¶
GetBlueprintByProjectName returns the detail of a given ProjectName
func GetBlueprints ¶
func GetBlueprints(query *BlueprintQuery, shouldSanitize bool) ([]*models.Blueprint, int64, errors.Error)
GetBlueprints returns a paginated list of Blueprints based on `query`
func GetDbPipeline ¶
GetDbPipeline by id
func GetDbPipelines ¶
GetDbPipelines by query
func GetLatestTasksOfPipeline ¶
GetLatestTasksOfPipeline returns latest tasks (reran tasks are excluding) of specified pipeline
func GetMigrator ¶
GetMigrator returns the core.Migrator instance used by services module
func GetPipeline ¶
GetPipeline by id
func GetPipelineLogger ¶
GetPipelineLogger returns logger for the pipeline
func GetPipelineLogsArchivePath ¶
GetPipelineLogsArchivePath creates an archive for the logs of this pipeline and returns its file path
func GetPipelines ¶
func GetPipelines(query *PipelineQuery, shouldSanitize bool) ([]*models.Pipeline, int64, errors.Error)
GetPipelines by query
func GetPluginsApiResources ¶
func GetPluginsApiResources() (map[string]map[string]map[string]plugin.ApiResourceHandler, errors.Error)
GetPluginsApiResources return value
{ "jira": { "connections": { "POST": *ApiResourceHandler } } }
GetPluginsApiResources returns all APIs of all plugins
func GetProject ¶
func GetProject(name string) (*models.ApiOutputProject, errors.Error)
GetProject returns a Project
func GetProjects ¶
func GetProjects(query *ProjectQuery) ([]*models.ApiOutputProject, int64, errors.Error)
GetProjects returns a paginated list of Projects based on `query`
func GetSubTasksInfo ¶
func GetSubTasksInfo(pipelineId uint64, shouldSanitize bool, tx dal.Dal) (*models.SubTasksOuput, errors.Error)
GetSubTasksInfo returns subtask list of the pipeline, only the most recently subtasks would be returned
func GetTasksWithLastStatus ¶
func GetTasksWithLastStatus(pipelineId uint64, shouldSanitize bool, tx dal.Dal) ([]*models.Task, errors.Error)
GetTasksWithLastStatus returns task list of the pipeline, only the most recently tasks would be returned TODO: adopts GetLatestTasksOfPipeline
func MakePlanForBlueprint ¶
func MakePlanForBlueprint(blueprint *models.Blueprint, syncPolicy *models.SyncPolicy) (models.PipelinePlan, errors.Error)
MakePlanForBlueprint generates pipeline plan by version
func MigrationRequireConfirmation ¶
func MigrationRequireConfirmation() bool
MigrationRequireConfirmation returns if there were migration scripts waiting to be executed
func ParallelizePipelinePlans ¶
func ParallelizePipelinePlans(plans ...models.PipelinePlan) models.PipelinePlan
ParallelizePipelinePlans merges multiple pipelines into one unified plan by assuming they can be executed in parallel
func PatchBlueprint ¶
PatchBlueprint FIXME ...
func PatchProject ¶
func PatchProject(name string, body map[string]interface{}) (*models.ApiOutputProject, errors.Error)
PatchProject FIXME ...
func ReloadBlueprints ¶
ReloadBlueprints reloades cronjobs based on blueprints
func RerunPipeline ¶
RerunPipeline would rerun all failed tasks or specified task
func RunPipelineInQueue ¶
func RunPipelineInQueue(pipelineMaxParallel int64)
RunPipelineInQueue query pipeline from db and run it in a queue
func RunTasksStandalone ¶
RunTasksStandalone run tasks in parallel
func SanitizeBlueprint ¶
func SanitizePipeline ¶
func SanitizePluginOption ¶
func SanitizeTask ¶
func SanitizeTask(pipelineTask *models.PipelineTask) (*models.PipelineTask, error)
func SequencializePipelinePlans ¶
func SequencializePipelinePlans(plans ...models.PipelinePlan) models.PipelinePlan
SequencializePipelinePlans merges multiple pipelines into one unified plan by assuming they must be executed in sequencial order
func TriggerBlueprint ¶
func TriggerBlueprint(id uint64, syncPolicy *models.SyncPolicy, shouldSanitize bool) (*models.Pipeline, errors.Error)
TriggerBlueprint triggers blueprint immediately
func VerifyStruct ¶
VerifyStruct verifies given struct with `validator`
Types ¶
type ApiKeysQuery ¶
type ApiKeysQuery struct {
Pagination
}
ApiKeysQuery used to query api keys as the api key input
type BlueprintJob ¶
func (BlueprintJob) Run ¶
func (bj BlueprintJob) Run()
type BlueprintQuery ¶
type BlueprintQuery struct { Pagination Enable *bool `form:"enable,omitempty"` IsManual *bool `form:"isManual"` Label string `form:"label"` // isManual must be omitted or `null` for type to take effect Type string `form:"type" enums:"ALL,MANUAL,DAILY,WEEKLY,MONTHLY,CUSTOM" validate:"oneof=ALL MANUAL DAILY WEEKLY MONTHLY CUSTOM"` }
BlueprintQuery is a query for GetBlueprints
type NotificationService ¶
NotificationService FIXME ...
func NewNotificationService ¶
func NewNotificationService(endpoint, secret string) *NotificationService
NewNotificationService FIXME ...
func (*NotificationService) PipelineStatusChanged ¶
func (n *NotificationService) PipelineStatusChanged(params PipelineNotification) errors.Error
PipelineStatusChanged FIXME ...
type Pagination ¶
Pagination holds the paginate information
func (*Pagination) GetPageSize ¶
func (p *Pagination) GetPageSize() int
GetPageSize returns a sensible page size based on input
func (*Pagination) GetPageSizeOr ¶
func (p *Pagination) GetPageSizeOr(defaultVal int) int
GetPageSizeOr returns the page size or fallback to `defaultVal`
func (*Pagination) GetSkip ¶
func (p *Pagination) GetSkip() int
GetSkip returns how many records should be skipped for specified page
type PipelineNotification ¶
type PipelineNotification struct { PipelineID uint64 CreatedAt time.Time UpdatedAt time.Time BeganAt *time.Time FinishedAt *time.Time Status string }
PipelineNotification FIXME ...
type PipelineQuery ¶
type PipelineQuery struct { Pagination Status string `form:"status"` Pending int `form:"pending"` BlueprintId uint64 `uri:"blueprintId" form:"blueprint_id"` Label string `form:"label"` }
PipelineQuery is a query for GetPipelines
type ProjectQuery ¶
type ProjectQuery struct {
Pagination
}
ProjectQuery used to query projects as the api project input
type RunningTask ¶
type RunningTask struct {
// contains filtered or unexported fields
}
RunningTask FIXME ...
func (*RunningTask) Add ¶
func (rt *RunningTask) Add(taskId uint64, cancel context.CancelFunc) errors.Error
Add FIXME ...
func (*RunningTask) FillProgressDetailToTasks ¶
func (rt *RunningTask) FillProgressDetailToTasks(tasks []*models.Task)
FillProgressDetailToTasks lock less times than GetProgressDetail
func (*RunningTask) GetProgressDetail ¶
func (rt *RunningTask) GetProgressDetail(taskId uint64) *models.TaskProgressDetail
GetProgressDetail FIXME ...
func (*RunningTask) Remove ¶
func (rt *RunningTask) Remove(taskId uint64) (context.CancelFunc, errors.Error)
Remove FIXME ...
type RunningTaskData ¶
type RunningTaskData struct { Cancel context.CancelFunc ProgressDetail *models.TaskProgressDetail }
RunningTaskData FIXME ...