MCPcopy
hub / github.com/apache/devlake / getProjectName

Function getProjectName

backend/server/services/pipeline.go:379–397  ·  view source on GitHub ↗
(pipeline *models.Pipeline)

Source from the content-addressed store, hash-verified

377}
378
379func 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 ...
400func NotifyExternal(pipelineId uint64) errors.Error {

Callers 1

NotifyExternalFunction · 0.85

Calls 4

WrapMethod · 0.80
NewMethod · 0.65
FirstMethod · 0.65
IsErrorNotFoundMethod · 0.65

Tested by

no test coverage detected