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

lynwee 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 c5b90ebfc fix(bitbucket) make cicd_tasks.type empty (#6297)
c5b90ebfc is described below

commit c5b90ebfc3202f845686150a6fd2ec303d92d5aa
Author: Lynwee <[email protected]>
AuthorDate: Mon Oct 23 10:57:34 2023 +0800

    fix(bitbucket) make cicd_tasks.type empty (#6297)
    
    * fix(webhook): avoid to return null when there is no webhook connections
    
    * fix(bitbucket): make cicd_tasks.type empty
    
    * fix(bitbucket): fix e2e test
    
    * fix(bitbucket): remove unneccessary type and environment fields for 
cicd_tasks
---
 .../bitbucket/e2e/snapshot_tables/cicd_tasks.csv   | 28 +++++++++++-----------
 .../bitbucket/tasks/pipeline_steps_convertor.go    | 13 ----------
 2 files changed, 14 insertions(+), 27 deletions(-)

diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv 
b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv
index 33fe73b66..5a22f1c08 100644
--- a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv
@@ -1,17 +1,17 @@
 
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:1:{009577b4-99a8-4498-99bf-a00ef7254ca3},staging,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:38:47.203+00:00,2023-02-20T09:38:52.307+00:00,STAGING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,285,
-bitbucket:BitbucketPipelineStep:1:{0706054d-bde3-4d27-af26-8ff9bc675e6c},production,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:39:04.211+00:00,2023-02-20T09:39:09.267+00:00,PRODUCTION,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,286,
-bitbucket:BitbucketPipelineStep:1:{0fa0137f-e029-459e-8760-289ed9e6b57d},Test,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,DONE,DEPLOYMENT,4,2023-02-20T09:38:30.581+00:00,2023-02-20T09:38:35.012+00:00,TESTING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,284,
-bitbucket:BitbucketPipelineStep:1:{1218e6e3-f34e-4ebc-a767-2a69285681ca},staging,bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:23:50.415+00:00,2023-02-20T09:23:55.180+00:00,STAGING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,144,
+bitbucket:BitbucketPipelineStep:1:{009577b4-99a8-4498-99bf-a00ef7254ca3},staging,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,DONE,,5,2023-02-20T09:38:47.203+00:00,2023-02-20T09:38:52.307+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,285,
+bitbucket:BitbucketPipelineStep:1:{0706054d-bde3-4d27-af26-8ff9bc675e6c},production,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,DONE,,5,2023-02-20T09:39:04.211+00:00,2023-02-20T09:39:09.267+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,286,
+bitbucket:BitbucketPipelineStep:1:{0fa0137f-e029-459e-8760-289ed9e6b57d},Test,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,DONE,,4,2023-02-20T09:38:30.581+00:00,2023-02-20T09:38:35.012+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,284,
+bitbucket:BitbucketPipelineStep:1:{1218e6e3-f34e-4ebc-a767-2a69285681ca},staging,bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,DONE,,5,2023-02-20T09:23:50.415+00:00,2023-02-20T09:23:55.180+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,144,
 
bitbucket:BitbucketPipelineStep:1:{148bfd03-8b7f-4483-982c-18b020124350},production,bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502},SUCCESS,DONE,,0,2023-02-20T09:23:40.970+00:00,2023-02-20T09:23:40.970+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,533,
-bitbucket:BitbucketPipelineStep:1:{263500ac-4242-4996-95bd-739b5cafd3ef},Test,bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:12:34.572+00:00,2023-02-20T09:12:39.614+00:00,PRODUCTION,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,91,
+bitbucket:BitbucketPipelineStep:1:{263500ac-4242-4996-95bd-739b5cafd3ef},Test,bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,DONE,,5,2023-02-20T09:12:34.572+00:00,2023-02-20T09:12:39.614+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,91,
 
bitbucket:BitbucketPipelineStep:1:{2915edc8-9a5a-4a76-831b-f7ce30938d4e},staging,bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502},SUCCESS,DONE,,0,2023-02-20T09:23:40.928+00:00,2023-02-20T09:23:40.928+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,532,
-bitbucket:BitbucketPipelineStep:1:{61e34fbf-87a2-4271-827e-b336ff4c4396},staging,bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:15:45.450+00:00,2023-02-20T09:15:50.609+00:00,STAGING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,632,
-bitbucket:BitbucketPipelineStep:1:{74ceee44-533a-489b-8d9b-3c9c0ef57ff3},production,bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,DONE,DEPLOYMENT,6,2023-02-20T09:24:05.997+00:00,2023-02-20T09:24:12.269+00:00,PRODUCTION,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,145,
-bitbucket:BitbucketPipelineStep:1:{9b079475-6fed-40bb-b591-711351c12f71},Test,bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:23:31.978+00:00,2023-02-20T09:23:36.923+00:00,TESTING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,143,
-bitbucket:BitbucketPipelineStep:1:{a72dea81-cd04-45db-8af9-958ed814d050},Test,bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,DONE,DEPLOYMENT,6,2023-02-20T09:12:04.411+00:00,2023-02-20T09:12:10.347+00:00,STAGING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,90,
-bitbucket:BitbucketPipelineStep:1:{ac0a2d0b-d67d-47c6-8e23-ee33ccdfe2d8},Test,bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502},ABORT,DONE,DEPLOYMENT,0,2023-02-20T09:23:40.750+00:00,2023-02-20T09:23:40.750+00:00,TESTING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,531,
-bitbucket:BitbucketPipelineStep:1:{c2da4b2d-f971-4c5f-90b7-1c55ea80121c},production,bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,DONE,DEPLOYMENT,8,2023-02-20T09:16:01.886+00:00,2023-02-20T09:16:09.885+00:00,PRODUCTION,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,633,
-bitbucket:BitbucketPipelineStep:1:{caf86c6c-c60a-4e62-b838-6480ad110182},Test,bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,DONE,DEPLOYMENT,10,2023-02-20T09:11:43.393+00:00,2023-02-20T09:11:53.145+00:00,TESTING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,89,
-bitbucket:BitbucketPipelineStep:1:{d464ab91-8b50-4ad5-8c22-d2a6d1ca5d22},Test,bitbucket:BitbucketPipeline:1:{01fad871-cd21-4a80-bd59-74148dd5be8e},FAILURE,DONE,DEPLOYMENT,14,2023-02-20T08:58:31.520+00:00,2023-02-20T08:58:45.945+00:00,TESTING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,1,
-bitbucket:BitbucketPipelineStep:1:{e4753fd7-469e-4d15-a689-0fd882fee2d4},Test,bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,DONE,DEPLOYMENT,5,2023-02-20T09:17:33.116+00:00,2023-02-20T09:17:37.835+00:00,TESTING,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,631,
+bitbucket:BitbucketPipelineStep:1:{61e34fbf-87a2-4271-827e-b336ff4c4396},staging,bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,DONE,,5,2023-02-20T09:15:45.450+00:00,2023-02-20T09:15:50.609+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,632,
+bitbucket:BitbucketPipelineStep:1:{74ceee44-533a-489b-8d9b-3c9c0ef57ff3},production,bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,DONE,,6,2023-02-20T09:24:05.997+00:00,2023-02-20T09:24:12.269+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,145,
+bitbucket:BitbucketPipelineStep:1:{9b079475-6fed-40bb-b591-711351c12f71},Test,bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,DONE,,5,2023-02-20T09:23:31.978+00:00,2023-02-20T09:23:36.923+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,143,
+bitbucket:BitbucketPipelineStep:1:{a72dea81-cd04-45db-8af9-958ed814d050},Test,bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,DONE,,6,2023-02-20T09:12:04.411+00:00,2023-02-20T09:12:10.347+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,90,
+bitbucket:BitbucketPipelineStep:1:{ac0a2d0b-d67d-47c6-8e23-ee33ccdfe2d8},Test,bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502},ABORT,DONE,,0,2023-02-20T09:23:40.750+00:00,2023-02-20T09:23:40.750+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,531,
+bitbucket:BitbucketPipelineStep:1:{c2da4b2d-f971-4c5f-90b7-1c55ea80121c},production,bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,DONE,,8,2023-02-20T09:16:01.886+00:00,2023-02-20T09:16:09.885+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,633,
+bitbucket:BitbucketPipelineStep:1:{caf86c6c-c60a-4e62-b838-6480ad110182},Test,bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,DONE,,10,2023-02-20T09:11:43.393+00:00,2023-02-20T09:11:53.145+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,89,
+bitbucket:BitbucketPipelineStep:1:{d464ab91-8b50-4ad5-8c22-d2a6d1ca5d22},Test,bitbucket:BitbucketPipeline:1:{01fad871-cd21-4a80-bd59-74148dd5be8e},FAILURE,DONE,,14,2023-02-20T08:58:31.520+00:00,2023-02-20T08:58:45.945+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,1,
+bitbucket:BitbucketPipelineStep:1:{e4753fd7-469e-4d15-a689-0fd882fee2d4},Test,bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,DONE,,5,2023-02-20T09:17:33.116+00:00,2023-02-20T09:17:37.835+00:00,,bitbucket:BitbucketRepo:1:likyh/likyhphp,"{""ConnectionId"":1,""FullName"":""likyh/likyhphp""}",_raw_bitbucket_api_pipeline_steps,631,
diff --git a/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go 
b/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
index b8d1ab76d..ddbaa5236 100644
--- a/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
+++ b/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
@@ -92,19 +92,6 @@ func ConvertPipelineSteps(taskCtx plugin.SubTaskContext) 
errors.Error {
                                domainTask.FinishedDate = 
bitbucketPipelineStep.CompletedOn
                                domainTask.DurationSec = 
uint64(bitbucketPipelineStep.DurationInSeconds)
                        }
-
-                       bitbucketDeployment := &models.BitbucketDeployment{}
-                       deploymentErr := db.First(bitbucketDeployment, 
dal.Where(`step_id=?`, bitbucketPipelineStep.BitbucketId))
-                       if deploymentErr == nil {
-                               domainTask.Type = devops.DEPLOYMENT
-                               if bitbucketDeployment.EnvironmentType == 
`Production` {
-                                       domainTask.Environment = 
devops.PRODUCTION
-                               } else if bitbucketDeployment.EnvironmentType 
== `Staging` {
-                                       domainTask.Environment = devops.STAGING
-                               } else if bitbucketDeployment.EnvironmentType 
== `Test` {
-                                       domainTask.Environment = devops.TESTING
-                               }
-                       }
                        return []interface{}{
                                domainTask,
                        }, nil

Reply via email to