warren830 commented on code in PR #3847:
URL: 
https://github.com/apache/incubator-devlake/pull/3847#discussion_r1041022325


##########
plugins/gitlab/api/blueprint_v200.go:
##########
@@ -58,23 +77,93 @@ func MakeDataSourcePipelinePlanV200(connectionId uint64, 
scopes []*core.Blueprin
 
                sc = append(sc, &repo)
                sc = append(sc, &board)
+       }
 
-               ps = append(ps, &core.PipelineTask{
-                       Plugin: "gitlab",
-                       Options: map[string]interface{}{
-                               "name": scope.Name,
-                       },
-               })
+       return sc, nil
+}
 
-               ps = append(ps, &core.PipelineTask{
-                       Plugin: "gitextractor",
-                       Options: map[string]interface{}{
-                               "url": connection.Endpoint + scope.Name,
-                       },
-               })
-       }
+func makePipelinePlanV200(subtaskMetas []core.SubTaskMeta, scopes 
[]*core.BlueprintScopeV200, connection *models.GitlabConnection) 
(core.PipelinePlan, errors.Error) {
+       var err errors.Error
 
-       pp = append(pp, ps)
+       plans := make(core.PipelinePlan, 0, 3*len(scopes))
+       for _, scope := range scopes {
+               var stage core.PipelineStage
+               // get repo
+               repo := &models.GitlabProject{}
+               err = BasicRes.GetDal().First(repo, dal.Where("connection_id = 
? AND gitlab_id = ?", connection.ID, scope.Id))
+               if err != nil {
+                       return nil, err
+               }
+
+               // get transformationRuleId
+               var transformationRules models.GitlabTransformationRule
+               transformationRuleId := repo.TransformationRuleId
+               if transformationRuleId != 0 {
+                       err = BasicRes.GetDal().First(&transformationRules, 
dal.Where("id = ?", transformationRuleId))
+                       if err != nil {
+                               return nil, errors.Default.Wrap(err, "error on 
get TransformationRule")
+                       }
+               } else {
+                       transformationRules.ID = 0
+               }
+
+               // refdiff part
+               if transformationRules.Refdiff != nil {
+                       task := &core.PipelineTask{
+                               Plugin:  "refdiff",
+                               Options: transformationRules.Refdiff,
+                       }
+                       stage = append(stage, task)
+               }
+
+               // get int scopeId
+               intScopeId, err1 := strconv.Atoi(scope.Id)
+               if err != nil {
+                       return nil, errors.Default.Wrap(err1, 
fmt.Sprintf("Failed to strconv.Atoi for scope.Id [%s]", scope.Id))
+               }
+
+               // gitlab main part
+               options := make(map[string]interface{})
+               options["connectionId"] = connection.ID
+               options["projectId"] = intScopeId
+               options["transformationRules"] = &transformationRules
+               options["transformationRuleId"] = transformationRules.ID
+               // make sure task options is valid
+               _, err := tasks.DecodeAndValidateTaskOptions(options)
+               if err != nil {
+                       return nil, err
+               }
+
+               // construct subtasks
+               subtasks, err := helper.MakePipelinePlanSubtasks(subtaskMetas, 
scope.Entities)
+               if err != nil {
+                       return nil, err
+               }
+
+               stage = append(stage, &core.PipelineTask{
+                       Plugin:   "gitlab",
+                       Subtasks: subtasks,
+                       Options:  options,
+               })
 
-       return pp, sc, nil
+               // collect git data by gitextractor if CODE was requested
+               if utils.StringsContains(scope.Entities, core.DOMAIN_TYPE_CODE) 
{
+                       cloneUrl, err := 
errors.Convert01(url.Parse(repo.HttpUrlToRepo))

Review Comment:
   where can you get this ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to