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 e900ee844 fix: incident deployment connector logic, update cicd_tasks 
to cicd_d… (#5039)
e900ee844 is described below

commit e900ee8444fcf6beea96c0de608e43f2dc51ea5f
Author: abeizn <[email protected]>
AuthorDate: Wed Apr 26 22:43:46 2023 +0800

    fix: incident deployment connector logic, update cicd_tasks to cicd_d… 
(#5039)
    
    * fix: incident deployment connector logic, update cicd_tasks to 
cicd_deployment_commits
    
    * fix: dora e2e
    
    * fix: update incident deploy logic
    
    * fix: e2e utc time
    
    * fix: github cicd pipeline e2e
    
    * fix: deployment commit e2e
---
 .../domainlayer/devops/cicd_deployment_commit.go   |   2 +-
 ....go => 20230426_add_cicd_deployment_commits.go} |   2 +-
 .../migrationscripts/archived/cicd_deployment.go   |   2 +-
 .../bitbucket/tasks/deployment_convertor.go        |   6 +-
 .../change_lead_time/cicd_deployment_commits.csv   |   2 +-
 .../dora/e2e/connect_incident_to_deploy_test.go    |   5 +-
 .../e2e/prev_deployment_commit_enricher_test.go    |   3 +-
 .../cicd_deployment_commits_after.csv              |  34 ++---
 .../cicd_deployment_commits_before.csv             |  34 ++---
 .../e2e/snapshot_tables/project_issue_metrics.csv  |   8 +-
 backend/plugins/dora/impl/impl.go                  |   2 -
 .../dora/tasks/change_lead_time_calculator_old.go  | 155 ---------------------
 .../dora/tasks/deployment_commits_generator.go     |  26 ++--
 .../dora/tasks/incident_deploy_connector.go        |  47 ++++---
 .../dora/tasks/incident_deploy_connector_old.go    | 107 --------------
 .../dora/tasks/prev_deployment_commit_enricher.go  |   6 +-
 .../github/e2e/snapshot_tables/cicd_pipelines.csv  |  28 ++--
 .../cicd_deployment_commits.csv                    |   2 +-
 backend/plugins/webhook/api/deployments.go         |  28 ++--
 19 files changed, 125 insertions(+), 374 deletions(-)

diff --git a/backend/core/models/domainlayer/devops/cicd_deployment_commit.go 
b/backend/core/models/domainlayer/devops/cicd_deployment_commit.go
index f412e2b97..500fe7f7b 100644
--- a/backend/core/models/domainlayer/devops/cicd_deployment_commit.go
+++ b/backend/core/models/domainlayer/devops/cicd_deployment_commit.go
@@ -26,7 +26,7 @@ import (
 type CicdDeploymentCommit struct {
        domainlayer.DomainEntity
        CicdScopeId                   string `gorm:"index;type:varchar(255)"`
-       CicdPipelineId                string `gorm:"type:varchar(255)"` // if 
it is converted from a cicd_pipeline_commit
+       CicdDeploymentId              string `gorm:"type:varchar(255)"` // if 
it is converted from a cicd_pipeline_commit
        Name                          string `gorm:"type:varchar(255)"`
        Result                        string `gorm:"type:varchar(100)"`
        Status                        string `gorm:"type:varchar(100)"`
diff --git 
a/backend/core/models/migrationscripts/20230411_add_cicd_deployment_commits.go 
b/backend/core/models/migrationscripts/20230426_add_cicd_deployment_commits.go
similarity index 98%
rename from 
backend/core/models/migrationscripts/20230411_add_cicd_deployment_commits.go
rename to 
backend/core/models/migrationscripts/20230426_add_cicd_deployment_commits.go
index ff06ec51b..293c5aa52 100644
--- 
a/backend/core/models/migrationscripts/20230411_add_cicd_deployment_commits.go
+++ 
b/backend/core/models/migrationscripts/20230426_add_cicd_deployment_commits.go
@@ -37,7 +37,7 @@ func (*addCicdDeploymentCommits) Up(basicRes 
context.BasicRes) errors.Error {
 }
 
 func (*addCicdDeploymentCommits) Version() uint64 {
-       return 20230411150702
+       return 20230426150702
 }
 
 func (*addCicdDeploymentCommits) Name() string {
diff --git a/backend/core/models/migrationscripts/archived/cicd_deployment.go 
b/backend/core/models/migrationscripts/archived/cicd_deployment.go
index 627cd6c55..dfed520db 100644
--- a/backend/core/models/migrationscripts/archived/cicd_deployment.go
+++ b/backend/core/models/migrationscripts/archived/cicd_deployment.go
@@ -24,7 +24,7 @@ import (
 type CicdDeploymentCommit struct {
        DomainEntity
        CicdScopeId                   string `gorm:"index;type:varchar(255)"`
-       CicdPipelineId                string `gorm:"type:varchar(255)"` // if 
it is converted from a cicd_pipeline_commit
+       CicdDeploymentId              string `gorm:"type:varchar(255)"` // if 
it is converted from a cicd_pipeline_commit
        Name                          string `gorm:"type:varchar(255)"`
        Result                        string `gorm:"type:varchar(100)"`
        Status                        string `gorm:"type:varchar(100)"`
diff --git a/backend/plugins/bitbucket/tasks/deployment_convertor.go 
b/backend/plugins/bitbucket/tasks/deployment_convertor.go
index 04e98682c..3de4696eb 100644
--- a/backend/plugins/bitbucket/tasks/deployment_convertor.go
+++ b/backend/plugins/bitbucket/tasks/deployment_convertor.go
@@ -84,9 +84,9 @@ func ConvertDeployments(taskCtx plugin.SubTaskContext) 
errors.Error {
                                DomainEntity: domainlayer.DomainEntity{
                                        Id: 
idGen.Generate(data.Options.ConnectionId, bitbucketDeployment.BitbucketId),
                                },
-                               CicdScopeId:    repoId,
-                               CicdPipelineId: 
pipelineIdGen.Generate(data.Options.ConnectionId, 
bitbucketDeployment.PipelineId),
-                               Name:           bitbucketDeployment.Name,
+                               CicdScopeId:      repoId,
+                               CicdDeploymentId: 
pipelineIdGen.Generate(data.Options.ConnectionId, 
bitbucketDeployment.PipelineId),
+                               Name:             bitbucketDeployment.Name,
                                Result: devops.GetResult(&devops.ResultRule{
                                        Failed:  []string{"UNDEPLOYED"},
                                        Success: []string{"COMPLETED"},
diff --git 
a/backend/plugins/dora/e2e/change_lead_time/cicd_deployment_commits.csv 
b/backend/plugins/dora/e2e/change_lead_time/cicd_deployment_commits.csv
index 9f2040747..9517c2520 100644
--- a/backend/plugins/dora/e2e/change_lead_time/cicd_deployment_commits.csv
+++ b/backend/plugins/dora/e2e/change_lead_time/cicd_deployment_commits.csv
@@ -1,4 +1,4 @@
-id,result,started_date,duration_sec,cicd_pipeline_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,_raw_data_remark,commit_sha,created_date,finished_date
+id,result,started_date,duration_sec,cicd_deployment_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,_raw_data_remark,commit_sha,created_date,finished_date
 
1,SUCCESS,2023-04-10T06:51:47.000+00:00,60,pipeline1,cicd1,REPO111,PRODUCTION,,project1,commit1,2023-4-10
 6:51:47,2023-04-10T06:52:47.000+00:00
 
2,SUCCESS,2023-04-10T06:53:51.000+00:00,60,pipeline1,cicd1,REPO222,PRODUCTION,,project1,commit2,2023-4-10
 6:53:51,2023-04-10T06:54:51.000+00:00
 
3,SUCCESS,2023-04-13T07:21:16.000+00:00,60,pipeline2,cicd2,REPO111,PRODUCTION,,,commit3,2023-4-13
 7:21:16,2023-04-13T07:22:16.000+00:00
diff --git a/backend/plugins/dora/e2e/connect_incident_to_deploy_test.go 
b/backend/plugins/dora/e2e/connect_incident_to_deploy_test.go
index b60d99bed..b23684779 100644
--- a/backend/plugins/dora/e2e/connect_incident_to_deploy_test.go
+++ b/backend/plugins/dora/e2e/connect_incident_to_deploy_test.go
@@ -18,6 +18,8 @@ limitations under the License.
 package e2e
 
 import (
+       "testing"
+
        "github.com/apache/incubator-devlake/core/models/common"
        
"github.com/apache/incubator-devlake/core/models/domainlayer/crossdomain"
        "github.com/apache/incubator-devlake/core/models/domainlayer/devops"
@@ -25,7 +27,6 @@ import (
        "github.com/apache/incubator-devlake/helpers/e2ehelper"
        "github.com/apache/incubator-devlake/plugins/dora/impl"
        "github.com/apache/incubator-devlake/plugins/dora/tasks"
-       "testing"
 )
 
 func TestConnectIncidentToDeploymentDataFlow(t *testing.T) {
@@ -41,7 +42,7 @@ func TestConnectIncidentToDeploymentDataFlow(t *testing.T) {
                },
        }
        // import raw data table
-       dataflowTester.ImportCsvIntoTabler("./raw_tables/cicd_tasks.csv", 
&devops.CICDTask{})
+       
dataflowTester.ImportCsvIntoTabler("./prev_success_deployment_commit/cicd_deployment_commits_after.csv",
 &devops.CicdDeploymentCommit{})
        dataflowTester.ImportCsvIntoTabler("./raw_tables/project_mapping.csv", 
&crossdomain.ProjectMapping{})
        dataflowTester.ImportCsvIntoTabler("./raw_tables/board_issues.csv", 
&ticket.BoardIssue{})
        dataflowTester.ImportCsvIntoTabler("./raw_tables/issues.csv", 
&ticket.Issue{})
diff --git a/backend/plugins/dora/e2e/prev_deployment_commit_enricher_test.go 
b/backend/plugins/dora/e2e/prev_deployment_commit_enricher_test.go
index 13f7e72f2..39e930310 100644
--- a/backend/plugins/dora/e2e/prev_deployment_commit_enricher_test.go
+++ b/backend/plugins/dora/e2e/prev_deployment_commit_enricher_test.go
@@ -48,7 +48,8 @@ func TestPrevSuccessDeploymentCommitEnricherDataFlow(t 
*testing.T) {
                        "id",
                        "result",
                        "started_date",
-                       "cicd_pipeline_id",
+                       "finished_date",
+                       "cicd_deployment_id",
                        "cicd_scope_id",
                        "repo_url",
                        "environment",
diff --git 
a/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_after.csv
 
b/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_after.csv
index b0d2b8f2d..2691aa12c 100644
--- 
a/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_after.csv
+++ 
b/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_after.csv
@@ -1,17 +1,17 @@
-id,result,started_date,cicd_pipeline_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,_raw_data_remark,commit_sha,created_date
-1,SUCCESS,2023-04-10T06:51:47.000+00:00,pipeline1,cicd1,REPO111,PRODUCTION,,,1,2023-4-10
 6:51:47
-2,SUCCESS,2023-04-10T06:53:51.000+00:00,pipeline1,cicd1,REPO222,PRODUCTION,,,2,2023-4-10
 6:53:51
-3,SUCCESS,2023-04-13T07:21:16.000+00:00,pipeline2,cicd2,REPO111,PRODUCTION,,,3,2023-4-13
 7:21:16
-4,SUCCESS,2023-04-13T07:22:14.000+00:00,pipeline2,cicd2,REPO333,PRODUCTION,,,4,2023-4-13
 7:22:14
-5,SUCCESS,2023-04-13T07:28:14.000+00:00,pipeline4,cicd1,REPO111,PRODUCTION,1,,5,2023-4-13
 7:28:14
-6,SUCCESS,2023-04-13T07:29:34.000+00:00,pipeline4,cicd1,REPO222,PRODUCTION,2,,6,2023-4-13
 7:29:34
-7,SUCCESS,2023-04-13T07:31:53.000+00:00,pipeline5,cicd1,REPO111,STAGING,,,7,2023-4-13
 7:31:53
-8,SUCCESS,2023-04-13T07:36:30.000+00:00,pipeline5,cicd1,REPO111,STAGING,7,,8,2023-4-13
 7:36:30
-9,SUCCESS,2023-04-13T07:51:26.000+00:00,pipeline6,cicd1,REPO111,PRODUCTION,5,,9,2023-4-13
 7:51:26
-10,SUCCESS,2023-04-13T07:53:31.000+00:00,pipeline6,cicd1,REPO222,PRODUCTION,6,,10,2023-4-13
 7:53:31
-11,FAILURE,2023-04-13T07:54:39.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,,failed
 record should be ignored,11,2023-4-13 7:54:39
-12,SUCCESS,2023-04-13T07:55:01.000+00:00,pipeline7,cicd2,REPO333,PRODUCTION,4,,12,2023-4-13
 7:55:01
-13,SUCCESS,2023-04-13T07:56:39.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,3,retried
 and success should be ok,13,2023-4-13 7:56:39
-14,FAILURE,2023-04-13T07:57:26.000+00:00,pipeline8,cicd3,REPO111,PRODUCTION,,,14,2023-4-13
 7:57:26
-15,SUCCESS,2023-04-13T07:57:45.000+00:00,pipeline9,cicd3,REPO111,PRODUCTION,,not
 belongs to the project,15,2023-4-13 7:57:45
-16,SUCCESS,2023-04-13T07:58:24.000+00:00,pipeline10,cicd3,REPO333,,,,16,2023-4-13
 7:58:24
\ No newline at end of file
+id,commit_sha,result,started_date,finished_date,cicd_deployment_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id
+1,1,SUCCESS,2022-09-10T06:51:47.000+00:00,2022-09-11T06:51:47.000+00:00,pipeline1,cicd1,REPO111,PRODUCTION,
+10,10,SUCCESS,2022-09-13T07:53:31.000+00:00,2022-09-21T06:51:47.000+00:00,pipeline6,cicd1,REPO222,PRODUCTION,6
+11,11,FAILURE,2022-09-13T07:54:39.000+00:00,2022-09-22T06:51:47.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,
+12,12,SUCCESS,2022-09-13T07:55:01.000+00:00,2022-09-23T06:51:47.000+00:00,pipeline7,cicd2,REPO333,PRODUCTION,4
+13,13,SUCCESS,2022-09-13T07:56:39.000+00:00,2022-09-24T06:51:47.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,3
+14,14,FAILURE,2022-09-13T07:57:26.000+00:00,2022-09-20T06:51:47.000+00:00,pipeline8,cicd3,REPO111,PRODUCTION,
+15,15,SUCCESS,2022-09-13T07:57:45.000+00:00,2022-09-14T06:51:47.000+00:00,pipeline9,cicd3,REPO111,PRODUCTION,
+16,16,SUCCESS,2022-09-13T07:58:24.000+00:00,2022-09-15T06:51:47.000+00:00,pipeline10,cicd3,REPO333,,
+2,2,SUCCESS,2022-09-10T06:53:51.000+00:00,2022-09-12T06:51:47.000+00:00,pipeline1,cicd1,REPO222,PRODUCTION,
+3,3,SUCCESS,2022-09-13T07:21:16.000+00:00,2022-09-14T06:51:47.000+00:00,pipeline2,cicd2,REPO111,PRODUCTION,
+4,4,SUCCESS,2022-09-13T07:22:14.000+00:00,2022-09-15T06:51:47.000+00:00,pipeline2,cicd2,REPO333,PRODUCTION,
+5,5,SUCCESS,2022-09-13T07:28:14.000+00:00,2022-09-16T06:51:47.000+00:00,pipeline4,cicd1,REPO111,PRODUCTION,1
+6,6,SUCCESS,2022-09-13T07:29:34.000+00:00,2022-09-17T06:51:47.000+00:00,pipeline4,cicd1,REPO222,PRODUCTION,2
+7,7,SUCCESS,2022-09-13T07:31:53.000+00:00,2022-09-18T06:51:47.000+00:00,pipeline5,cicd1,REPO111,STAGING,
+8,8,SUCCESS,2022-09-13T07:36:30.000+00:00,2022-09-19T06:51:47.000+00:00,pipeline5,cicd1,REPO111,STAGING,7
+9,9,SUCCESS,2022-09-13T07:51:26.000+00:00,2022-09-20T06:51:47.000+00:00,pipeline6,cicd1,REPO111,PRODUCTION,5
diff --git 
a/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_before.csv
 
b/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_before.csv
index 367ca6d64..a6ee74a82 100644
--- 
a/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_before.csv
+++ 
b/backend/plugins/dora/e2e/prev_success_deployment_commit/cicd_deployment_commits_before.csv
@@ -1,17 +1,17 @@
-id,result,started_date,cicd_pipeline_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,_raw_data_remark,commit_sha,created_date
-1,SUCCESS,2023-04-10T06:51:47.000+00:00,pipeline1,cicd1,REPO111,PRODUCTION,,,1,2023-4-10
 6:51:47
-2,SUCCESS,2023-04-10T06:53:51.000+00:00,pipeline1,cicd1,REPO222,PRODUCTION,,,2,2023-4-10
 6:53:51
-3,SUCCESS,2023-04-13T07:21:16.000+00:00,pipeline2,cicd2,REPO111,PRODUCTION,,,3,2023-4-13
 7:21:16
-4,SUCCESS,2023-04-13T07:22:14.000+00:00,pipeline2,cicd2,REPO333,PRODUCTION,,,4,2023-4-13
 7:22:14
-5,SUCCESS,2023-04-13T07:28:14.000+00:00,pipeline4,cicd1,REPO111,PRODUCTION,,,5,2023-4-13
 7:28:14
-6,SUCCESS,2023-04-13T07:29:34.000+00:00,pipeline4,cicd1,REPO222,PRODUCTION,,,6,2023-4-13
 7:29:34
-7,SUCCESS,2023-04-13T07:31:53.000+00:00,pipeline5,cicd1,REPO111,STAGING,,,7,2023-4-13
 7:31:53
-8,SUCCESS,2023-04-13T07:36:30.000+00:00,pipeline5,cicd1,REPO111,STAGING,,,8,2023-4-13
 7:36:30
-9,SUCCESS,2023-04-13T07:51:26.000+00:00,pipeline6,cicd1,REPO111,PRODUCTION,,,9,2023-4-13
 7:51:26
-10,SUCCESS,2023-04-13T07:53:31.000+00:00,pipeline6,cicd1,REPO222,PRODUCTION,,,10,2023-4-13
 7:53:31
-11,FAILURE,2023-04-13T07:54:39.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,,failed
 record should be ignored,11,2023-4-13 7:54:39
-12,SUCCESS,2023-04-13T07:55:01.000+00:00,pipeline7,cicd2,REPO333,PRODUCTION,,,12,2023-4-13
 7:55:01
-13,SUCCESS,2023-04-13T07:56:39.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,,retried
 and success should be ok,13,2023-4-13 7:56:39
-14,FAILURE,2023-04-13T07:57:26.000+00:00,pipeline8,cicd3,REPO111,PRODUCTION,,,14,2023-4-13
 7:57:26
-15,SUCCESS,2023-04-13T07:57:45.000+00:00,pipeline9,cicd3,REPO111,PRODUCTION,,not
 belongs to the project,15,2023-4-13 7:57:45
-16,SUCCESS,2023-04-13T07:58:24.000+00:00,pipeline10,cicd3,REPO333,,,,16,2023-4-13
 7:58:24
\ No newline at end of file
+id,result,started_date,finished_date,cicd_deployment_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,_raw_data_remark,commit_sha,created_date
+1,SUCCESS,2022-09-10T06:51:47.000+00:00,2022-09-11T06:51:47.000+00:00,pipeline1,cicd1,REPO111,PRODUCTION,,,1,2022-09-10
 6:51:47
+2,SUCCESS,2022-09-10T06:53:51.000+00:00,2022-09-12T06:51:47.000+00:00,pipeline1,cicd1,REPO222,PRODUCTION,,,2,2022-09-10
 6:53:51
+3,SUCCESS,2022-09-13T07:21:16.000+00:00,2022-09-14T06:51:47.000+00:00,pipeline2,cicd2,REPO111,PRODUCTION,,,3,2022-09-13
 7:21:16
+4,SUCCESS,2022-09-13T07:22:14.000+00:00,2022-09-15T06:51:47.000+00:00,pipeline2,cicd2,REPO333,PRODUCTION,,,4,2022-09-13
 7:22:14
+5,SUCCESS,2022-09-13T07:28:14.000+00:00,2022-09-16T06:51:47.000+00:00,pipeline4,cicd1,REPO111,PRODUCTION,,,5,2022-09-13
 7:28:14
+6,SUCCESS,2022-09-13T07:29:34.000+00:00,2022-09-17T06:51:47.000+00:00,pipeline4,cicd1,REPO222,PRODUCTION,,,6,2022-09-13
 7:29:34
+7,SUCCESS,2022-09-13T07:31:53.000+00:00,2022-09-18T06:51:47.000+00:00,pipeline5,cicd1,REPO111,STAGING,,,7,2022-09-13
 7:31:53
+8,SUCCESS,2022-09-13T07:36:30.000+00:00,2022-09-19T06:51:47.000+00:00,pipeline5,cicd1,REPO111,STAGING,,,8,2022-09-13
 7:36:30
+9,SUCCESS,2022-09-13T07:51:26.000+00:00,2022-09-20T06:51:47.000+00:00,pipeline6,cicd1,REPO111,PRODUCTION,,,9,2022-09-13
 7:51:26
+10,SUCCESS,2022-09-13T07:53:31.000+00:00,2022-09-21T06:51:47.000+00:00,pipeline6,cicd1,REPO222,PRODUCTION,,,10,2022-09-13
 7:53:31
+11,FAILURE,2022-09-13T07:54:39.000+00:00,2022-09-22T06:51:47.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,,failed
 record should be ignored,11,2022-09-13 7:54:39
+12,SUCCESS,2022-09-13T07:55:01.000+00:00,2022-09-23T06:51:47.000+00:00,pipeline7,cicd2,REPO333,PRODUCTION,,,12,2022-09-13
 7:55:01
+13,SUCCESS,2022-09-13T07:56:39.000+00:00,2022-09-24T06:51:47.000+00:00,pipeline7,cicd2,REPO111,PRODUCTION,,retried
 and success should be ok,13,2022-09-13 7:56:39
+14,FAILURE,2022-09-13T07:57:26.000+00:00,2022-09-20T06:51:47.000+00:00,pipeline8,cicd3,REPO111,PRODUCTION,,,14,2022-09-13
 7:57:26
+15,SUCCESS,2022-09-13T07:57:45.000+00:00,2022-09-14T06:51:47.000+00:00,pipeline9,cicd3,REPO111,PRODUCTION,,not
 belongs to the project,15,2022-09-13 7:57:45
+16,SUCCESS,2022-09-13T07:58:24.000+00:00,2022-09-15T06:51:47.000+00:00,pipeline10,cicd3,REPO333,,,,16,2022-09-13
 7:58:24
\ No newline at end of file
diff --git a/backend/plugins/dora/e2e/snapshot_tables/project_issue_metrics.csv 
b/backend/plugins/dora/e2e/snapshot_tables/project_issue_metrics.csv
index dc93a25c9..6167a6f16 100644
--- a/backend/plugins/dora/e2e/snapshot_tables/project_issue_metrics.csv
+++ b/backend/plugins/dora/e2e/snapshot_tables/project_issue_metrics.csv
@@ -1,5 +1,5 @@
 id,project_name,deployment_id
-github:GithubIssue:1:1367714738,project1,task10
-github:GithubIssue:1:1370816458,project1,task11
-github:GithubIssue:1:1371320153,project1,task12
-github:GithubIssue:1:1372381019,project1,task13
+github:GithubIssue:1:1367714738,project1,pipeline7
+github:GithubIssue:1:1370816458,project1,pipeline7
+github:GithubIssue:1:1371320153,project1,pipeline7
+github:GithubIssue:1:1372381019,project1,pipeline7
diff --git a/backend/plugins/dora/impl/impl.go 
b/backend/plugins/dora/impl/impl.go
index afc762daa..5a57ea20b 100644
--- a/backend/plugins/dora/impl/impl.go
+++ b/backend/plugins/dora/impl/impl.go
@@ -87,8 +87,6 @@ func (p Dora) SubTaskMetas() []plugin.SubTaskMeta {
                tasks.EnrichTaskEnvMeta,
                tasks.CalculateChangeLeadTimeMeta,
                tasks.ConnectIncidentToDeploymentMeta,
-               tasks.CalculateChangeLeadTimeOldMeta,
-               tasks.ConnectIncidentToDeploymentOldMeta,
        }
 }
 
diff --git a/backend/plugins/dora/tasks/change_lead_time_calculator_old.go 
b/backend/plugins/dora/tasks/change_lead_time_calculator_old.go
deleted file mode 100644
index ae94eb316..000000000
--- a/backend/plugins/dora/tasks/change_lead_time_calculator_old.go
+++ /dev/null
@@ -1,155 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package tasks
-
-import (
-       "reflect"
-       "time"
-
-       "github.com/apache/incubator-devlake/core/dal"
-       "github.com/apache/incubator-devlake/core/errors"
-       "github.com/apache/incubator-devlake/core/models/domainlayer/code"
-       
"github.com/apache/incubator-devlake/core/models/domainlayer/crossdomain"
-       "github.com/apache/incubator-devlake/core/models/domainlayer/devops"
-       "github.com/apache/incubator-devlake/core/plugin"
-       "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
-)
-
-// CalculateChangeLeadTimeOldMeta will be removed in v0.17
-// DEPRECATED
-func CalculateChangeLeadTimeOld(taskCtx plugin.SubTaskContext) errors.Error {
-       db := taskCtx.GetDal()
-       log := taskCtx.GetLogger()
-       clauses := []dal.Clause{
-               dal.From(&code.PullRequest{}),
-               dal.Where("merged_date IS NOT NULL"),
-       }
-       cursor, err := db.Cursor(clauses...)
-       if err != nil {
-               return err
-       }
-       defer cursor.Close()
-
-       enricher, err := api.NewDataConverter(api.DataConverterArgs{
-               RawDataSubTaskArgs: api.RawDataSubTaskArgs{
-                       Ctx:    taskCtx,
-                       Params: DoraApiParams{},
-                       Table:  "pull_requests",
-               },
-               BatchSize:    100,
-               InputRowType: reflect.TypeOf(code.PullRequest{}),
-               Input:        cursor,
-               Convert: func(inputRow interface{}) ([]interface{}, 
errors.Error) {
-                       pr := inputRow.(*code.PullRequest)
-                       firstCommit, err := getFirstCommit(pr.Id, db)
-                       if err != nil {
-                               return nil, err
-                       }
-                       projectPrMetric := &crossdomain.ProjectPrMetric{}
-                       projectPrMetric.Id = pr.Id
-                       projectPrMetric.ProjectName = "DEFAULT_PROJECT_NAME"
-                       if err != nil {
-                               return nil, err
-                       }
-                       if firstCommit != nil {
-                               projectPrMetric.PrCodingTime = 
computeTimeSpan(&firstCommit.CommitAuthoredDate, &pr.CreatedDate)
-                               projectPrMetric.FirstCommitSha = 
firstCommit.CommitSha
-                       }
-                       firstReview, err := getFirstReview(pr.Id, pr.AuthorId, 
db)
-                       if err != nil {
-                               return nil, err
-                       }
-                       if firstReview != nil {
-                               projectPrMetric.PrPickupTime = 
computeTimeSpan(&pr.CreatedDate, &firstReview.CreatedDate)
-                               projectPrMetric.PrReviewTime = 
computeTimeSpan(&firstReview.CreatedDate, pr.MergedDate)
-                               projectPrMetric.FirstReviewId = firstReview.Id
-                       }
-                       deployment, err := getDeploymentOld(devops.PRODUCTION, 
*pr.MergedDate, db)
-                       if err != nil {
-                               return nil, err
-                       }
-                       if deployment != nil && deployment.FinishedDate != nil {
-                               projectPrMetric.PrDeployTime = 
computeTimeSpan(pr.MergedDate, deployment.FinishedDate)
-                               projectPrMetric.DeploymentCommitId = 
deployment.Id
-                       } else {
-                               log.Debug("deploy time of pr %v is nil\n", 
pr.PullRequestKey)
-                       }
-                       projectPrMetric.PrCycleTime = nil
-                       var result int64
-                       if projectPrMetric.PrCodingTime != nil {
-                               result += *projectPrMetric.PrCodingTime
-                       }
-                       if projectPrMetric.PrPickupTime != nil {
-                               result += *projectPrMetric.PrPickupTime
-                       }
-                       if projectPrMetric.PrReviewTime != nil {
-                               result += *projectPrMetric.PrReviewTime
-                       }
-                       if projectPrMetric.PrDeployTime != nil {
-                               result += *projectPrMetric.PrDeployTime
-                       }
-                       if result > 0 {
-                               projectPrMetric.PrCycleTime = &result
-                       }
-                       return []interface{}{projectPrMetric}, nil
-               },
-       })
-       if err != nil {
-               return err
-       }
-
-       return enricher.Execute()
-}
-
-func getDeploymentOld(environment string, mergeDate time.Time, db dal.Dal) 
(*devops.CICDTask, errors.Error) {
-       // ignore environment at this point because detecting it by name is 
obviously not engouh
-       // take 
https://github.com/apache/incubator-devlake/actions/workflows/build.yml for 
example
-       // one can not distingush testing/production by looking at the job name 
solely.
-       cicdTask := &devops.CICDTask{}
-       cicdTaskClauses := []dal.Clause{
-               dal.From(&devops.CICDTask{}),
-               dal.Where(`
-                       type = ?
-                       AND cicd_tasks.result = ?
-                       AND cicd_tasks.started_date > ?`,
-                       "DEPLOYMENT",
-                       "SUCCESS",
-                       mergeDate,
-               ),
-               dal.Orderby("cicd_tasks.started_date ASC"),
-               dal.Limit(1),
-       }
-       err := db.First(cicdTask, cicdTaskClauses...)
-       if db.IsErrorNotFound(err) {
-               return nil, nil
-       }
-       if err != nil {
-               return nil, err
-       }
-       return cicdTask, nil
-}
-
-// CalculateChangeLeadTimeOldMeta will be removed in v0.17
-// DEPRECATED
-var CalculateChangeLeadTimeOldMeta = plugin.SubTaskMeta{
-       Name:             "calculateChangeLeadTimeOld",
-       EntryPoint:       CalculateChangeLeadTimeOld,
-       EnabledByDefault: false,
-       Description:      "Calculate change lead time",
-       DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD, 
plugin.DOMAIN_TYPE_CODE},
-}
diff --git a/backend/plugins/dora/tasks/deployment_commits_generator.go 
b/backend/plugins/dora/tasks/deployment_commits_generator.go
index ffbb5501d..744cde5e1 100644
--- a/backend/plugins/dora/tasks/deployment_commits_generator.go
+++ b/backend/plugins/dora/tasks/deployment_commits_generator.go
@@ -118,19 +118,19 @@ func GenerateDeploymentCommits(taskCtx 
plugin.SubTaskContext) errors.Error {
                                DomainEntity: domainlayer.DomainEntity{
                                        Id: fmt.Sprintf("%s:%s", 
pipelineCommit.PipelineId, pipelineCommit.RepoUrl),
                                },
-                               CicdScopeId:    pipelineCommit.CicdScopeId,
-                               CicdPipelineId: pipelineCommit.PipelineId,
-                               Name:           pipelineCommit.PipelineName,
-                               Result:         pipelineCommit.Result,
-                               Status:         pipelineCommit.Status,
-                               Environment:    pipelineCommit.Environment,
-                               CreatedDate:    *pipelineCommit.CreatedDate,
-                               FinishedDate:   pipelineCommit.FinishedDate,
-                               DurationSec:    pipelineCommit.DurationSec,
-                               CommitSha:      pipelineCommit.CommitSha,
-                               RefName:        pipelineCommit.Branch,
-                               RepoId:         pipelineCommit.RepoId,
-                               RepoUrl:        pipelineCommit.RepoUrl,
+                               CicdScopeId:      pipelineCommit.CicdScopeId,
+                               CicdDeploymentId: pipelineCommit.PipelineId,
+                               Name:             pipelineCommit.PipelineName,
+                               Result:           pipelineCommit.Result,
+                               Status:           pipelineCommit.Status,
+                               Environment:      pipelineCommit.Environment,
+                               CreatedDate:      *pipelineCommit.CreatedDate,
+                               FinishedDate:     pipelineCommit.FinishedDate,
+                               DurationSec:      pipelineCommit.DurationSec,
+                               CommitSha:        pipelineCommit.CommitSha,
+                               RefName:          pipelineCommit.Branch,
+                               RepoId:           pipelineCommit.RepoId,
+                               RepoUrl:          pipelineCommit.RepoUrl,
                        }
                        if pipelineCommit.FinishedDate != nil && 
pipelineCommit.DurationSec != nil {
                                s := 
pipelineCommit.FinishedDate.Add(-time.Duration(*pipelineCommit.DurationSec) * 
time.Second)
diff --git a/backend/plugins/dora/tasks/incident_deploy_connector.go 
b/backend/plugins/dora/tasks/incident_deploy_connector.go
index 25c0dbd48..839b75486 100644
--- a/backend/plugins/dora/tasks/incident_deploy_connector.go
+++ b/backend/plugins/dora/tasks/incident_deploy_connector.go
@@ -18,6 +18,9 @@ limitations under the License.
 package tasks
 
 import (
+       "reflect"
+       "time"
+
        "github.com/apache/incubator-devlake/core/dal"
        "github.com/apache/incubator-devlake/core/errors"
        "github.com/apache/incubator-devlake/core/models/domainlayer"
@@ -26,7 +29,6 @@ import (
        "github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
        "github.com/apache/incubator-devlake/core/plugin"
        "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
-       "reflect"
 )
 
 var ConnectIncidentToDeploymentMeta = plugin.SubTaskMeta{
@@ -37,6 +39,11 @@ var ConnectIncidentToDeploymentMeta = plugin.SubTaskMeta{
        DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
 }
 
+type simpleCicdDeploymentCommit struct {
+       Id           string
+       FinishedDate *time.Time
+}
+
 func ConnectIncidentToDeployment(taskCtx plugin.SubTaskContext) errors.Error {
        db := taskCtx.GetDal()
        data := taskCtx.GetData().(*DoraTaskData)
@@ -74,22 +81,26 @@ func ConnectIncidentToDeployment(taskCtx 
plugin.SubTaskContext) errors.Error {
                                },
                                ProjectName: data.Options.ProjectName,
                        }
-                       cicdTask := &devops.CICDTask{}
-                       cicdTakClauses := []dal.Clause{
-                               dal.From(cicdTask),
-                               dal.Join("left join project_mapping pm on 
cicd_tasks.cicd_scope_id = pm.row_id"),
+
+                       cicdDeploymentCommit := &devops.CicdDeploymentCommit{}
+                       cicdDeploymentCommitClauses := []dal.Clause{
+                               
dal.Select("cicd_deployment_commits.cicd_deployment_id as id, 
cicd_deployment_commits.finished_date as finished_date"),
+                               dal.From(cicdDeploymentCommit),
+                               dal.Join("left join project_mapping pm on 
cicd_deployment_commits.cicd_scope_id = pm.row_id"),
                                dal.Where(
-                                       `cicd_tasks.finished_date < ? 
-                                                               and 
cicd_tasks.result = ? 
-                                                               and 
cicd_tasks.environment = ?
-                                                               and 
cicd_tasks.type = ?
-                                                               and pm.table = ?
-                                                               and 
pm.project_name = ?`,
-                                       issue.CreatedDate, devops.SUCCESS, 
devops.PRODUCTION, devops.DEPLOYMENT, "cicd_scopes", data.Options.ProjectName,
+                                       `cicd_deployment_commits.finished_date 
< ?
+                                           and cicd_deployment_commits.result 
= ?
+                                               and 
cicd_deployment_commits.environment = ?
+                                               and pm.table = ?
+                                               and pm.project_name = ?`,
+                                       issue.CreatedDate, devops.SUCCESS, 
devops.PRODUCTION, "cicd_scopes", data.Options.ProjectName,
                                ),
-                               dal.Orderby("cicd_tasks.finished_date DESC"),
+                               dal.Orderby("finished_date DESC"),
+                               dal.Limit(1),
                        }
-                       err = db.First(cicdTask, cicdTakClauses...)
+
+                       scdc := &simpleCicdDeploymentCommit{}
+                       err = db.All(scdc, cicdDeploymentCommitClauses...)
                        if err != nil {
                                if db.IsErrorNotFound(err) {
                                        return nil, nil
@@ -97,9 +108,11 @@ func ConnectIncidentToDeployment(taskCtx 
plugin.SubTaskContext) errors.Error {
                                        return nil, err
                                }
                        }
-                       projectIssueMetric.DeploymentId = cicdTask.Id
-
-                       return []interface{}{projectIssueMetric}, nil
+                       if scdc.Id != "" {
+                               projectIssueMetric.DeploymentId = scdc.Id
+                               return []interface{}{projectIssueMetric}, nil
+                       }
+                       return nil, nil
                },
        })
        if err != nil {
diff --git a/backend/plugins/dora/tasks/incident_deploy_connector_old.go 
b/backend/plugins/dora/tasks/incident_deploy_connector_old.go
deleted file mode 100644
index c55da5d22..000000000
--- a/backend/plugins/dora/tasks/incident_deploy_connector_old.go
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
-Licensed to the Apache Software Foundation (ASF) under one or more
-contributor license agreements.  See the NOTICE file distributed with
-this work for additional information regarding copyright ownership.
-The ASF licenses this file to You under the Apache License, Version 2.0
-(the "License"); you may not use this file except in compliance with
-the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package tasks
-
-import (
-       "github.com/apache/incubator-devlake/core/dal"
-       "github.com/apache/incubator-devlake/core/errors"
-       "github.com/apache/incubator-devlake/core/models/domainlayer"
-       
"github.com/apache/incubator-devlake/core/models/domainlayer/crossdomain"
-       "github.com/apache/incubator-devlake/core/models/domainlayer/devops"
-       "github.com/apache/incubator-devlake/core/models/domainlayer/ticket"
-       "github.com/apache/incubator-devlake/core/plugin"
-       "github.com/apache/incubator-devlake/helpers/pluginhelper/api"
-       "reflect"
-)
-
-// ConnectIncidentToDeploymentOldMeta will be removed in v0.17
-// DEPRECATED
-var ConnectIncidentToDeploymentOldMeta = plugin.SubTaskMeta{
-       Name:             "connectIncidentToDeploymentOld",
-       EntryPoint:       ConnectIncidentToDeploymentOld,
-       EnabledByDefault: false,
-       Description:      "Connect incident issue to deployment",
-       DomainTypes:      []string{plugin.DOMAIN_TYPE_CICD},
-}
-
-// ConnectIncidentToDeploymentOld will be removed in v0.17
-// DEPRECATED
-func ConnectIncidentToDeploymentOld(taskCtx plugin.SubTaskContext) 
errors.Error {
-       db := taskCtx.GetDal()
-       issue := &ticket.Issue{}
-       // select all issues belongs to the board
-       clauses := []dal.Clause{
-               dal.From(issue),
-               dal.Where(
-                       "issues.type = ?", "INCIDENT",
-               ),
-       }
-       cursor, err := db.Cursor(clauses...)
-       if err != nil {
-               return err
-       }
-       defer cursor.Close()
-
-       enricher, err := api.NewDataConverter(api.DataConverterArgs{
-               RawDataSubTaskArgs: api.RawDataSubTaskArgs{
-                       Ctx:    taskCtx,
-                       Params: DoraApiParams{
-                               // TODO
-                       },
-                       Table: "issues",
-               },
-               InputRowType: reflect.TypeOf(ticket.Issue{}),
-               Input:        cursor,
-               Convert: func(inputRow interface{}) ([]interface{}, 
errors.Error) {
-                       issueToBeUpdate := inputRow.(*ticket.Issue)
-                       cicdTask := &devops.CICDTask{}
-                       cicdTakClauses := []dal.Clause{
-                               dal.From(cicdTask),
-                               dal.Join("left join cicd_pipeline_commits on 
cicd_tasks.pipeline_id = cicd_pipeline_commits.pipeline_id"),
-                               dal.Where(
-                                       `cicd_tasks.finished_date < ? 
-                                                               and 
cicd_tasks.result = ? and cicd_tasks.environment = ?`,
-                                       issueToBeUpdate.CreatedDate, "SUCCESS", 
devops.PRODUCTION,
-                               ),
-                               dal.Orderby("cicd_tasks.finished_date DESC"),
-                       }
-                       err = db.First(cicdTask, cicdTakClauses...)
-                       if err != nil {
-                               if db.IsErrorNotFound(err) {
-                                       return nil, nil
-                               } else {
-                                       return nil, err
-                               }
-                       }
-                       projectIssueMetric := &crossdomain.ProjectIssueMetric{
-                               DomainEntity: domainlayer.DomainEntity{
-                                       Id: issue.Id,
-                               },
-                               ProjectName: "DEFAULT_PROJECT_NAME",
-                       }
-                       projectIssueMetric.DeploymentId = cicdTask.Id
-
-                       return []interface{}{projectIssueMetric}, nil
-               },
-       })
-       if err != nil {
-               return err
-       }
-
-       return enricher.Execute()
-}
diff --git a/backend/plugins/dora/tasks/prev_deployment_commit_enricher.go 
b/backend/plugins/dora/tasks/prev_deployment_commit_enricher.go
index c393a61f5..cfeec0902 100644
--- a/backend/plugins/dora/tasks/prev_deployment_commit_enricher.go
+++ b/backend/plugins/dora/tasks/prev_deployment_commit_enricher.go
@@ -46,21 +46,21 @@ func EnrichPrevSuccessDeploymentCommit(taskCtx 
plugin.SubTaskContext) errors.Err
        db := taskCtx.GetDal()
        data := taskCtx.GetData().(*DoraTaskData)
        // step 1. select all successful deployments in the project and sort 
them by cicd_scope_id, repo_url, env
-       // and started_date
+       // and finished_date
        cursor, err := db.Cursor(
                dal.Select("dc.*"),
                dal.From("cicd_deployment_commits dc"),
                dal.Join("LEFT JOIN project_mapping pm ON (pm.table = 
'cicd_scopes' AND pm.row_id = dc.cicd_scope_id)"),
                dal.Where(
                        `
-                       dc.started_date IS NOT NULL
+                       dc.finished_date IS NOT NULL
                        AND dc.environment IS NOT NULL AND dc.environment != ''
                        AND dc.repo_url IS NOT NULL AND dc.repo_url != '' 
                        AND pm.project_name = ? AND dc.result = ?
                        `,
                        data.Options.ProjectName, devops.SUCCESS,
                ),
-               dal.Orderby(`dc.cicd_scope_id, dc.repo_url, dc.environment, 
dc.started_date`),
+               dal.Orderby(`dc.cicd_scope_id, dc.repo_url, dc.environment, 
dc.finished_date`),
        )
        if err != nil {
                return err
diff --git a/backend/plugins/github/e2e/snapshot_tables/cicd_pipelines.csv 
b/backend/plugins/github/e2e/snapshot_tables/cicd_pipelines.csv
index b310eec86..74b1cb571 100644
--- a/backend/plugins/github/e2e/snapshot_tables/cicd_pipelines.csv
+++ b/backend/plugins/github/e2e/snapshot_tables/cicd_pipelines.csv
@@ -1,21 +1,21 @@
 
id,name,result,status,type,duration_sec,environment,created_date,finished_date,cicd_scope_id
-github:GithubRun:1:134018330:2559400712,CodeQL,SUCCESS,DONE,,116353,,2022-06-25T04:17:45.000+00:00,2022-06-26T12:36:58.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2559400712,CodeQL,SUCCESS,DONE,DEPLOYMENT,116353,PRODUCTION,2022-06-25T04:17:45.000+00:00,2022-06-26T12:36:58.000+00:00,github:GithubRepo:1:134018330
 
github:GithubRun:1:134018330:2559400713,Lint,SUCCESS,DONE,,116317,,2022-06-25T04:17:45.000+00:00,2022-06-26T12:36:22.000+00:00,github:GithubRepo:1:134018330
 
github:GithubRun:1:134018330:2559400714,Tests,SUCCESS,DONE,,116619,,2022-06-25T04:17:45.000+00:00,2022-06-26T12:41:24.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2559507315,CodeQL,,IN_PROGRESS,,0,,2022-06-25T05:02:56.000+00:00,2022-06-25T05:03:53.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2559507315,CodeQL,,IN_PROGRESS,DEPLOYMENT,0,PRODUCTION,2022-06-25T05:02:56.000+00:00,2022-06-25T05:03:53.000+00:00,github:GithubRepo:1:134018330
 
github:GithubRun:1:134018330:2566218975,Tests,,IN_PROGRESS,,0,,2022-06-27T01:29:54.000+00:00,2022-06-27T01:37:33.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2566218976,CodeQL,SUCCESS,DONE,,61,,2022-06-27T01:29:54.000+00:00,2022-06-27T01:30:55.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2566218976,CodeQL,SUCCESS,DONE,DEPLOYMENT,61,PRODUCTION,2022-06-27T01:29:54.000+00:00,2022-06-27T01:30:55.000+00:00,github:GithubRepo:1:134018330
 
github:GithubRun:1:134018330:2566218977,Lint,FAILURE,DONE,,34,,2022-06-27T01:29:54.000+00:00,2022-06-27T01:30:28.000+00:00,github:GithubRepo:1:134018330
 
github:GithubRun:1:134018330:2589885628,Tests,SUCCESS,DONE,,91030,,2022-06-30T12:23:37.000+00:00,2022-07-01T13:40:47.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2589885635,CodeQL,FAILURE,DONE,,90702,,2022-06-30T12:23:37.000+00:00,2022-07-01T13:35:19.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2589885635,CodeQL,FAILURE,DONE,DEPLOYMENT,90702,PRODUCTION,2022-06-30T12:23:37.000+00:00,2022-07-01T13:35:19.000+00:00,github:GithubRepo:1:134018330
 
github:GithubRun:1:134018330:2589885639,Lint,SUCCESS,DONE,,90666,,2022-06-30T12:23:37.000+00:00,2022-07-01T13:34:43.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2600408985,CodeQL,SUCCESS,DONE,,57,,2022-07-02T05:05:26.000+00:00,2022-07-02T05:06:23.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2639945362,CodeQL,SUCCESS,DONE,,64,,2022-07-09T05:02:44.000+00:00,2022-07-09T05:03:48.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2680721264,CodeQL,SUCCESS,DONE,,73,,2022-07-16T05:03:38.000+00:00,2022-07-16T05:04:51.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2722539966,CodeQL,SUCCESS,DONE,,59,,2022-07-23T05:04:59.000+00:00,2022-07-23T05:05:58.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2764660507,CodeQL,SUCCESS,DONE,,58,,2022-07-30T05:06:06.000+00:00,2022-07-30T05:07:04.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2807709308,CodeQL,SUCCESS,DONE,,75,,2022-08-06T05:02:43.000+00:00,2022-08-06T05:03:58.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2850801364,CodeQL,SUCCESS,DONE,,54,,2022-08-13T05:02:51.000+00:00,2022-08-13T05:03:45.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2893573709,CodeQL,SUCCESS,DONE,,77,,2022-08-20T05:04:53.000+00:00,2022-08-20T05:06:10.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2938072864,CodeQL,SUCCESS,DONE,,76,,2022-08-27T05:13:50.000+00:00,2022-08-27T05:15:06.000+00:00,github:GithubRepo:1:134018330
-github:GithubRun:1:134018330:2983238245,CodeQL,SUCCESS,DONE,,67,,2022-09-03T05:15:09.000+00:00,2022-09-03T05:16:16.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2600408985,CodeQL,SUCCESS,DONE,DEPLOYMENT,57,PRODUCTION,2022-07-02T05:05:26.000+00:00,2022-07-02T05:06:23.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2639945362,CodeQL,SUCCESS,DONE,DEPLOYMENT,64,PRODUCTION,2022-07-09T05:02:44.000+00:00,2022-07-09T05:03:48.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2680721264,CodeQL,SUCCESS,DONE,DEPLOYMENT,73,PRODUCTION,2022-07-16T05:03:38.000+00:00,2022-07-16T05:04:51.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2722539966,CodeQL,SUCCESS,DONE,DEPLOYMENT,59,PRODUCTION,2022-07-23T05:04:59.000+00:00,2022-07-23T05:05:58.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2764660507,CodeQL,SUCCESS,DONE,DEPLOYMENT,58,PRODUCTION,2022-07-30T05:06:06.000+00:00,2022-07-30T05:07:04.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2807709308,CodeQL,SUCCESS,DONE,DEPLOYMENT,75,PRODUCTION,2022-08-06T05:02:43.000+00:00,2022-08-06T05:03:58.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2850801364,CodeQL,SUCCESS,DONE,DEPLOYMENT,54,PRODUCTION,2022-08-13T05:02:51.000+00:00,2022-08-13T05:03:45.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2893573709,CodeQL,SUCCESS,DONE,DEPLOYMENT,77,PRODUCTION,2022-08-20T05:04:53.000+00:00,2022-08-20T05:06:10.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2938072864,CodeQL,SUCCESS,DONE,DEPLOYMENT,76,PRODUCTION,2022-08-27T05:13:50.000+00:00,2022-08-27T05:15:06.000+00:00,github:GithubRepo:1:134018330
+github:GithubRun:1:134018330:2983238245,CodeQL,SUCCESS,DONE,DEPLOYMENT,67,PRODUCTION,2022-09-03T05:15:09.000+00:00,2022-09-03T05:16:16.000+00:00,github:GithubRepo:1:134018330
diff --git 
a/backend/plugins/refdiff/e2e/deployment_commit_diff/cicd_deployment_commits.csv
 
b/backend/plugins/refdiff/e2e/deployment_commit_diff/cicd_deployment_commits.csv
index 41bce1e6d..1e9b3390a 100644
--- 
a/backend/plugins/refdiff/e2e/deployment_commit_diff/cicd_deployment_commits.csv
+++ 
b/backend/plugins/refdiff/e2e/deployment_commit_diff/cicd_deployment_commits.csv
@@ -1,4 +1,4 @@
-id,result,started_date,cicd_pipeline_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,commit_sha,created_date
+id,result,started_date,cicd_deployment_id,cicd_scope_id,repo_url,environment,prev_success_deployment_commit_id,commit_sha,created_date
 
1,SUCCESS,2023-04-10T06:51:47.000+00:00,pipeline1,github:GithubRepo:1:484251804,REPO111,PRODUCTION,,commit_sha1,2023-4-10
 6:51:47
 
2,SUCCESS,2023-04-10T06:53:51.000+00:00,pipeline2,github:GithubRepo:1:484251804,REPO111,PRODUCTION,1,commit_sha2,2023-4-10
 6:53:51
 
3,SUCCESS,2023-04-13T07:21:16.000+00:00,pipeline3,github:GithubRepo:1:484251804,REPO111,PRODUCTION,2,commit_sha4,2023-4-13
 7:21:16
diff --git a/backend/plugins/webhook/api/deployments.go 
b/backend/plugins/webhook/api/deployments.go
index 4b8069201..16aabcf9b 100644
--- a/backend/plugins/webhook/api/deployments.go
+++ b/backend/plugins/webhook/api/deployments.go
@@ -109,20 +109,20 @@ func PostDeploymentCicdTask(input 
*plugin.ApiResourceInput) (*plugin.ApiResource
                DomainEntity: domainlayer.DomainEntity{
                        Id: deploymentCommitId,
                },
-               CicdPipelineId: pipelineId,
-               CicdScopeId:    scopeId,
-               Name:           fmt.Sprintf(`deployment for %s`, 
request.CommitSha),
-               Result:         request.Result,
-               Status:         devops.DONE,
-               Environment:    request.Environment,
-               CreatedDate:    *request.CreatedDate,
-               StartedDate:    request.StartedDate,
-               FinishedDate:   request.FinishedDate,
-               DurationSec:    &duration,
-               CommitSha:      request.CommitSha,
-               RefName:        request.RefName,
-               RepoId:         request.RepoId,
-               RepoUrl:        request.RepoUrl,
+               CicdDeploymentId: pipelineId,
+               CicdScopeId:      scopeId,
+               Name:             fmt.Sprintf(`deployment for %s`, 
request.CommitSha),
+               Result:           request.Result,
+               Status:           devops.DONE,
+               Environment:      request.Environment,
+               CreatedDate:      *request.CreatedDate,
+               StartedDate:      request.StartedDate,
+               FinishedDate:     request.FinishedDate,
+               DurationSec:      &duration,
+               CommitSha:        request.CommitSha,
+               RefName:          request.RefName,
+               RepoId:           request.RepoId,
+               RepoUrl:          request.RepoUrl,
        }
        err = db.CreateOrUpdate(deploymentCommit)
        if err != nil {


Reply via email to