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

likyh 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 d5eb98891 fix(github): use repoUrl instead of repoId in 
cicd_pipeline_commits when converting github_run (#4883)
d5eb98891 is described below

commit d5eb98891581e85ad6cd51a0c19f10cd0b85cca3
Author: Warren Chen <[email protected]>
AuthorDate: Mon Apr 10 15:18:47 2023 +0800

    fix(github): use repoUrl instead of repoId in cicd_pipeline_commits when 
converting github_run (#4883)
---
 backend/plugins/github/e2e/cicd_test.go            |  1 +
 .../e2e/snapshot_tables/cicd_pipeline_commits.csv  | 40 +++++++++++-----------
 backend/plugins/github/tasks/cicd_run_convertor.go |  8 ++++-
 3 files changed, 28 insertions(+), 21 deletions(-)

diff --git a/backend/plugins/github/e2e/cicd_test.go 
b/backend/plugins/github/e2e/cicd_test.go
index 859f61130..476ec3c8c 100644
--- a/backend/plugins/github/e2e/cicd_test.go
+++ b/backend/plugins/github/e2e/cicd_test.go
@@ -47,6 +47,7 @@ func TestGithubCICDDataFlow(t *testing.T) {
        // import raw data table
        // SELECT * FROM _raw_github_api_runs INTO OUTFILE 
"/tmp/_raw_github_api_runs.csv" FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY 
'"' LINES TERMINATED BY '\r\n';
        
dataflowTester.ImportCsvIntoRawTable("./raw_tables/_raw_github_api_runs.csv", 
"_raw_github_api_runs")
+       
dataflowTester.ImportCsvIntoTabler("./raw_tables/_tool_github_repos.csv", 
&models.GithubRepo{})
 
        // verify extraction
        dataflowTester.FlushTabler(&models.GithubRun{})
diff --git 
a/backend/plugins/github/e2e/snapshot_tables/cicd_pipeline_commits.csv 
b/backend/plugins/github/e2e/snapshot_tables/cicd_pipeline_commits.csv
index ef7d620b5..11f8baca7 100644
--- a/backend/plugins/github/e2e/snapshot_tables/cicd_pipeline_commits.csv
+++ b/backend/plugins/github/e2e/snapshot_tables/cicd_pipeline_commits.csv
@@ -1,21 +1,21 @@
 pipeline_id,commit_sha,branch,repo_id,repo_url
-github:GithubRun:1:134018330:2559400712,5dd23ddff8621e6ae36eb24b20d4c4a06dd73dc9,Fix_rm_redundancy_code,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2559400713,5dd23ddff8621e6ae36eb24b20d4c4a06dd73dc9,Fix_rm_redundancy_code,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2559400714,5dd23ddff8621e6ae36eb24b20d4c4a06dd73dc9,Fix_rm_redundancy_code,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2559507315,f85611741eb1f5451697ac589008d28f240887fc,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2566218975,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2566218976,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2566218977,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2589885628,fa938334e73faf88a15b59622ab1da61a643c5da,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2589885635,fa938334e73faf88a15b59622ab1da61a643c5da,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2589885639,fa938334e73faf88a15b59622ab1da61a643c5da,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2600408985,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2639945362,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2680721264,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2722539966,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2764660507,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2807709308,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2850801364,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2893573709,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2938072864,06e6934c35c336b1a2bd3005fb21dc3914a45747,master,github:GithubRepo:1:134018330,
-github:GithubRun:1:134018330:2983238245,06e6934c35c336b1a2bd3005fb21dc3914a45747,master,github:GithubRepo:1:134018330,
+github:GithubRun:1:134018330:2559400712,5dd23ddff8621e6ae36eb24b20d4c4a06dd73dc9,Fix_rm_redundancy_code,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2559400713,5dd23ddff8621e6ae36eb24b20d4c4a06dd73dc9,Fix_rm_redundancy_code,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2559400714,5dd23ddff8621e6ae36eb24b20d4c4a06dd73dc9,Fix_rm_redundancy_code,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2559507315,f85611741eb1f5451697ac589008d28f240887fc,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2566218975,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2566218976,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2566218977,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2589885628,fa938334e73faf88a15b59622ab1da61a643c5da,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2589885635,fa938334e73faf88a15b59622ab1da61a643c5da,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2589885639,fa938334e73faf88a15b59622ab1da61a643c5da,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2600408985,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2639945362,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2680721264,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2722539966,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2764660507,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2807709308,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2850801364,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2893573709,32664cb1408f8d9ffa7236335025a4cd94a306ce,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2938072864,06e6934c35c336b1a2bd3005fb21dc3914a45747,master,,https://github.com/panjf2000/ants
+github:GithubRun:1:134018330:2983238245,06e6934c35c336b1a2bd3005fb21dc3914a45747,master,,https://github.com/panjf2000/ants
diff --git a/backend/plugins/github/tasks/cicd_run_convertor.go 
b/backend/plugins/github/tasks/cicd_run_convertor.go
index 8fc32b9a8..25b9a9bdb 100644
--- a/backend/plugins/github/tasks/cicd_run_convertor.go
+++ b/backend/plugins/github/tasks/cicd_run_convertor.go
@@ -43,6 +43,12 @@ func ConvertRuns(taskCtx plugin.SubTaskContext) errors.Error 
{
        data := taskCtx.GetData().(*GithubTaskData)
        repoId := data.Options.GithubId
 
+       repo := &models.GithubRepo{}
+       err := db.First(repo, dal.Where("connection_id = ? AND github_id = ?", 
data.Options.ConnectionId, data.Options.GithubId))
+       if err != nil {
+               return err
+       }
+
        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"),
@@ -99,7 +105,7 @@ func ConvertRuns(taskCtx plugin.SubTaskContext) errors.Error 
{
                                        data.Options.ConnectionId, line.RepoId, 
line.ID),
                                CommitSha: line.HeadSha,
                                Branch:    line.HeadBranch,
-                               RepoId:    
repoIdGen.Generate(data.Options.ConnectionId, repoId),
+                               RepoUrl:   repo.HTMLUrl,
                        }
 
                        return []interface{}{

Reply via email to