| 53 | } |
| 54 | |
| 55 | func (bj BlueprintJob) Run() { |
| 56 | blueprint := bj.Blueprint |
| 57 | pipeline, err := createPipelineByBlueprint(blueprint, &blueprint.SyncPolicy) |
| 58 | if err == ErrEmptyPlan { |
| 59 | blueprintLog.Info("Empty plan, blueprint id:[%d] blueprint name:[%s]", blueprint.ID, blueprint.Name) |
| 60 | return |
| 61 | } |
| 62 | if err != nil { |
| 63 | blueprintLog.Error(err, fmt.Sprintf("run cron job failed on blueprint:[%d][%s]", blueprint.ID, blueprint.Name)) |
| 64 | } else { |
| 65 | blueprintLog.Info("Run new cron job successfully,blueprint id:[%d] pipeline id:[%d]", blueprint.ID, pipeline.ID) |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // CreateBlueprint accepts a Blueprint instance and insert it to database |
| 70 | func CreateBlueprint(blueprint *models.Blueprint) errors.Error { |