You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/09/19 15:52:22 UTC

[GitHub] [incubator-devlake] klesh commented on a diff in pull request #3128: feat(github): add dora enrich

klesh commented on code in PR #3128:
URL: https://github.com/apache/incubator-devlake/pull/3128#discussion_r974416905


##########
plugins/github/api/blueprint.go:
##########
@@ -141,11 +109,85 @@ func MakePipelinePlan(subtaskMetas []core.SubTaskMeta, connectionId uint64, scop
 				Options: map[string]interface{}{
 					"url":    cloneUrl.String(),
 					"repoId": didgen.NewDomainIdGenerator(&models.GithubRepo{}).Generate(connectionId, apiRepo.GithubId),
-					"proxy":  connection.Proxy,
+					"proxy":  proxy,
 				},
 			})
 		}
 		plan[i] = stage
+		// dora
+		if doraRules, ok := transformationRules["dora"]; ok && doraRules != nil {
+			j := i + 1
+			// add a new task to next stage
+			if plan[j] != nil {
+				j++
+			}
+			if j == len(plan) {
+				plan = append(plan, nil)
+			}
+			if err != nil {
+				return nil, err
+			}
+			if apiRepo.GithubId == 0 {
+				apiRepo, _, _, err = getApiRepo(connectionId, op)
+				if err != nil {
+					return nil, err
+				}
+			}
+			doraOption := make(map[string]interface{})
+			doraOption["repoId"] = didgen.NewDomainIdGenerator(&models.GithubRepo{}).Generate(connectionId, apiRepo.GithubId)
+			doraOption["tasks"] = []string{"EnrichTaskEnv"}
+			doraOption["transformation"] = doraRules
+			plan[j] = core.PipelineStage{
+				{
+					Plugin:  "dora",
+					Options: doraOption,
+				},
+			}
+			// remove it from github transformationRules
+			delete(transformationRules, "dora")

Review Comment:
   Why do we need to delete it?



-- 
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: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org