You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by zh...@apache.org on 2022/10/14 07:22:30 UTC

[incubator-devlake] branch main updated: fix: env enricher multi-repo collector sql error (#3444)

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

zhangliang2022 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 fd53b85c fix: env enricher multi-repo collector sql error (#3444)
fd53b85c is described below

commit fd53b85ca0f1a6363cd314207b70c9d0e44056c0
Author: abeizn <zi...@merico.dev>
AuthorDate: Fri Oct 14 15:22:26 2022 +0800

    fix: env enricher multi-repo collector sql error (#3444)
    
    * fix: env enricher multi-repo collector sql error
    
    * fix: env enricher multi-repo collector sql error
---
 plugins/dora/e2e/raw_tables/lake_cicd_pipeline_commits.csv | 3 +++
 plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv            | 3 +++
 plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv       | 3 +++
 plugins/dora/tasks/cicd_task_env_enricher.go               | 4 ++--
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/plugins/dora/e2e/raw_tables/lake_cicd_pipeline_commits.csv b/plugins/dora/e2e/raw_tables/lake_cicd_pipeline_commits.csv
index ccf0a05b..d85bcb57 100644
--- a/plugins/dora/e2e/raw_tables/lake_cicd_pipeline_commits.csv
+++ b/plugins/dora/e2e/raw_tables/lake_cicd_pipeline_commits.csv
@@ -53,3 +53,6 @@ github:GithubRun:1:3022906735,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,""
 github:GithubRun:1:3023010057,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,"","",0,"",048d0e8829d74df01d789c9f807e57053f7cbac5,fix-update-jenkins-e2e,github:GithubRepo:1:384111310
 github:GithubRun:1:3023010060,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,"","",0,"",048d0e8829d74df01d789c9f807e57053f7cbac5,fix-update-jenkins-e2e,github:GithubRepo:1:384111310
 github:GithubRun:1:3023010062,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,"","",0,"",048d0e8829d74df01d789c9f807e57053f7cbac5,fix-update-jenkins-e2e,github:GithubRepo:1:384111310
+github:GithubRun:1:7773010057,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,"","",0,"",048d0e8829d74df01d789c9f807e57053f7cbac5,fix-update-jenkins-e2e,github:GithubRepo:1:384111777
+github:GithubRun:1:7773010060,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,"","",0,"",048d0e8829d74df01d789c9f807e57053f7cbac5,fix-update-jenkins-e2e,github:GithubRepo:1:384111777
+github:GithubRun:1:7773010062,2022-09-15 03:20:03.452,2022-09-15 03:20:03.452,"","",0,"",048d0e8829d74df01d789c9f807e57053f7cbac5,fix-update-jenkins-e2e,github:GithubRepo:1:384111777
diff --git a/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv b/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv
index 9e891d7f..5d0b7399 100644
--- a/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv
+++ b/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv
@@ -20,3 +20,6 @@ github:GithubJob:1:8269729550,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{
 github:GithubJob:1:8269729553,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,17,"",build_deploy,github:GithubRun:1:3022300997,SUCCESS,DONE,"",57,2022-09-09 12:12:52,2022-09-09 12:13:49,""
 github:GithubJob:1:8269729821,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,20,"",deployment,github:GithubRun:1:3022301033,SUCCESS,DONE,"",991,2022-09-09 12:13:58,2022-09-09 12:30:29,""
 github:GithubJob:1:8269872730,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,21,"",deploy,github:GithubRun:1:3022348786,SUCCESS,DONE,"",1006,2022-09-09 12:21:30,2022-09-09 12:38:16,""
+github:GithubJob:1:7773010057,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,17,"",build_deploy,github:GithubRun:1:3022300997,SUCCESS,DONE,"",57,2022-09-09 12:12:52,2022-09-09 12:13:49,""
+github:GithubJob:1:7773010060,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,20,"",deployment,github:GithubRun:1:3022301033,SUCCESS,DONE,"",991,2022-09-09 12:13:58,2022-09-09 12:30:29,""
+github:GithubJob:1:7773010062,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,21,"",deploy,github:GithubRun:1:3022348786,SUCCESS,DONE,"",1006,2022-09-09 12:21:30,2022-09-09 12:38:16,""
\ No newline at end of file
diff --git a/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv b/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv
index 412d95d9..1db38869 100644
--- a/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv
+++ b/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv
@@ -1,4 +1,7 @@
 id,name,pipeline_id,result,status,type,environment,duration_sec,started_date,finished_date
+github:GithubJob:1:7773010057,build_deploy,github:GithubRun:1:3022300997,SUCCESS,DONE,,PRODUCTION,57,2022-09-09T12:12:52.000+00:00,2022-09-09T12:13:49.000+00:00
+github:GithubJob:1:7773010060,deployment,github:GithubRun:1:3022301033,SUCCESS,DONE,,PRODUCTION,991,2022-09-09T12:13:58.000+00:00,2022-09-09T12:30:29.000+00:00
+github:GithubJob:1:7773010062,deploy,github:GithubRun:1:3022348786,SUCCESS,DONE,,PRODUCTION,1006,2022-09-09T12:21:30.000+00:00,2022-09-09T12:38:16.000+00:00
 github:GithubJob:1:8269045794,deploy,github:GithubRun:1:3022052551,FAILURE,DONE,DEPLOYMENT,PRODUCTION,72,2022-09-09T11:27:13.000+00:00,2022-09-09T11:28:25.000+00:00
 github:GithubJob:1:8269045795,test (ubuntu-latest),github:GithubRun:1:3022052557,SUCCESS,DONE,DEPLOYMENT,,191,2022-09-09T11:27:42.000+00:00,2022-09-09T11:30:53.000+00:00
 github:GithubJob:1:8269045819,commit-msg,github:GithubRun:1:3022052555,SUCCESS,DONE,DEPLOYMENT,,8,2022-09-09T11:26:38.000+00:00,2022-09-09T11:26:46.000+00:00
diff --git a/plugins/dora/tasks/cicd_task_env_enricher.go b/plugins/dora/tasks/cicd_task_env_enricher.go
index 6d2ee16d..c73e5660 100644
--- a/plugins/dora/tasks/cicd_task_env_enricher.go
+++ b/plugins/dora/tasks/cicd_task_env_enricher.go
@@ -67,8 +67,8 @@ func EnrichTasksEnv(taskCtx core.SubTaskContext) (err errors.Error) {
 	if len(prefix) == 0 {
 		cursor, err = db.Cursor(
 			dal.From(&devops.CICDTask{}),
-			dal.Join("left join cicd_pipeline_commits cpr on cpr.repo_id = ? and cicd_tasks.pipeline_id = cpr.pipeline_id ", repoId),
-			dal.Where("status=? ", devops.DONE))
+			dal.Join("left join cicd_pipeline_commits cpr on cicd_tasks.pipeline_id = cpr.pipeline_id"),
+			dal.Where("status=? and repo_id=?", devops.DONE, repoId))
 	} else {
 		likeString := fmt.Sprintf(`%s:%s`, prefix, "%")
 		cursor, err = db.Cursor(