klesh commented on issue #7193: URL: https://github.com/apache/incubator-devlake/issues/7193#issuecomment-2017285029
> @klesh I don't think we need to relate things by date at all. I think you have a deployment record provided by the webhook where that record says 'these are teh commits that were deployed in this deployment' I think you have a PR No, this is not the case. The webhook, or any other data sources would have only 1 commit sha for each repo per deployment stored in the `cicd_deployment_commits` table, so we have to calculate the commits between deployments, which is covered by https://github.com/apache/incubator-devlake/blob/49f276f558a2ea7124dfdc680bccbef27bf0b581/backend/plugins/refdiff/tasks/deployment_commit_diff_calculator.go Let's assume that you have a `release` branch, you merge PR to it then deploy, at any point of time, you pick the latest commit of the branch, and search all its ancestors, you can find every single deployment commits up to the point, then you are guaranteed to have a correct PRs and deployments relationship. This is important, because one may merge a couple of PRs before a deployment. Sorry, I shouldn't use the term `Linear Commit History`, it is not accurate, we just need all the deployment commits gets included in the history. >record provided by the azure devops api that says 'these are the commits that were part of this PR' so from ad eployment you can select the commits it deployed and join them to the pr commits to find the pr(s) that they were merged in. That is the idea but not the whole story, in fact, `commits` of a PR morally don't end up in the deployment commit history., especially, when most projects tend to use `Squash and Merge` which no `PR.commits` would ever end up in the `release` branch. To address this, we use `merge_commit_sha` ( or `squash_commit_sha` or `head_commit_sha`) which would definitely appear in the commits history to represent if a PR is included in a deployment. > > So between these you can link all the data required to caluclate cycle time. you know exactly which commits where in a deployment and can look up which PR those commits were associated with to reference those timings and look up what date that commit was originally made to calculate how long it took from that point to the point it was deployed. > > Why would a deployment commit be linked to all previous deployment commits? Let me know if I missed anything. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
