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

abeizn 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 41787fa2 feat(jenkins): add param datasource as jenkins to dora options
41787fa2 is described below

commit 41787fa2ead3e443ef10eab76ab2285f949bd18c
Author: Yingchu Chen <[email protected]>
AuthorDate: Wed Sep 21 10:57:20 2022 +0800

    feat(jenkins): add param datasource as jenkins to dora options
---
 plugins/github/api/blueprint.go      | 2 +-
 plugins/github/api/blueprint_test.go | 9 +--------
 plugins/gitlab/api/blueprint.go      | 2 +-
 plugins/gitlab/api/blueprint_test.go | 9 +--------
 plugins/jenkins/api/blueprint.go     | 3 ++-
 5 files changed, 6 insertions(+), 19 deletions(-)

diff --git a/plugins/github/api/blueprint.go b/plugins/github/api/blueprint.go
index e8eeffe2..3562d10d 100644
--- a/plugins/github/api/blueprint.go
+++ b/plugins/github/api/blueprint.go
@@ -163,7 +163,7 @@ 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"}
-               doraOption["transformation"] = doraRules
+               doraOption["transformationRules"] = doraRules
                plan[j] = core.PipelineStage{
                        {
                                Plugin:  "dora",
diff --git a/plugins/github/api/blueprint_test.go 
b/plugins/github/api/blueprint_test.go
index 8d5f45aa..0c6e5302 100644
--- a/plugins/github/api/blueprint_test.go
+++ b/plugins/github/api/blueprint_test.go
@@ -19,24 +19,17 @@ package api
 
 import (
        "encoding/json"
-       "github.com/apache/incubator-devlake/config"
-       "github.com/apache/incubator-devlake/logger"
        "github.com/apache/incubator-devlake/mocks"
        "github.com/apache/incubator-devlake/models/common"
        "github.com/apache/incubator-devlake/plugins/core"
        "github.com/apache/incubator-devlake/plugins/github/models"
        "github.com/apache/incubator-devlake/plugins/github/tasks"
        "github.com/apache/incubator-devlake/plugins/helper"
-       "github.com/apache/incubator-devlake/runner"
        "github.com/stretchr/testify/assert"
        "testing"
 )
 
 func TestProcessScope(t *testing.T) {
-       cfg := config.GetConfig()
-       log := logger.Global.Nested("github")
-       db, _ := runner.NewGormDb(cfg, log)
-       Init(cfg, log, db)
        connection := &models.GithubConnection{
                RestConnection: helper.RestConnection{
                        BaseConnection: helper.BaseConnection{
@@ -89,6 +82,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":null,"options":{"repoId":"github:GithubRepo:1:12
 [...]
        assert.Equal(t, expectPlan, string(planJson))
 }
diff --git a/plugins/gitlab/api/blueprint.go b/plugins/gitlab/api/blueprint.go
index 9112b403..7c9faed2 100644
--- a/plugins/gitlab/api/blueprint.go
+++ b/plugins/gitlab/api/blueprint.go
@@ -164,7 +164,7 @@ func processScope(subtaskMetas []core.SubTaskMeta, 
connectionId uint64, scopeEle
                doraOption := make(map[string]interface{})
                doraOption["repoId"] = 
didgen.NewDomainIdGenerator(&models.GitlabProject{}).Generate(connectionId, 
apiRepo.GitlabId)
                doraOption["tasks"] = []string{"EnrichTaskEnv"}
-               doraOption["transformation"] = doraRules
+               doraOption["transformationRules"] = doraRules
                plan[j] = core.PipelineStage{
                        {
                                Plugin:  "dora",
diff --git a/plugins/gitlab/api/blueprint_test.go 
b/plugins/gitlab/api/blueprint_test.go
index 2851f44e..69e7dda4 100644
--- a/plugins/gitlab/api/blueprint_test.go
+++ b/plugins/gitlab/api/blueprint_test.go
@@ -19,24 +19,17 @@ package api
 
 import (
        "encoding/json"
-       "github.com/apache/incubator-devlake/config"
-       "github.com/apache/incubator-devlake/logger"
        "github.com/apache/incubator-devlake/mocks"
        "github.com/apache/incubator-devlake/models/common"
        "github.com/apache/incubator-devlake/plugins/core"
        "github.com/apache/incubator-devlake/plugins/gitlab/models"
        "github.com/apache/incubator-devlake/plugins/gitlab/tasks"
        "github.com/apache/incubator-devlake/plugins/helper"
-       "github.com/apache/incubator-devlake/runner"
        "github.com/stretchr/testify/assert"
        "testing"
 )
 
 func TestProcessScope(t *testing.T) {
-       cfg := config.GetConfig()
-       log := logger.Global.Nested("gitlab")
-       db, _ := runner.NewGormDb(cfg, log)
-       Init(cfg, log, db)
        connection := &models.GitlabConnection{
                RestConnection: helper.RestConnection{
                        BaseConnection: helper.BaseConnection{
@@ -88,6 +81,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":null,"options":{"repoId":"gitlab:GitlabProject:1:123","tasks":
 [...]
        assert.Equal(t, expectPlan, string(planJson))
 }
diff --git a/plugins/jenkins/api/blueprint.go b/plugins/jenkins/api/blueprint.go
index a4f1e426..4798dd44 100644
--- a/plugins/jenkins/api/blueprint.go
+++ b/plugins/jenkins/api/blueprint.go
@@ -73,7 +73,8 @@ func MakePipelinePlan(subtaskMetas []core.SubTaskMeta, 
connectionId uint64, scop
                        }
                        doraOption := make(map[string]interface{})
                        doraOption["tasks"] = []string{"EnrichTaskEnv"}
-                       doraOption["transformation"] = doraRules
+                       doraOption["dataSource"] = []string{"jenkins"}
+                       doraOption["transformationRules"] = doraRules
                        plan[j] = core.PipelineStage{
                                {
                                        Plugin:  "dora",

Reply via email to