Skip to content

Refactor Chage Lead Time - Step 3: convert bitbucket deployment to domain layer#4894

Merged
mindlesscloud merged 4 commits intoapache:mainfrom
merico-ai:kw-4869-dora-refactor
Apr 12, 2023
Merged

Refactor Chage Lead Time - Step 3: convert bitbucket deployment to domain layer#4894
mindlesscloud merged 4 commits intoapache:mainfrom
merico-ai:kw-4869-dora-refactor

Conversation

@klesh
Copy link
Contributor

@klesh klesh commented Apr 11, 2023

Summary

  1. fixed GetStatus returning FAILURE when it should be DONE
    1. added deployment_commits table for tracking deployments on repository/commits level
  2. added DeploymentConvertor to bitbucket plugin

This PR convers the following scenario from the flow chart in #4869
image

Does this close any open issues?

Part of #4869

Screenshots

After collect data from https://bitbucket.org/likyh/likyhphp
And using the following SQL

select id, cicd_scope_id, cicd_pipeline_id, name, result, environment ,started_date, duration_sec , commit_sha , repo_id , repo_url
from cicd_deployment_commits cdc
order by started_date DESC 
limit 10

I got the following result:

|id                                                                    |cicd_scope_id                           |cicd_pipeline_id                                                    |name|result |environment|started_date           |duration_sec|commit_sha                              |repo_id                                 |repo_url                            |
|----------------------------------------------------------------------|----------------------------------------|--------------------------------------------------------------------|----|-------|-----------|-----------------------|------------|----------------------------------------|----------------------------------------|------------------------------------|
|bitbucket:BitbucketDeployment:1:{9e1ac6b7-5744-538b-a8bb-edb53f339228}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{8183df71-032d-4cf8-85dc-0512322ebe9c}|#245|SUCCESS|Production |2023-03-09 15:12:56.962|5           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{c483eb7a-4e8e-5f73-b4c2-32a6cb86bd1e}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{8183df71-032d-4cf8-85dc-0512322ebe9c}|#245|SUCCESS|Staging    |2023-03-09 15:12:39.963|5           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{bb28c7e5-6902-55f6-b33e-ae0372228fbb}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{8183df71-032d-4cf8-85dc-0512322ebe9c}|#245|SUCCESS|Test       |2023-03-09 15:12:18.889|9           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{4a74db8e-c764-55d6-abc2-74ba47b3fef8}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{5fb7fdd7-57ff-4bd4-9093-39efb1b47cba}|#17 |SUCCESS|Production |2023-02-20 09:46:04.911|6           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{627e319f-684b-55a5-ae6b-58abcabc9012}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{5fb7fdd7-57ff-4bd4-9093-39efb1b47cba}|#17 |SUCCESS|Staging    |2023-02-20 09:45:46.821|4           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{55ec0dbf-1345-5f44-97b5-317fdaed60e5}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{5fb7fdd7-57ff-4bd4-9093-39efb1b47cba}|#17 |SUCCESS|Test       |2023-02-20 09:45:28.781|4           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{14d66a4d-922b-543a-9e0f-e42b836b7ba9}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{e4a54705-dd60-4540-aaaa-836f48f473da}|#240|SUCCESS|Production |2023-02-20 09:44:03.598|7           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{f1438c31-868c-5dec-a611-a78c64eb1190}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{e4a54705-dd60-4540-aaaa-836f48f473da}|#240|SUCCESS|Staging    |2023-02-20 09:43:46.499|4           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{b385d002-a53a-5c35-a647-685fd239fa94}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{e4a54705-dd60-4540-aaaa-836f48f473da}|#240|SUCCESS|Test       |2023-02-20 09:43:27.469|5           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|
|bitbucket:BitbucketDeployment:1:{e4551d44-0e46-57b4-839f-c9eab89056e2}|bitbucket:BitbucketRepo:1:likyh/likyhphp|bitbucket:BitbucketPipeline:1:{875012ed-8177-49bd-88d3-4fb475be34de}|#232|SUCCESS|Production |2023-02-20 09:43:26.753|4           |ca4302e0e56c89332711e1b1051ab2f0110d4412|bitbucket:BitbucketRepo:1:likyh/likyhphp|https://bitbucket.org/likyh/likyhphp|

Other Information

Any other information that is important to this PR.

@klesh klesh changed the title Kw 4869 dora refactor Refactor Chage Lead Time - Step 3: convert bitbucket deployment to domain layer Apr 11, 2023

var duration *uint64
if bitbucketDeployment.CompletedOn != nil {
d := uint64(bitbucketDeployment.CompletedOn.Sub(*bitbucketDeployment.StartedOn).Seconds())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to check if bitbucketDeployment.StartedOn is null?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes no sense for StartedOn to be nil when CompleteOn is not .

@mindlesscloud mindlesscloud merged commit e750403 into apache:main Apr 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants