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 2023/04/25 09:15:46 UTC

[incubator-devlake] branch main updated: Github workflow run/job doesn't end up in cicd_deployment_commits table with correct Regex (#5030)

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 e878e2db7 Github workflow run/job doesn't end up in cicd_deployment_commits table with correct Regex (#5030)
e878e2db7 is described below

commit e878e2db7c275ac242d46f4930a28b89be68349f
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Tue Apr 25 17:15:42 2023 +0800

    Github workflow run/job doesn't end up in cicd_deployment_commits table with correct Regex (#5030)
    
    * fix: github graphql job sutask didn't fill in type/env
    
    * fix: github run convertor missing type/env
---
 backend/plugins/github/tasks/cicd_run_convertor.go    | 7 ++++---
 backend/plugins/github_graphql/tasks/job_collector.go | 3 +++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/backend/plugins/github/tasks/cicd_run_convertor.go b/backend/plugins/github/tasks/cicd_run_convertor.go
index a6d7e7efa..09bccc84f 100644
--- a/backend/plugins/github/tasks/cicd_run_convertor.go
+++ b/backend/plugins/github/tasks/cicd_run_convertor.go
@@ -18,6 +18,9 @@ limitations under the License.
 package tasks
 
 import (
+	"reflect"
+	"strings"
+
 	"github.com/apache/incubator-devlake/core/dal"
 	"github.com/apache/incubator-devlake/core/errors"
 	"github.com/apache/incubator-devlake/core/models/domainlayer"
@@ -26,8 +29,6 @@ import (
 	"github.com/apache/incubator-devlake/core/plugin"
 	"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
 	"github.com/apache/incubator-devlake/plugins/github/models"
-	"reflect"
-	"strings"
 )
 
 var ConvertRunsMeta = plugin.SubTaskMeta{
@@ -51,7 +52,7 @@ func ConvertRuns(taskCtx plugin.SubTaskContext) errors.Error {
 
 	pipeline := &models.GithubRun{}
 	cursor, err := db.Cursor(
-		dal.Select("id, repo_id, connection_id, name, head_sha, head_branch, status, conclusion, github_created_at, github_updated_at,_raw_data_remark, _raw_data_id, _raw_data_table, _raw_data_params"),
+		dal.Select("*"),
 		dal.From(pipeline),
 		dal.Where("repo_id = ? and connection_id=?", repoId, data.Options.ConnectionId),
 	)
diff --git a/backend/plugins/github_graphql/tasks/job_collector.go b/backend/plugins/github_graphql/tasks/job_collector.go
index 27ec6274b..2ec5c3242 100644
--- a/backend/plugins/github_graphql/tasks/job_collector.go
+++ b/backend/plugins/github_graphql/tasks/job_collector.go
@@ -25,6 +25,7 @@ import (
 
 	"github.com/apache/incubator-devlake/core/dal"
 	"github.com/apache/incubator-devlake/core/errors"
+	"github.com/apache/incubator-devlake/core/models/domainlayer/devops"
 	"github.com/apache/incubator-devlake/core/plugin"
 	helper "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
 	"github.com/apache/incubator-devlake/plugins/github/models"
@@ -190,6 +191,8 @@ func CollectGraphqlJobs(taskCtx plugin.SubTaskContext) errors.Error {
 						CompletedAt:  checkRun.CompletedAt,
 						Name:         checkRun.Name,
 						Steps:        paramsBytes,
+						Type:         data.RegexEnricher.ReturnNameIfMatched(devops.DEPLOYMENT, checkRun.Name),
+						Environment:  data.RegexEnricher.ReturnNameIfMatched(devops.PRODUCTION, checkRun.Name),
 						// these columns can not fill by graphql
 						//HeadSha:       ``,  // use _tool_github_runs
 						//RunURL:        ``,