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

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 8b5275bb1 fix(bitbucket): lots of fix about result\status and 
pipeline's name fields (#6321)
8b5275bb1 is described below

commit 8b5275bb14a23c49865109165768cd246ea17cd3
Author: Lynwee <[email protected]>
AuthorDate: Tue Oct 24 19:31:42 2023 +0800

    fix(bitbucket): lots of fix about result\status and pipeline's name fields 
(#6321)
    
    * fix(bitbucket): lots of fix about result\status and pipeline's name fields
    
    * fix(bitbucket): fix e2e test
---
 .../e2e/snapshot_tables/cicd_pipelines.csv         | 20 +++++++-------
 .../bitbucket/e2e/snapshot_tables/cicd_tasks.csv   | 32 +++++++++++-----------
 .../bitbucket/tasks/deployment_convertor.go        | 10 +++----
 .../plugins/bitbucket/tasks/pipeline_convertor.go  | 15 +++++-----
 .../bitbucket/tasks/pipeline_steps_convertor.go    |  6 ++--
 5 files changed, 42 insertions(+), 41 deletions(-)

diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv 
b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv
index 79c0d089f..7f9578744 100644
--- a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv
+++ b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_pipelines.csv
@@ -1,11 +1,11 @@
 id,name,result,status,type,duration_sec,environment
-bitbucket:BitbucketPipeline:1:{01fad871-cd21-4a80-bd59-74148dd5be8e},bitbucket:BitbucketPipeline:1:main,FAILURE,DONE,DEPLOYMENT,14,
-bitbucket:BitbucketPipeline:1:{02c4dfe8-70a6-442c-8bd8-19061979c2cf},bitbucket:BitbucketPipeline:1:0.5-alpha,MANUAL,IN_PROGRESS,,0,
-bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},bitbucket:BitbucketPipeline:1:0.5-alpha,SUCCESS,DONE,,21,
-bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},bitbucket:BitbucketPipeline:1:main,SUCCESS,DONE,DEPLOYMENT,16,
-bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},bitbucket:BitbucketPipeline:1:0.5-alpha,SUCCESS,DONE,,15,
-bitbucket:BitbucketPipeline:1:{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},bitbucket:BitbucketPipeline:1:0.5-alpha,MANUAL,IN_PROGRESS,,0,
-bitbucket:BitbucketPipeline:1:{8b417a17-72e6-4e16-ae4a-97f6e279f68e},bitbucket:BitbucketPipeline:1:0.5-alpha,MANUAL,IN_PROGRESS,,0,
-bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502},bitbucket:BitbucketPipeline:1:pipeline,ABORT,DONE,,0,PRODUCTION
-bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},bitbucket:BitbucketPipeline:1:pipeline,SUCCESS,DONE,,18,PRODUCTION
-bitbucket:BitbucketPipeline:1:{ee91b6d3-7736-482c-892f-ad1e923d145e},bitbucket:BitbucketPipeline:1:0.5-alpha,FAILURE,DONE,,0,
+bitbucket:BitbucketPipeline:1:{01fad871-cd21-4a80-bd59-74148dd5be8e},bitbucket:BitbucketPipeline:1:{01fad871-cd21-4a80-bd59-74148dd5be8e}/{01fad871-cd21-4a80-bd59-74148dd5be8e},FAILURE,COMPLETED,DEPLOYMENT,14,
+bitbucket:BitbucketPipeline:1:{02c4dfe8-70a6-442c-8bd8-19061979c2cf},bitbucket:BitbucketPipeline:1:{02c4dfe8-70a6-442c-8bd8-19061979c2cf}/{02c4dfe8-70a6-442c-8bd8-19061979c2cf},MANUAL,IN_PROGRESS,,0,
+bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b},bitbucket:BitbucketPipeline:1:{1e20072e-b22a-443f-ad92-3d9435393d5b}/{1e20072e-b22a-443f-ad92-3d9435393d5b},SUCCESS,COMPLETED,,21,
+bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},bitbucket:BitbucketPipeline:1:{2d91d69f-d84b-423d-ae4d-c1d3f2c27166}/{2d91d69f-d84b-423d-ae4d-c1d3f2c27166},SUCCESS,COMPLETED,DEPLOYMENT,16,
+bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51}/{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,COMPLETED,,15,
+bitbucket:BitbucketPipeline:1:{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},bitbucket:BitbucketPipeline:1:{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446}/{5fb099c8-ebdd-4d3e-97d8-a12ebfca5446},MANUAL,IN_PROGRESS,,0,
+bitbucket:BitbucketPipeline:1:{8b417a17-72e6-4e16-ae4a-97f6e279f68e},bitbucket:BitbucketPipeline:1:{8b417a17-72e6-4e16-ae4a-97f6e279f68e}/{8b417a17-72e6-4e16-ae4a-97f6e279f68e},MANUAL,IN_PROGRESS,,0,
+bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502},bitbucket:BitbucketPipeline:1:{b5d2ab02-2013-415e-b146-61ff3bf19502}/{b5d2ab02-2013-415e-b146-61ff3bf19502},ABORT,COMPLETED,,0,PRODUCTION
+bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f},bitbucket:BitbucketPipeline:1:{d7bf8394-6e18-42c4-b3a3-70514fc4079f}/{d7bf8394-6e18-42c4-b3a3-70514fc4079f},SUCCESS,COMPLETED,,18,PRODUCTION
+bitbucket:BitbucketPipeline:1:{ee91b6d3-7736-482c-892f-ad1e923d145e},bitbucket:BitbucketPipeline:1:{ee91b6d3-7736-482c-892f-ad1e923d145e}/{ee91b6d3-7736-482c-892f-ad1e923d145e},FAILURE,COMPLETED,,0,
diff --git a/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv 
b/backend/plugins/bitbucket/e2e/snapshot_tables/cicd_tasks.csv
index 5a22f1c08..48f1897a1 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,,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,,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,,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,
+bitbucket:BitbucketPipelineStep:1:{009577b4-99a8-4498-99bf-a00ef7254ca3},staging,bitbucket:BitbucketPipeline:1:{5decbbb2-f4e6-4f3a-aab0-f74c40497c51},SUCCESS,COMPLETED,,0,2023-02-20T09:38:47.203+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,COMPLETED,,0,2023-02-20T09:39:04.211+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,COMPLETED,,0,2023-02-20T09:38:30.581+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,COMPLETED,,0,2023-02-20T09:23:50.415+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},,COMPLETED,,0,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,COMPLETED,,0,2023-02-20T09:12:34.572+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},,COMPLETED,,0,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,COMPLETED,,0,2023-02-20T09:15:45.450+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,COMPLETED,,0,2023-02-20T09:24:05.997+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,COMPLETED,,0,2023-02-20T09:23:31.978+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,COMPLETED,,0,2023-02-20T09:12:04.411+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,COMPLETED,,0,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,COMPLETED,,0,2023-02-20T09:16:01.886+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,COMPLETED,,0,2023-02-20T09:11:43.393+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,COMPLETED,,0,2023-02-20T08:58:31.520+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,COMPLETED,,0,2023-02-20T09:17:33.116+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/deployment_convertor.go 
b/backend/plugins/bitbucket/tasks/deployment_convertor.go
index 40bd9613c..ab93888d0 100644
--- a/backend/plugins/bitbucket/tasks/deployment_convertor.go
+++ b/backend/plugins/bitbucket/tasks/deployment_convertor.go
@@ -88,15 +88,15 @@ func ConvertDeployments(taskCtx plugin.SubTaskContext) 
errors.Error {
                                CicdDeploymentId: 
pipelineIdGen.Generate(data.Options.ConnectionId, 
bitbucketDeployment.PipelineId),
                                Name:             bitbucketDeployment.Name,
                                Result: devops.GetResult(&devops.ResultRule{
-                                       Failed:  []string{"UNDEPLOYED"},
-                                       Success: []string{"COMPLETED"},
+                                       Failed:  []string{},
+                                       Success: []string{models.COMPLETED},
                                        Default: "",
                                }, bitbucketDeployment.Status),
                                Status: 
devops.GetStatus(&devops.StatusRule[string]{
-                                       Done:    []string{"COMPLETED", 
"UNDEPLOYED"},
-                                       Default: devops.STATUS_IN_PROGRESS,
+                                       Done:    []string{models.COMPLETED},
+                                       Default: bitbucketDeployment.Status,
                                }, bitbucketDeployment.Status),
-                               Environment:  bitbucketDeployment.Environment,
+                               Environment:  bitbucketDeployment.Environment, 
// or bitbucketDeployment.EnvironmentType, they are same so far.
                                CreatedDate:  *bitbucketDeployment.CreatedOn,
                                StartedDate:  bitbucketDeployment.StartedOn,
                                FinishedDate: bitbucketDeployment.CompletedOn,
diff --git a/backend/plugins/bitbucket/tasks/pipeline_convertor.go 
b/backend/plugins/bitbucket/tasks/pipeline_convertor.go
index c5eb48157..d8dddcbc5 100644
--- a/backend/plugins/bitbucket/tasks/pipeline_convertor.go
+++ b/backend/plugins/bitbucket/tasks/pipeline_convertor.go
@@ -18,6 +18,7 @@ limitations under the License.
 package tasks
 
 import (
+       "fmt"
        "reflect"
        "time"
 
@@ -72,9 +73,10 @@ func ConvertPipelines(taskCtx plugin.SubTaskContext) 
errors.Error {
                        if bitbucketPipeline.BitbucketCreatedOn != nil {
                                createdAt = 
*bitbucketPipeline.BitbucketCreatedOn
                        }
+                       domainEntityId := 
pipelineIdGen.Generate(data.Options.ConnectionId, bitbucketPipeline.BitbucketId)
                        results := make([]interface{}, 0, 2)
                        domainPipelineCommit := &devops.CiCDPipelineCommit{
-                               PipelineId: 
pipelineIdGen.Generate(data.Options.ConnectionId, 
bitbucketPipeline.BitbucketId),
+                               PipelineId: domainEntityId,
                                RepoId:     repoId,
                                CommitSha:  bitbucketPipeline.CommitSha,
                                Branch:     bitbucketPipeline.RefName,
@@ -82,21 +84,20 @@ func ConvertPipelines(taskCtx plugin.SubTaskContext) 
errors.Error {
                        }
                        domainPipeline := &devops.CICDPipeline{
                                DomainEntity: domainlayer.DomainEntity{
-                                       Id: 
pipelineIdGen.Generate(data.Options.ConnectionId, 
bitbucketPipeline.BitbucketId),
+                                       Id: domainEntityId,
                                },
-                               Name: 
didgen.NewDomainIdGenerator(&models.BitbucketPipeline{}).
-                                       Generate(data.Options.ConnectionId, 
bitbucketPipeline.RefName),
+                               Name: fmt.Sprintf("%s/%s", domainEntityId, 
bitbucketPipeline.BitbucketId),
                                Result: devops.GetResult(&devops.ResultRule{
-                                       Failed:  []string{models.FAILED, 
models.ERROR, models.UNDEPLOYED},
+                                       Failed:  []string{models.FAILED, 
models.ERROR},
                                        Abort:   []string{models.STOPPED},
                                        Success: []string{models.SUCCESSFUL, 
models.COMPLETED},
                                        Manual:  []string{models.PAUSED, 
models.HALTED},
                                        Skipped: []string{models.SKIPPED},
-                                       Default: devops.RESULT_SUCCESS,
+                                       Default: "",
                                }, bitbucketPipeline.Result),
                                Status: 
devops.GetStatus(&devops.StatusRule[string]{
                                        InProgress: 
[]string{models.IN_PROGRESS, models.PENDING, models.BUILDING},
-                                       Default:    devops.STATUS_DONE,
+                                       Default:    bitbucketPipeline.Status,
                                }, bitbucketPipeline.Status),
                                Type:         bitbucketPipeline.Type,
                                Environment:  bitbucketPipeline.Environment,
diff --git a/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go 
b/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
index ddbaa5236..29eeba89d 100644
--- a/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
+++ b/backend/plugins/bitbucket/tasks/pipeline_steps_convertor.go
@@ -69,16 +69,16 @@ func ConvertPipelineSteps(taskCtx plugin.SubTaskContext) 
errors.Error {
                                Name:       bitbucketPipelineStep.Name,
                                PipelineId: 
pipelineIdGen.Generate(data.Options.ConnectionId, 
bitbucketPipelineStep.PipelineId),
                                Result: devops.GetResult(&devops.ResultRule{
-                                       Failed:  []string{models.FAILED, 
models.ERROR, models.UNDEPLOYED},
+                                       Failed:  []string{models.FAILED, 
models.ERROR},
                                        Abort:   []string{models.STOPPED},
                                        Success: []string{models.SUCCESSFUL, 
models.COMPLETED},
                                        Manual:  []string{models.PAUSED, 
models.HALTED},
                                        Skipped: []string{models.SKIPPED},
-                                       Default: devops.RESULT_SUCCESS,
+                                       Default: "",
                                }, bitbucketPipelineStep.Result),
                                Status: 
devops.GetStatus(&devops.StatusRule[string]{
                                        InProgress: 
[]string{models.IN_PROGRESS, models.PENDING, models.BUILDING},
-                                       Default:    devops.STATUS_DONE,
+                                       Default:    bitbucketPipelineStep.State,
                                }, bitbucketPipelineStep.State),
                                CicdScopeId: 
repoIdGen.Generate(data.Options.ConnectionId, data.Options.FullName),
                        }

Reply via email to