Skip to content

Commit 1482c9f

Browse files
fix: empty monthly deployments panel (#4628) (#4629)
* fix: empty monthly deployments panel * fix: fix e2e test * fix: fix e2e test
1 parent 64349f0 commit 1482c9f

5 files changed

Lines changed: 122 additions & 2 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*
2+
Licensed to the Apache Software Foundation (ASF) under one or more
3+
contributor license agreements. See the NOTICE file distributed with
4+
this work for additional information regarding copyright ownership.
5+
The ASF licenses this file to You under the Apache License, Version 2.0
6+
(the "License"); you may not use this file except in compliance with
7+
the License. You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
*/
17+
18+
package e2e
19+
20+
import (
21+
"testing"
22+
23+
"github.com/apache/incubator-devlake/core/models/domainlayer/devops"
24+
"github.com/apache/incubator-devlake/helpers/e2ehelper"
25+
"github.com/apache/incubator-devlake/plugins/bitbucket/impl"
26+
"github.com/apache/incubator-devlake/plugins/bitbucket/models"
27+
"github.com/apache/incubator-devlake/plugins/bitbucket/tasks"
28+
)
29+
30+
func TestBitbucketPipelineStepsDataFlow(t *testing.T) {
31+
32+
var bitbucket impl.Bitbucket
33+
dataflowTester := e2ehelper.NewDataFlowTester(t, "bitbucket", bitbucket)
34+
35+
taskData := &tasks.BitbucketTaskData{
36+
Options: &tasks.BitbucketOptions{
37+
ConnectionId: 4,
38+
FullName: "thenicetgp/lake",
39+
BitbucketTransformationRule: &models.BitbucketTransformationRule{
40+
DeploymentPattern: "",
41+
ProductionPattern: "",
42+
},
43+
},
44+
}
45+
46+
dataflowTester.ImportCsvIntoTabler("./snapshot_tables/_tool_bitbucket_pipeline_steps.csv", &models.BitbucketPipelineStep{})
47+
dataflowTester.ImportCsvIntoTabler("./snapshot_tables/_tool_bitbucket_deployments.csv", &models.BitbucketDeployment{})
48+
dataflowTester.FlushTabler(&devops.CICDTask{})
49+
// verify extraction
50+
dataflowTester.Subtask(tasks.ConvertPipelineStepMeta, taskData)
51+
dataflowTester.VerifyTable(
52+
devops.CICDTask{},
53+
"./snapshot_tables/cicd_tasks.csv",
54+
e2ehelper.ColumnWithRawData(
55+
"id",
56+
"name",
57+
"pipeline_id",
58+
"result",
59+
"status",
60+
"type",
61+
"duration_sec",
62+
"started_date",
63+
"finished_date",
64+
"environment",
65+
"cicd_scope_id",
66+
),
67+
)
68+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"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"
2+
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"
3+
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+
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"
5+
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"
6+
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"
7+
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"
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
"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"
2+
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,""
3+
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+
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,""
5+
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,""
6+
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,""
7+
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,""
8+
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,""
9+
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,""
10+
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,""
11+
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,""
12+
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,""
13+
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,""
14+
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,""
15+
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,""
16+
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,""
17+
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,""
18+
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,""
19+
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,""
20+
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,""
21+
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,""
22+
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,""

0 commit comments

Comments
 (0)