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 510635c81429abc58d37d619ff3af2e43751a3b1 Author: Yingchu Chen <[email protected]> AuthorDate: Thu Sep 15 19:00:29 2022 +0800 fix(dora): update dora e2e --- .../devops/{cicd_pipeline_repo.go => cicd_pipeline_commmit.go} | 0 models/migrationscripts/20220818_add_cicd.go | 2 +- models/migrationscripts/20220905_modfiy_cicd_pipeline.go | 2 +- models/migrationscripts/20220915_rename_pipeline_commits.go | 4 ++-- plugins/dora/e2e/calculate_change_lead_time_test.go | 2 +- plugins/dora/e2e/connect_issue_deploy_test.go | 2 +- plugins/dora/tasks/change_lead_time_calculator.go | 4 ++-- plugins/dora/tasks/issue_deploy_connector.go | 4 ++-- plugins/github/tasks/commit_convertor.go | 2 +- plugins/gitlab/tasks/commit_convertor.go | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/models/domainlayer/devops/cicd_pipeline_repo.go b/models/domainlayer/devops/cicd_pipeline_commmit.go similarity index 100% rename from models/domainlayer/devops/cicd_pipeline_repo.go rename to models/domainlayer/devops/cicd_pipeline_commmit.go diff --git a/models/migrationscripts/20220818_add_cicd.go b/models/migrationscripts/20220818_add_cicd.go index c03cc39d..0e3e5d17 100644 --- a/models/migrationscripts/20220818_add_cicd.go +++ b/models/migrationscripts/20220818_add_cicd.go @@ -87,5 +87,5 @@ type CICDPipelineRepo struct { } func (CICDPipelineRepo) TableName() string { - return "cicd_pipeline_repos" + return "cicd_pipeline_commits" } diff --git a/models/migrationscripts/20220905_modfiy_cicd_pipeline.go b/models/migrationscripts/20220905_modfiy_cicd_pipeline.go index dc9e0de1..4088948a 100644 --- a/models/migrationscripts/20220905_modfiy_cicd_pipeline.go +++ b/models/migrationscripts/20220905_modfiy_cicd_pipeline.go @@ -74,7 +74,7 @@ type CICDPipelineRepo0905 struct { } func (CICDPipelineRepo0905) TableName() string { - return "cicd_pipeline_repos" + return "cicd_pipeline_commits" } type CICDPipelineRelationship0905 struct { diff --git a/models/migrationscripts/20220915_rename_pipeline_commits.go b/models/migrationscripts/20220915_rename_pipeline_commits.go index 5b8adb25..7d192cc4 100644 --- a/models/migrationscripts/20220915_rename_pipeline_commits.go +++ b/models/migrationscripts/20220915_rename_pipeline_commits.go @@ -34,7 +34,7 @@ type CiCDPipelineRepoOld struct { } func (CiCDPipelineRepoOld) TableName() string { - return "cicd_pipeline_repos" + return "cicd_pipeline_commits" } type CiCDPipelineRepo0915 struct { @@ -58,7 +58,7 @@ func (*renamePipelineCommits) Up(ctx context.Context, db *gorm.DB) errors.Error if err != nil { return errors.Convert(err) } - err = db.Migrator().RenameIndex(CiCDPipelineRepo0915{}, `idx_cicd_pipeline_repos_raw_data_params`, `idx_cicd_pipeline_commits_raw_data_params`) + err = db.Migrator().RenameIndex(CiCDPipelineRepo0915{}, `idx_cicd_pipeline_commits_raw_data_params`, `idx_cicd_pipeline_commits_raw_data_params`) if err != nil { return errors.Convert(err) } diff --git a/plugins/dora/e2e/calculate_change_lead_time_test.go b/plugins/dora/e2e/calculate_change_lead_time_test.go index e648e297..3e6a58ac 100644 --- a/plugins/dora/e2e/calculate_change_lead_time_test.go +++ b/plugins/dora/e2e/calculate_change_lead_time_test.go @@ -43,7 +43,7 @@ func TestCalculateCLTimeDataFlow(t *testing.T) { } dataflowTester.FlushTabler(&code.PullRequest{}) // import raw data table - dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_pipeline_repos.csv", &devops.CiCDPipelineRepo{}) + dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_pipeline_commits.csv", &devops.CiCDPipelineCommit{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_tasks_for_other_jobs.csv", &devops.CICDTask{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_requests.csv", &code.PullRequest{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_request_comments.csv", &code.PullRequestComment{}) diff --git a/plugins/dora/e2e/connect_issue_deploy_test.go b/plugins/dora/e2e/connect_issue_deploy_test.go index bfbe9dae..76cf6412 100644 --- a/plugins/dora/e2e/connect_issue_deploy_test.go +++ b/plugins/dora/e2e/connect_issue_deploy_test.go @@ -45,7 +45,7 @@ func TestConnectIssueDeployDataFlow(t *testing.T) { } dataflowTester.FlushTabler(&code.PullRequest{}) // import raw data table - dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_pipeline_repos.csv", &devops.CiCDPipelineRepo{}) + dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_pipeline_commits.csv", &devops.CiCDPipelineCommit{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_tasks_for_other_jobs.csv", &devops.CICDTask{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/board_issues.csv", &ticket.BoardIssue{}) dataflowTester.ImportCsvIntoTabler("./raw_tables/board_repos.csv", &crossdomain.BoardRepo{}) diff --git a/plugins/dora/tasks/change_lead_time_calculator.go b/plugins/dora/tasks/change_lead_time_calculator.go index cceda1a5..c341fe61 100644 --- a/plugins/dora/tasks/change_lead_time_calculator.go +++ b/plugins/dora/tasks/change_lead_time_calculator.go @@ -152,8 +152,8 @@ func getDeployTime(repoId string, environment string, mergeDate time.Time, db da cicdTask := &devops.CICDTask{} cicdTaskClauses := []dal.Clause{ dal.From(&devops.CICDTask{}), - dal.Join("left join cicd_pipeline_repos on cicd_tasks.pipeline_id = cicd_pipeline_repos.id"), - dal.Where(`cicd_pipeline_repos.repo = ? + dal.Join("left join cicd_pipeline_commits on cicd_tasks.pipeline_id = cicd_pipeline_commits.pipeline_id"), + dal.Where(`cicd_pipeline_commits.repo = ? and cicd_tasks.environment = ? and cicd_tasks.result = ? and cicd_tasks.started_date > ?`, diff --git a/plugins/dora/tasks/issue_deploy_connector.go b/plugins/dora/tasks/issue_deploy_connector.go index 1cdbebd8..af27d2a0 100644 --- a/plugins/dora/tasks/issue_deploy_connector.go +++ b/plugins/dora/tasks/issue_deploy_connector.go @@ -74,9 +74,9 @@ func ConnectIssueDeploy(taskCtx core.SubTaskContext) errors.Error { cicdTask := &devops.CICDTask{} cicdTakClauses := []dal.Clause{ dal.From(cicdTask), - dal.Join("left join cicd_pipeline_repos on cicd_tasks.pipeline_id = cicd_pipeline_repos.id"), + dal.Join("left join cicd_pipeline_commits on cicd_tasks.pipeline_id = cicd_pipeline_commits.pipeline_id"), dal.Where( - `cicd_pipeline_repos.repo = ? and cicd_tasks.finished_date < ? + `cicd_pipeline_commits.repo = ? and cicd_tasks.finished_date < ? and cicd_tasks.result = ? and cicd_tasks.environment = ?`, data.Options.RepoId, issueToBeUpdate.CreatedDate, "SUCCESS", data.Options.Environment, ), diff --git a/plugins/github/tasks/commit_convertor.go b/plugins/github/tasks/commit_convertor.go index 42480dab..f7229faa 100644 --- a/plugins/github/tasks/commit_convertor.go +++ b/plugins/github/tasks/commit_convertor.go @@ -33,7 +33,7 @@ import ( var ConvertCommitsMeta = core.SubTaskMeta{ Name: "convertCommits", EntryPoint: ConvertCommits, - EnabledByDefault: true, + EnabledByDefault: false, Description: "Convert tool layer table github_commits into domain layer table commits", DomainTypes: []string{core.DOMAIN_TYPE_CODE}, } diff --git a/plugins/gitlab/tasks/commit_convertor.go b/plugins/gitlab/tasks/commit_convertor.go index 570f76d0..61eec5bb 100644 --- a/plugins/gitlab/tasks/commit_convertor.go +++ b/plugins/gitlab/tasks/commit_convertor.go @@ -33,7 +33,7 @@ import ( var ConvertCommitsMeta = core.SubTaskMeta{ Name: "convertApiCommits", EntryPoint: ConvertApiCommits, - EnabledByDefault: true, + EnabledByDefault: false, Description: "Update domain layer commit according to GitlabCommit", DomainTypes: []string{core.DOMAIN_TYPE_CODE}, }
