MakePlanForBlueprint generates pipeline plan by version
(blueprint *models.Blueprint, syncPolicy *models.SyncPolicy)
| 357 | |
| 358 | // MakePlanForBlueprint generates pipeline plan by version |
| 359 | func MakePlanForBlueprint(blueprint *models.Blueprint, syncPolicy *models.SyncPolicy) (models.PipelinePlan, errors.Error) { |
| 360 | var plan models.PipelinePlan |
| 361 | // load project metric plugins and convert it to a map |
| 362 | metrics := make(map[string]json.RawMessage) |
| 363 | projectMetrics := make([]models.ProjectMetricSetting, 0) |
| 364 | if blueprint.ProjectName != "" { |
| 365 | err := db.All(&projectMetrics, dal.Where("project_name = ? AND enable = ?", blueprint.ProjectName, true)) |
| 366 | if err != nil { |
| 367 | return nil, err |
| 368 | } |
| 369 | for _, projectMetric := range projectMetrics { |
| 370 | metrics[projectMetric.PluginName] = projectMetric.PluginOption |
| 371 | } |
| 372 | } |
| 373 | skipCollectors := false |
| 374 | if syncPolicy != nil && syncPolicy.SkipCollectors { |
| 375 | skipCollectors = true |
| 376 | } |
| 377 | plan, err := GeneratePlanJsonV200(blueprint.ProjectName, blueprint.Connections, metrics, skipCollectors) |
| 378 | if err != nil { |
| 379 | return nil, err |
| 380 | } |
| 381 | return SequentializePipelinePlans(blueprint.BeforePlan, plan, blueprint.AfterPlan), nil |
| 382 | } |
| 383 | |
| 384 | // ParallelizePipelinePlans merges multiple pipelines into one unified plan |
| 385 | // by assuming they can be executed in parallel |
no test coverage detected