You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by ab...@apache.org on 2022/09/20 14:04:35 UTC

[incubator-devlake] branch main updated (15d8f7d2 -> 971f1f82)

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

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


    from 15d8f7d2 feat(jenkins): add dora enrich
     new f1695c2a feat(dora): modify dora subtasks
     new 971f1f82 fix(dora): e2e

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 plugins/dora/e2e/calculate_change_lead_time_test.go |  1 +
 plugins/dora/e2e/raw_tables/repos.csv               |  2 ++
 plugins/dora/tasks/change_lead_time_calculator.go   | 10 +++++++---
 plugins/dora/tasks/issue_deploy_connector.go        |  8 +-------
 4 files changed, 11 insertions(+), 10 deletions(-)
 create mode 100644 plugins/dora/e2e/raw_tables/repos.csv


[incubator-devlake] 02/02: fix(dora): e2e

Posted by ab...@apache.org.
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

commit 971f1f8268130c1961f8c1e0da418a979aa262e4
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Tue Sep 20 21:50:57 2022 +0800

    fix(dora): e2e
---
 plugins/dora/e2e/calculate_change_lead_time_test.go | 1 +
 plugins/dora/e2e/raw_tables/repos.csv               | 2 ++
 plugins/dora/tasks/change_lead_time_calculator.go   | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/dora/e2e/calculate_change_lead_time_test.go b/plugins/dora/e2e/calculate_change_lead_time_test.go
index b27c7164..90b7ef61 100644
--- a/plugins/dora/e2e/calculate_change_lead_time_test.go
+++ b/plugins/dora/e2e/calculate_change_lead_time_test.go
@@ -50,6 +50,7 @@ func TestCalculateCLTimeDataFlow(t *testing.T) {
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_request_comments.csv", &code.PullRequestComment{})
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_request_commits.csv", &code.PullRequestCommit{})
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/commits.csv", &code.Commit{})
+	dataflowTester.ImportCsvIntoTabler("./raw_tables/repos.csv", &code.Repo{})
 
 	// verify converter
 	dataflowTester.Subtask(tasks.CalculateChangeLeadTimeMeta, taskData)
diff --git a/plugins/dora/e2e/raw_tables/repos.csv b/plugins/dora/e2e/raw_tables/repos.csv
new file mode 100644
index 00000000..199b4f35
--- /dev/null
+++ b/plugins/dora/e2e/raw_tables/repos.csv
@@ -0,0 +1,2 @@
+id,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,name,url,description,owner_id,language,forked_from,created_date,updated_date,deleted
+github:GithubRepo:1:384111310,2022-09-20 13:47:48.519,2022-09-20 13:47:48.519,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_repositories,1,"",apache/incubator-devlake,https://github.com/apache/incubator-devlake,"Apache DevLake is an open-source dev data platform to ingest, analyze, and visualize the fragmented data from DevOps tools, which can distill insights to improve engineering productivity.","",Go,"",2021-07-08 12:06:09,2022-09-20 03:25:21,0
diff --git a/plugins/dora/tasks/change_lead_time_calculator.go b/plugins/dora/tasks/change_lead_time_calculator.go
index 7df0efdc..ceffd02d 100644
--- a/plugins/dora/tasks/change_lead_time_calculator.go
+++ b/plugins/dora/tasks/change_lead_time_calculator.go
@@ -35,7 +35,7 @@ func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
 	db := taskCtx.GetDal()
 	repoIdList := make([]string, 0)
 	repoClause := dal.From(&code.Repo{})
-	err := db.Pluck("id", repoIdList, repoClause)
+	err := db.Pluck("id", &repoIdList, repoClause)
 	if err != nil {
 		return err
 	}


[incubator-devlake] 01/02: feat(dora): modify dora subtasks

Posted by ab...@apache.org.
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

commit f1695c2a810b232050ded8d876f38565d210b8da
Author: Yingchu Chen <yi...@merico.dev>
AuthorDate: Tue Sep 20 21:08:37 2022 +0800

    feat(dora): modify dora subtasks
---
 plugins/dora/tasks/change_lead_time_calculator.go | 10 +++++++---
 plugins/dora/tasks/issue_deploy_connector.go      |  8 +-------
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/plugins/dora/tasks/change_lead_time_calculator.go b/plugins/dora/tasks/change_lead_time_calculator.go
index d6649c37..7df0efdc 100644
--- a/plugins/dora/tasks/change_lead_time_calculator.go
+++ b/plugins/dora/tasks/change_lead_time_calculator.go
@@ -32,12 +32,16 @@ import (
 )
 
 func CalculateChangeLeadTime(taskCtx core.SubTaskContext) errors.Error {
-	data := taskCtx.GetData().(*DoraTaskData)
 	db := taskCtx.GetDal()
-	repoId := data.Options.RepoId
+	repoIdList := make([]string, 0)
+	repoClause := dal.From(&code.Repo{})
+	err := db.Pluck("id", repoIdList, repoClause)
+	if err != nil {
+		return err
+	}
 	clauses := []dal.Clause{
 		dal.From(&code.PullRequest{}),
-		dal.Where("merged_date IS NOT NULL and head_repo_id = ?", repoId),
+		dal.Where("merged_date IS NOT NULL and head_repo_id in ?", repoIdList),
 	}
 	cursor, err := db.Cursor(clauses...)
 	if err != nil {
diff --git a/plugins/dora/tasks/issue_deploy_connector.go b/plugins/dora/tasks/issue_deploy_connector.go
index c872e685..180e49ff 100644
--- a/plugins/dora/tasks/issue_deploy_connector.go
+++ b/plugins/dora/tasks/issue_deploy_connector.go
@@ -40,18 +40,12 @@ var ConnectIssueDeployMeta = core.SubTaskMeta{
 
 func ConnectIssueDeploy(taskCtx core.SubTaskContext) errors.Error {
 	db := taskCtx.GetDal()
-	data := taskCtx.GetData().(*DoraTaskData)
-
 	issue := &ticket.Issue{}
 	// select all issues belongs to the board
 	clauses := []dal.Clause{
 		dal.From(issue),
-		dal.Join(`left join board_issues 
-			on issues.id = board_issues.issue_id`),
-		dal.Join("left join board_repos on board_repos.board_id = board_issues.board_id"),
 		dal.Where(
-			"board_repos.repo_id = ? and issues.type = ?",
-			data.Options.RepoId, "INCIDENT",
+			"issues.type = ?", "INCIDENT",
 		),
 	}
 	cursor, err := db.Cursor(clauses...)