(pipeline *models.Pipeline)
| 377 | } |
| 378 | |
| 379 | func getProjectName(pipeline *models.Pipeline) (string, errors.Error) { |
| 380 | if pipeline == nil { |
| 381 | return "", errors.Default.New("pipeline is nil") |
| 382 | } |
| 383 | blueprintId := pipeline.BlueprintId |
| 384 | if blueprintId == 0 { |
| 385 | // skip get project name if pipeline is not bound to a blueprint |
| 386 | return "", nil |
| 387 | } |
| 388 | dbBlueprint := &models.Blueprint{} |
| 389 | err := db.First(dbBlueprint, dal.Where("id = ?", blueprintId)) |
| 390 | if err != nil { |
| 391 | if db.IsErrorNotFound(err) { |
| 392 | return "", errors.NotFound.New(fmt.Sprintf("blueprint(id: %d) not found", blueprintId)) |
| 393 | } |
| 394 | return "", errors.Internal.Wrap(err, "error getting the blueprint from database") |
| 395 | } |
| 396 | return dbBlueprint.ProjectName, nil |
| 397 | } |
| 398 | |
| 399 | // NotifyExternal FIXME ... |
| 400 | func NotifyExternal(pipelineId uint64) errors.Error { |
no test coverage detected