fix: empty monthly deployments panel (#4628) (#4629)

* fix: empty monthly deployments panel

* fix: fix e2e test

* fix: fix e2e test
diff --git a/backend/plugins/bitbucket/e2e/pipeline_steps_test.go b/backend/plugins/bitbucket/e2e/pipeline_steps_test.go
new file mode 100644
index 0000000..54e31d2
--- /dev/null
+++ b/backend/plugins/bitbucket/e2e/pipeline_steps_test.go
@@ -0,0 +1,68 @@
+/*
+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 e2e
+
+import (
+	"testing"
+
+	"github.com/apache/incubator-devlake/core/models/domainlayer/devops"
+	"github.com/apache/incubator-devlake/helpers/e2ehelper"
+	"github.com/apache/incubator-devlake/plugins/bitbucket/impl"
+	"github.com/apache/incubator-devlake/plugins/bitbucket/models"
+	"github.com/apache/incubator-devlake/plugins/bitbucket/tasks"
+)
+
+func TestBitbucketPipelineStepsDataFlow(t *testing.T) {
+
+	var bitbucket impl.Bitbucket
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "bitbucket", bitbucket)
+
+	taskData := &tasks.BitbucketTaskData{
+		Options: &tasks.BitbucketOptions{
+			ConnectionId: 4,
+			FullName:     "thenicetgp/lake",
+			BitbucketTransformationRule: &models.BitbucketTransformationRule{
+				DeploymentPattern: "",
+				ProductionPattern: "",
+			},
+		},
+	}
+
+	dataflowTester.ImportCsvIntoTabler("./snapshot_tables/_tool_bitbucket_pipeline_steps.csv", &models.BitbucketPipelineStep{})
+	dataflowTester.ImportCsvIntoTabler("./snapshot_tables/_tool_bitbucket_deployments.csv", &models.BitbucketDeployment{})
+	dataflowTester.FlushTabler(&devops.CICDTask{})
+	// verify extraction
+	dataflowTester.Subtask(tasks.ConvertPipelineStepMeta, taskData)
+	dataflowTester.VerifyTable(
+		devops.CICDTask{},
+		"./snapshot_tables/cicd_tasks.csv",
+		e2ehelper.ColumnWithRawData(
+			"id",
+			"name",
+			"pipeline_id",
+			"result",
+			"status",
+			"type",
+			"duration_sec",
+			"started_date",
+			"finished_date",
+			"environment",
+			"cicd_scope_id",
+		),
+	)
+}
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_deployments.csv b/backend/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_deployments.csv
new file mode 100644
index 0000000..137f5f5
--- /dev/null
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_deployments.csv
@@ -0,0 +1,7 @@
+"connection_id","bitbucket_id","pipeline_id","type","name","key","web_url","status","state_url","commit_sha","commit_url","created_on","started_on","completed_on","last_update_time","created_at","updated_at","_raw_data_params","_raw_data_table","_raw_data_id","_raw_data_remark","step_id","environment","environment_type"
+4,"{0fe36b16-ed34-5e5c-b64b-5dfe257209cc}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","deployment","#2","pipelines-{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/2","UNDEPLOYED","","5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","https://bitbucket.org/thenicetgp/lake/commits/5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","2022-09-15 02:58:11.940",,,,"2023-03-02 12:00:23.936","2023-03-02 12:00:23.936","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_api_deployments",28,"","{946d2cdd-15a7-4d32-aa0f-b340dfc96acf}","Production","Production"
+4,"{665e69fe-c7f9-5b08-94ca-876af918ec17}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","deployment","#1","pipelines-{6b0d8d23-45ba-455b-8493-94e312c1d59a}","https://bitbucket.org/zhangliangatbitbucket/testbitbucket/addon/pipelines/home#!/results/1","UNDEPLOYED","","a87150920dc3f12ceb61f4f33147a0d7c6d4e85d","https://bitbucket.org/zhangliangatbitbucket/testbitbucket/commits/a87150920dc3f12ceb61f4f33147a0d7c6d4e85d","2022-09-15 15:15:53.138",,,,"2023-03-02 12:10:54.052","2023-03-02 12:10:54.052","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_api_deployments",29,"","{847845b3-57c4-4178-9e85-8c54be7e9574}","Production","Production"
+4,"{6b74e741-95f9-5e6f-ad09-c1fba4c5bed3}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","deployment","#3","pipelines-{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/3","COMPLETED","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/3/steps/%7B73cd6ba6-8fd5-402d-b59b-19e2a8cdf4ba%7D","5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","https://bitbucket.org/thenicetgp/lake/commits/5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","2022-09-21 15:22:00.319","2022-09-21 15:22:10.727","2022-09-21 15:22:15.058","2022-09-21 15:22:15.058","2023-03-02 12:00:23.936","2023-03-02 12:00:23.936","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_api_deployments",26,"","{73cd6ba6-8fd5-402d-b59b-19e2a8cdf4ba}","Staging","Staging"
+4,"{84b6c3fd-a40c-53bb-bcd0-8fae4a750bef}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","deployment","#1","pipelines-{6b0d8d23-45ba-455b-8493-94e312c1d59a}","https://bitbucket.org/zhangliangatbitbucket/testbitbucket/addon/pipelines/home#!/results/1","COMPLETED","https://bitbucket.org/zhangliangatbitbucket/testbitbucket/addon/pipelines/home#!/results/1/steps/%7Bfe273df0-367c-4253-8e14-1397ce9d7590%7D","a87150920dc3f12ceb61f4f33147a0d7c6d4e85d","https://bitbucket.org/zhangliangatbitbucket/testbitbucket/commits/a87150920dc3f12ceb61f4f33147a0d7c6d4e85d","2022-09-15 15:15:53.138","2022-09-15 15:16:03.495","2022-09-15 15:16:11.144","2022-09-15 15:16:11.144","2023-03-02 12:10:54.052","2023-03-02 12:10:54.052","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_api_deployments",30,"","{fe273df0-367c-4253-8e14-1397ce9d7590}","Staging","Staging"
+4,"{f323b037-738a-55f7-b941-fbed98322eae}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","deployment","#3","pipelines-{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/3","COMPLETED","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/3/steps/%7B81cf7e4f-5552-40a7-8bfb-8df0a7a8a847%7D","5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","https://bitbucket.org/thenicetgp/lake/commits/5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","2022-09-21 15:22:00.319","2022-10-13 13:19:54.327","2022-10-13 13:20:00.767","2022-10-13 13:20:00.767","2023-03-02 12:00:23.936","2023-03-02 12:00:23.936","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_api_deployments",27,"","{81cf7e4f-5552-40a7-8bfb-8df0a7a8a847}","Production","Production"
+4,"{fc2df2df-48e4-5c31-8bc8-524905e2a0c9}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","deployment","#2","pipelines-{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/2","COMPLETED","https://bitbucket.org/thenicetgp/lake/addon/pipelines/home#!/results/2/steps/%7B26c27b60-d5f6-478b-8474-b9be3dd007ba%7D","5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","https://bitbucket.org/thenicetgp/lake/commits/5973a4f256da0e7f71bc7599ba78aa0f19f6c6bb","2022-09-15 02:58:11.940","2022-09-15 02:58:23.162","2022-09-15 02:58:27.472","2022-09-15 02:58:27.472","2023-03-02 12:00:23.936","2023-03-02 12:00:23.936","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_api_deployments",25,"","{26c27b60-d5f6-478b-8474-b9be3dd007ba}","Staging","Staging"
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_pipeline_steps.csv b/backend/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_pipeline_steps.csv
new file mode 100644
index 0000000..55292db
--- /dev/null
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/_tool_bitbucket_pipeline_steps.csv
@@ -0,0 +1,22 @@
+"connection_id","bitbucket_id","pipeline_id","name","trigger","state","result","max_time","started_on","completed_on","duration_in_seconds","build_seconds_used","run_number","created_at","updated_at","_raw_data_params","_raw_data_table","_raw_data_id","_raw_data_remark"
+4,"{26c27b60-d5f6-478b-8474-b9be3dd007ba}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","Deployment to Staging","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 02:58:23.162","2022-09-15 02:58:27.472",4,4,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",31,""
+4,"{4c88e872-9649-4222-8ed4-0c61cfad88cc}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","Security scan","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-21 15:21:54.275","2022-09-21 15:22:00.096",6,5,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",35,""
+4,"{5c8c981c-8f8a-4100-acbd-fb4dc0d5d0b1}","{9908cebb-8d1e-4dc2-8b99-a1f6eaa6babf}","Deploy to Production","pipeline_step_trigger_manual","COMPLETED","NOT_RUN",120,"2022-10-13 13:30:28.260","2022-10-13 13:30:28.260",0,0,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",27,""
+4,"{5d306604-ee29-4e79-8a46-b1b98bcd4a69}","{9908cebb-8d1e-4dc2-8b99-a1f6eaa6babf}","Build","pipeline_step_trigger_automatic","COMPLETED","FAILED",120,"2022-10-13 13:30:14.800","2022-10-13 13:30:28.125",13,13,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",26,""
+4,"{60d40b13-7e2e-4f81-8e05-c10eb81e7bda}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","Lint","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 02:58:04.994","2022-09-15 02:58:11.308",6,6,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",29,""
+4,"{64890739-473e-46c1-b367-7f8033418cbc}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","Security scan","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 02:58:05.037","2022-09-15 02:58:11.441",6,6,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",30,""
+4,"{68e37d4b-05c3-4314-90df-e8f8a0612b24}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","Build and Test","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-21 15:21:54.843","2022-09-21 15:21:59.964",5,5,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",33,""
+4,"{73cd6ba6-8fd5-402d-b59b-19e2a8cdf4ba}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","Deployment to Staging","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-21 15:22:10.727","2022-09-21 15:22:15.058",4,4,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",36,""
+4,"{81cf7e4f-5552-40a7-8bfb-8df0a7a8a847}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","Deployment to Production","pipeline_step_trigger_manual","COMPLETED","SUCCESSFUL",120,"2022-10-13 13:19:54.327","2022-10-13 13:20:00.767",6,6,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",37,""
+4,"{847845b3-57c4-4178-9e85-8c54be7e9574}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","Deployment to Production","pipeline_step_trigger_manual","PENDING","",120,,,0,0,1,"2023-03-02 12:10:54.088","2023-03-02 12:10:54.088","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_pipeline_steps",42,""
+4,"{9389dbc7-f78b-4db1-b62b-a42872001b6f}","{8d537af9-614d-4461-b4e2-d862b9a6078f}","Test and Build","pipeline_step_trigger_automatic","COMPLETED","FAILED",120,"2022-09-13 10:12:41.545","2022-09-13 10:12:53.816",12,12,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",24,""
+4,"{946d2cdd-15a7-4d32-aa0f-b340dfc96acf}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","Deployment to Production","pipeline_step_trigger_manual","PENDING","",120,,,0,0,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",32,""
+4,"{9dafb58a-79b9-4e4a-a810-87afba8b3a39}","{3b1220c3-6b20-4423-bc28-96a0f1580a7d}","Security Scan","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-10-13 13:30:23.022","2022-10-13 13:30:55.503",32,32,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",23,""
+4,"{a0eb0d4b-afbb-4a63-919c-0f927e381082}","{3b1220c3-6b20-4423-bc28-96a0f1580a7d}","Build and Test","pipeline_step_trigger_automatic","COMPLETED","FAILED",120,"2022-10-13 13:30:23.181","2022-10-13 13:30:51.235",28,28,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",22,""
+4,"{b10a6fbe-375e-4198-9aa1-db632708d8e5}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","Security scan","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 15:15:47.747","2022-09-15 15:15:52.967",5,5,1,"2023-03-02 12:10:54.088","2023-03-02 12:10:54.088","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_pipeline_steps",40,""
+4,"{b1ddcafa-51c3-4534-a0ef-911a607b67a6}","{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1}","Build and Test","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 02:58:04.295","2022-09-15 02:58:11.214",7,6,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",28,""
+4,"{daab933d-035e-424c-ac5d-67b630a03c1c}","{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca}","Lint","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-21 15:21:54.514","2022-09-21 15:21:59.934",5,5,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",34,""
+4,"{e7180d35-c97f-43d9-a97d-72121e971654}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","Lint","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 15:15:47.434","2022-09-15 15:15:51.941",5,4,1,"2023-03-02 12:10:54.088","2023-03-02 12:10:54.088","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_pipeline_steps",39,""
+4,"{ea9bc920-77ef-4cb1-b250-e3d5f8497291}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","Build and Test","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 15:15:48.451","2022-09-15 15:15:52.946",4,4,1,"2023-03-02 12:10:54.088","2023-03-02 12:10:54.088","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_pipeline_steps",38,""
+4,"{f3f57dfa-3de3-49d6-8872-d845236b3f0f}","{8d537af9-614d-4461-b4e2-d862b9a6078f}","Lint code","pipeline_step_trigger_automatic","COMPLETED","FAILED",120,"2022-09-13 10:12:41.561","2022-09-13 10:12:51.812",10,10,1,"2023-03-02 12:00:23.987","2023-03-02 12:00:23.987","{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}","_raw_bitbucket_pipeline_steps",25,""
+4,"{fe273df0-367c-4253-8e14-1397ce9d7590}","{6b0d8d23-45ba-455b-8493-94e312c1d59a}","Deployment to Staging","pipeline_step_trigger_automatic","COMPLETED","SUCCESSFUL",120,"2022-09-15 15:16:03.495","2022-09-15 15:16:11.144",8,7,1,"2023-03-02 12:10:54.088","2023-03-02 12:10:54.088","{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}","_raw_bitbucket_pipeline_steps",41,""
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv
new file mode 100644
index 0000000..570fdbe
--- /dev/null
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv
@@ -0,0 +1,20 @@
+id,name,pipeline_id,result,status,type,duration_sec,started_date,finished_date,environment,cicd_scope_id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
+bitbucket:BitbucketPipelineStep:4:{26c27b60-d5f6-478b-8474-b9be3dd007ba},Deployment to Staging,bitbucket:BitbucketPipeline:4:{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1},SUCCESS,DONE,DEPLOYMENT,4,2022-09-15T02:58:23.162+00:00,2022-09-15T02:58:27.472+00:00,STAGING,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,31,
+bitbucket:BitbucketPipelineStep:4:{4c88e872-9649-4222-8ed4-0c61cfad88cc},Security scan,bitbucket:BitbucketPipeline:4:{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca},SUCCESS,DONE,,6,2022-09-21T15:21:54.275+00:00,2022-09-21T15:22:00.096+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,35,
+bitbucket:BitbucketPipelineStep:4:{5c8c981c-8f8a-4100-acbd-fb4dc0d5d0b1},Deploy to Production,bitbucket:BitbucketPipeline:4:{9908cebb-8d1e-4dc2-8b99-a1f6eaa6babf},SUCCESS,DONE,,0,2022-10-13T13:30:28.260+00:00,2022-10-13T13:30:28.260+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,27,
+bitbucket:BitbucketPipelineStep:4:{5d306604-ee29-4e79-8a46-b1b98bcd4a69},Build,bitbucket:BitbucketPipeline:4:{9908cebb-8d1e-4dc2-8b99-a1f6eaa6babf},FAILURE,DONE,,13,2022-10-13T13:30:14.800+00:00,2022-10-13T13:30:28.125+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,26,
+bitbucket:BitbucketPipelineStep:4:{60d40b13-7e2e-4f81-8e05-c10eb81e7bda},Lint,bitbucket:BitbucketPipeline:4:{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1},SUCCESS,DONE,,6,2022-09-15T02:58:04.994+00:00,2022-09-15T02:58:11.308+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,29,
+bitbucket:BitbucketPipelineStep:4:{64890739-473e-46c1-b367-7f8033418cbc},Security scan,bitbucket:BitbucketPipeline:4:{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1},SUCCESS,DONE,,6,2022-09-15T02:58:05.037+00:00,2022-09-15T02:58:11.441+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,30,
+bitbucket:BitbucketPipelineStep:4:{68e37d4b-05c3-4314-90df-e8f8a0612b24},Build and Test,bitbucket:BitbucketPipeline:4:{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca},SUCCESS,DONE,,5,2022-09-21T15:21:54.843+00:00,2022-09-21T15:21:59.964+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,33,
+bitbucket:BitbucketPipelineStep:4:{73cd6ba6-8fd5-402d-b59b-19e2a8cdf4ba},Deployment to Staging,bitbucket:BitbucketPipeline:4:{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca},SUCCESS,DONE,DEPLOYMENT,4,2022-09-21T15:22:10.727+00:00,2022-09-21T15:22:15.058+00:00,STAGING,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,36,
+bitbucket:BitbucketPipelineStep:4:{81cf7e4f-5552-40a7-8bfb-8df0a7a8a847},Deployment to Production,bitbucket:BitbucketPipeline:4:{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca},SUCCESS,DONE,DEPLOYMENT,6,2022-10-13T13:19:54.327+00:00,2022-10-13T13:20:00.767+00:00,PRODUCTION,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,37,
+bitbucket:BitbucketPipelineStep:4:{9389dbc7-f78b-4db1-b62b-a42872001b6f},Test and Build,bitbucket:BitbucketPipeline:4:{8d537af9-614d-4461-b4e2-d862b9a6078f},FAILURE,DONE,,12,2022-09-13T10:12:41.545+00:00,2022-09-13T10:12:53.816+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,24,
+bitbucket:BitbucketPipelineStep:4:{9dafb58a-79b9-4e4a-a810-87afba8b3a39},Security Scan,bitbucket:BitbucketPipeline:4:{3b1220c3-6b20-4423-bc28-96a0f1580a7d},SUCCESS,DONE,,32,2022-10-13T13:30:23.022+00:00,2022-10-13T13:30:55.503+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,23,
+bitbucket:BitbucketPipelineStep:4:{a0eb0d4b-afbb-4a63-919c-0f927e381082},Build and Test,bitbucket:BitbucketPipeline:4:{3b1220c3-6b20-4423-bc28-96a0f1580a7d},FAILURE,DONE,,28,2022-10-13T13:30:23.181+00:00,2022-10-13T13:30:51.235+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,22,
+bitbucket:BitbucketPipelineStep:4:{b10a6fbe-375e-4198-9aa1-db632708d8e5},Security scan,bitbucket:BitbucketPipeline:4:{6b0d8d23-45ba-455b-8493-94e312c1d59a},SUCCESS,DONE,,5,2022-09-15T15:15:47.747+00:00,2022-09-15T15:15:52.967+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}",_raw_bitbucket_pipeline_steps,40,
+bitbucket:BitbucketPipelineStep:4:{b1ddcafa-51c3-4534-a0ef-911a607b67a6},Build and Test,bitbucket:BitbucketPipeline:4:{9de12b4b-75fc-4924-ac5a-9e3944b7f1f1},SUCCESS,DONE,,7,2022-09-15T02:58:04.295+00:00,2022-09-15T02:58:11.214+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,28,
+bitbucket:BitbucketPipelineStep:4:{daab933d-035e-424c-ac5d-67b630a03c1c},Lint,bitbucket:BitbucketPipeline:4:{acd97fa8-4ed6-4fdc-8bdb-0e63ecb42cca},SUCCESS,DONE,,5,2022-09-21T15:21:54.514+00:00,2022-09-21T15:21:59.934+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,34,
+bitbucket:BitbucketPipelineStep:4:{e7180d35-c97f-43d9-a97d-72121e971654},Lint,bitbucket:BitbucketPipeline:4:{6b0d8d23-45ba-455b-8493-94e312c1d59a},SUCCESS,DONE,,5,2022-09-15T15:15:47.434+00:00,2022-09-15T15:15:51.941+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}",_raw_bitbucket_pipeline_steps,39,
+bitbucket:BitbucketPipelineStep:4:{ea9bc920-77ef-4cb1-b250-e3d5f8497291},Build and Test,bitbucket:BitbucketPipeline:4:{6b0d8d23-45ba-455b-8493-94e312c1d59a},SUCCESS,DONE,,4,2022-09-15T15:15:48.451+00:00,2022-09-15T15:15:52.946+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}",_raw_bitbucket_pipeline_steps,38,
+bitbucket:BitbucketPipelineStep:4:{f3f57dfa-3de3-49d6-8872-d845236b3f0f},Lint code,bitbucket:BitbucketPipeline:4:{8d537af9-614d-4461-b4e2-d862b9a6078f},FAILURE,DONE,,10,2022-09-13T10:12:41.561+00:00,2022-09-13T10:12:51.812+00:00,,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""thenicetgp/lake""}",_raw_bitbucket_pipeline_steps,25,
+bitbucket:BitbucketPipelineStep:4:{fe273df0-367c-4253-8e14-1397ce9d7590},Deployment to Staging,bitbucket:BitbucketPipeline:4:{6b0d8d23-45ba-455b-8493-94e312c1d59a},SUCCESS,DONE,DEPLOYMENT,8,2022-09-15T15:16:03.495+00:00,2022-09-15T15:16:11.144+00:00,STAGING,bitbucket:BitbucketRepo:4:thenicetgp/lake,"{""ConnectionId"":4,""FullName"":""zhangliangatbitbucket/testbitbucket""}",_raw_bitbucket_pipeline_steps,41,
diff --git a/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go b/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
index ec69b39..d00ec0b 100644
--- a/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
+++ b/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
@@ -18,15 +18,16 @@
 package tasks
 
 import (
+	"reflect"
+
 	"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/devops"
 	"github.com/apache/incubator-devlake/core/models/domainlayer/didgen"
-	plugin "github.com/apache/incubator-devlake/core/plugin"
+	"github.com/apache/incubator-devlake/core/plugin"
 	"github.com/apache/incubator-devlake/helpers/pluginhelper/api"
 	"github.com/apache/incubator-devlake/plugins/bitbucket/models"
-	"reflect"
 )
 
 var ConvertPipelineStepMeta = plugin.SubTaskMeta{
@@ -57,6 +58,7 @@
 
 	pipelineStepIdGen := didgen.NewDomainIdGenerator(&models.BitbucketPipelineStep{})
 	pipelineIdGen := didgen.NewDomainIdGenerator(&models.BitbucketPipeline{})
+	repoIdGen := didgen.NewDomainIdGenerator(&models.BitbucketRepo{})
 
 	converter, err := api.NewDataConverter(api.DataConverterArgs{
 		InputRowType:       reflect.TypeOf(models.BitbucketPipelineStep{}),
@@ -82,6 +84,7 @@
 					InProgress: []string{models.IN_PROGRESS, models.PENDING, models.BUILDING},
 					Default:    devops.DONE,
 				}, bitbucketPipelineStep.State),
+				CicdScopeId: repoIdGen.Generate(data.Options.ConnectionId, data.Options.FullName),
 			}
 			// not save to domain layer if StartedOn is empty
 			if bitbucketPipelineStep.StartedOn == nil {