You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by wa...@apache.org on 2022/09/26 10:28:29 UTC

[incubator-devlake] branch main updated (03214846 -> 277e35ce)

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

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


    from 03214846 fix(gitlab): set value for pipeline.name
     new 3ca47ae3 fix: type filed is nil in cicd_task table by jenkins-dora union plugin
     new 4eb62637 fix: type filed is nil in cicd_task table by jenkins-dora union plugin
     new 277e35ce fix: type filed is nil in cicd_task table by jenkins-dora union plugin

The 3 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/tasks/cicd_task_env_enricher.go | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)


[incubator-devlake] 02/03: fix: type filed is nil in cicd_task table by jenkins-dora union plugin

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

commit 4eb626375aa2fffec34e2e2b75a200925cba8b77
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon Sep 26 15:20:47 2022 +0800

    fix: type filed is nil in cicd_task table by jenkins-dora union plugin
---
 plugins/dora/tasks/cicd_task_env_enricher.go | 21 +++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)

diff --git a/plugins/dora/tasks/cicd_task_env_enricher.go b/plugins/dora/tasks/cicd_task_env_enricher.go
index f571b80f..0e21c136 100644
--- a/plugins/dora/tasks/cicd_task_env_enricher.go
+++ b/plugins/dora/tasks/cicd_task_env_enricher.go
@@ -37,6 +37,15 @@ var EnrichTaskEnvMeta = core.SubTaskMeta{
 	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
 }
 
+func Find(slice []string, val string) (int, bool) {
+	for i, item := range slice {
+		if item == val {
+			return i, true
+		}
+	}
+	return -1, false
+}
+
 func EnrichTasksEnv(taskCtx core.SubTaskContext) (err errors.Error) {
 	db := taskCtx.GetDal()
 	data := taskCtx.GetData().(*DoraTaskData)
@@ -62,15 +71,19 @@ func EnrichTasksEnv(taskCtx core.SubTaskContext) (err errors.Error) {
 	// 	return errors.Default.Wrap(errRegexp, "Regexp compile testingPattern failed")
 	// }
 	var cursor *sql.Rows
-	if len(dataSource) == 0 {
+	_, f1 := Find(dataSource, "jenkins")
+	if !f1 {
 		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.Join("left join cicd_pipeline_commits cpr on cpr.repo_id = '' and cicd_tasks.pipeline_id = cpr.pipeline_id "),
 			dal.Where("status=?", devops.DONE))
-	} else {
+	}
+	_, f2 := Find(dataSource, "github")
+	_, f3 := Find(dataSource, "gitlab")
+	if f2 || f3 || len(dataSource) == 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 "),
+			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))
 	}
 	if err != nil {


[incubator-devlake] 03/03: fix: type filed is nil in cicd_task table by jenkins-dora union plugin

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

commit 277e35ce605dd426a564d8041787ed4c2fe0e915
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon Sep 26 16:33:40 2022 +0800

    fix: type filed is nil in cicd_task table by jenkins-dora union plugin
---
 plugins/dora/tasks/cicd_task_env_enricher.go | 25 +++++++------------------
 1 file changed, 7 insertions(+), 18 deletions(-)

diff --git a/plugins/dora/tasks/cicd_task_env_enricher.go b/plugins/dora/tasks/cicd_task_env_enricher.go
index 0e21c136..c976b85b 100644
--- a/plugins/dora/tasks/cicd_task_env_enricher.go
+++ b/plugins/dora/tasks/cicd_task_env_enricher.go
@@ -37,15 +37,6 @@ var EnrichTaskEnvMeta = core.SubTaskMeta{
 	DomainTypes:      []string{core.DOMAIN_TYPE_CICD},
 }
 
-func Find(slice []string, val string) (int, bool) {
-	for i, item := range slice {
-		if item == val {
-			return i, true
-		}
-	}
-	return -1, false
-}
-
 func EnrichTasksEnv(taskCtx core.SubTaskContext) (err errors.Error) {
 	db := taskCtx.GetDal()
 	data := taskCtx.GetData().(*DoraTaskData)
@@ -70,21 +61,19 @@ func EnrichTasksEnv(taskCtx core.SubTaskContext) (err errors.Error) {
 	// if errRegexp != nil {
 	// 	return errors.Default.Wrap(errRegexp, "Regexp compile testingPattern failed")
 	// }
+
 	var cursor *sql.Rows
-	_, f1 := Find(dataSource, "jenkins")
-	if !f1 {
+	if len(dataSource) == 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 "),
-			dal.Where("status=?", devops.DONE))
-	}
-	_, f2 := Find(dataSource, "github")
-	_, f3 := Find(dataSource, "gitlab")
-	if f2 || f3 || len(dataSource) == 0 {
+			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))
+	} else {
+
 		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.Where("status=? and SUBSTRING_INDEX(id, ':', 1) in ? ", devops.DONE, dataSource))
 	}
 	if err != nil {
 		return err


[incubator-devlake] 01/03: fix: type filed is nil in cicd_task table by jenkins-dora union plugin

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

commit 3ca47ae313e5636df264770335c0a3a62e60769d
Author: abeizn <zi...@merico.dev>
AuthorDate: Mon Sep 26 14:38:04 2022 +0800

    fix: type filed is nil in cicd_task table by jenkins-dora union plugin
---
 plugins/dora/tasks/cicd_task_env_enricher.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/dora/tasks/cicd_task_env_enricher.go b/plugins/dora/tasks/cicd_task_env_enricher.go
index 13f80f5e..f571b80f 100644
--- a/plugins/dora/tasks/cicd_task_env_enricher.go
+++ b/plugins/dora/tasks/cicd_task_env_enricher.go
@@ -70,7 +70,7 @@ func EnrichTasksEnv(taskCtx core.SubTaskContext) (err errors.Error) {
 	} else {
 		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 "),
+			dal.Join("left join cicd_pipeline_commits cpr on cpr.repo_id = '' and cicd_tasks.pipeline_id = cpr.pipeline_id "),
 			dal.Where("status=?", devops.DONE))
 	}
 	if err != nil {