This is an automated email from the ASF dual-hosted git repository.

warren pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 568e2ad9 fix(plugins): modify dora subtasks
568e2ad9 is described below

commit 568e2ad9cbc123e8f3ddc1f1ab82b2d96bd6b693
Author: Yingchu Chen <[email protected]>
AuthorDate: Fri Sep 30 00:19:34 2022 +0800

    fix(plugins): modify dora subtasks
---
 plugins/github/api/blueprint.go      | 6 +++---
 plugins/github/api/blueprint_test.go | 2 +-
 plugins/gitlab/api/blueprint.go      | 5 +++--
 plugins/gitlab/api/blueprint_test.go | 2 +-
 plugins/jenkins/api/blueprint.go     | 5 +++--
 services/blueprint.go                | 6 +++---
 6 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/plugins/github/api/blueprint.go b/plugins/github/api/blueprint.go
index d8376f25..48ec1a1f 100644
--- a/plugins/github/api/blueprint.go
+++ b/plugins/github/api/blueprint.go
@@ -165,14 +165,14 @@ func processScope(subtaskMetas []core.SubTaskMeta, 
connectionId uint64, scopeEle
                }
                doraOption := make(map[string]interface{})
                doraOption["repoId"] = 
didgen.NewDomainIdGenerator(&models.GithubRepo{}).Generate(connectionId, 
apiRepo.GithubId)
-               doraOption["tasks"] = []string{"EnrichTaskEnv"}
                doraRules := make(map[string]interface{})
                doraRules["productionPattern"] = productionPattern
                doraOption["transformationRules"] = doraRules
                plan[j] = core.PipelineStage{
                        {
-                               Plugin:  "dora",
-                               Options: doraOption,
+                               Plugin:   "dora",
+                               Subtasks: []string{"EnrichTaskEnv"},
+                               Options:  doraOption,
                        },
                }
                // remove it from github transformationRules
diff --git a/plugins/github/api/blueprint_test.go 
b/plugins/github/api/blueprint_test.go
index 98009652..9a1ad60a 100644
--- a/plugins/github/api/blueprint_test.go
+++ b/plugins/github/api/blueprint_test.go
@@ -79,6 +79,6 @@ func TestProcessScope(t *testing.T) {
        }
        planJson, err1 := json.Marshal(plan)
        assert.Nil(t, err1)
-       expectPlan := 
`[[{"plugin":"github","subtasks":[],"options":{"connectionId":1,"owner":"test","repo":"testRepo","transformationRules":{"prType":"hey,man,wasup"}}},{"plugin":"gitextractor","subtasks":null,"options":{"proxy":"","repoId":"github:GithubRepo:1:123","url":"//git:123@HttpUrlToRepo"}}],[{"plugin":"refdiff","subtasks":null,"options":{"tagsLimit":10,"tagsOrder":"reverse
 
semver","tagsPattern":"pattern"}}],[{"plugin":"dora","subtasks":null,"options":{"repoId":"github:GithubRepo:1:12
 [...]
+       expectPlan := 
`[[{"plugin":"github","subtasks":[],"options":{"connectionId":1,"owner":"test","repo":"testRepo","transformationRules":{"prType":"hey,man,wasup"}}},{"plugin":"gitextractor","subtasks":null,"options":{"proxy":"","repoId":"github:GithubRepo:1:123","url":"//git:123@HttpUrlToRepo"}}],[{"plugin":"refdiff","subtasks":null,"options":{"tagsLimit":10,"tagsOrder":"reverse
 
semver","tagsPattern":"pattern"}}],[{"plugin":"dora","subtasks":["EnrichTaskEnv"],"options":{"repoId":"github:Gi
 [...]
        assert.Equal(t, expectPlan, string(planJson))
 }
diff --git a/plugins/gitlab/api/blueprint.go b/plugins/gitlab/api/blueprint.go
index 6ba3c1a9..8f424127 100644
--- a/plugins/gitlab/api/blueprint.go
+++ b/plugins/gitlab/api/blueprint.go
@@ -169,8 +169,9 @@ func processScope(subtaskMetas []core.SubTaskMeta, 
connectionId uint64, scopeEle
                doraOption["transformationRules"] = doraRules
                plan[j] = core.PipelineStage{
                        {
-                               Plugin:  "dora",
-                               Options: doraOption,
+                               Plugin:   "dora",
+                               Subtasks: []string{"EnrichTaskEnv"},
+                               Options:  doraOption,
                        },
                }
                // remove it from github transformationRules
diff --git a/plugins/gitlab/api/blueprint_test.go 
b/plugins/gitlab/api/blueprint_test.go
index 47150b44..2afe9848 100644
--- a/plugins/gitlab/api/blueprint_test.go
+++ b/plugins/gitlab/api/blueprint_test.go
@@ -78,6 +78,6 @@ func TestProcessScope(t *testing.T) {
        }
        planJson, err1 := json.Marshal(plan)
        assert.Nil(t, err1)
-       expectPlan := 
`[[{"plugin":"gitlab","subtasks":[],"options":{"connectionId":1,"projectId":123,"transformationRules":{"prType":"hey,man,wasup"}}},{"plugin":"gitextractor","subtasks":null,"options":{"proxy":"","repoId":"gitlab:GitlabProject:1:123","url":"//git:123@HttpUrlToRepo"}}],[{"plugin":"refdiff","subtasks":null,"options":{"tagsLimit":10,"tagsOrder":"reverse
 
semver","tagsPattern":"pattern"}}],[{"plugin":"dora","subtasks":null,"options":{"repoId":"gitlab:GitlabProject:1:123","tasks":
 [...]
+       expectPlan := 
`[[{"plugin":"gitlab","subtasks":[],"options":{"connectionId":1,"projectId":123,"transformationRules":{"prType":"hey,man,wasup"}}},{"plugin":"gitextractor","subtasks":null,"options":{"proxy":"","repoId":"gitlab:GitlabProject:1:123","url":"//git:123@HttpUrlToRepo"}}],[{"plugin":"refdiff","subtasks":null,"options":{"tagsLimit":10,"tagsOrder":"reverse
 
semver","tagsPattern":"pattern"}}],[{"plugin":"dora","subtasks":["EnrichTaskEnv"],"options":{"repoId":"gitlab:GitlabProject:1:
 [...]
        assert.Equal(t, expectPlan, string(planJson))
 }
diff --git a/plugins/jenkins/api/blueprint.go b/plugins/jenkins/api/blueprint.go
index 66105cad..bfbdd52e 100644
--- a/plugins/jenkins/api/blueprint.go
+++ b/plugins/jenkins/api/blueprint.go
@@ -84,8 +84,9 @@ func MakePipelinePlan(subtaskMetas []core.SubTaskMeta, 
connectionId uint64, scop
                        doraOption["transformationRules"] = doraRules
                        plan[j] = core.PipelineStage{
                                {
-                                       Plugin:  "dora",
-                                       Options: doraOption,
+                                       Plugin:   "dora",
+                                       Subtasks: []string{"EnrichTaskEnv"},
+                                       Options:  doraOption,
                                },
                        }
                        // remove it from github transformationRules
diff --git a/services/blueprint.go b/services/blueprint.go
index dfaf3d44..edb4a0e3 100644
--- a/services/blueprint.go
+++ b/services/blueprint.go
@@ -306,11 +306,11 @@ func GeneratePlanJsonV100(settings 
*models.BlueprintSettings) (core.PipelinePlan
        }
        mergedPipelinePlan := MergePipelinePlans(plans...)
        if hasDoraEnrich {
-               doraRules["tasks"] = []string{"calculateChangeLeadTime", 
"ConnectIssueDeploy"}
                plan := core.PipelineStage{
                        &core.PipelineTask{
-                               Plugin:  "dora",
-                               Options: doraRules,
+                               Plugin:   "dora",
+                               Subtasks: []string{"calculateChangeLeadTime", 
"ConnectIssueDeploy"},
+                               Options:  doraRules,
                        },
                }
                mergedPipelinePlan = append(mergedPipelinePlan, plan)

Reply via email to