mieliespoor commented on PR #8611:
URL: 
https://github.com/apache/incubator-devlake/pull/8611#issuecomment-3422926889

   Testing this, we are able to push deployments and see these deployment data 
in the `cicd_deployments` and `cicd_deployment_commits` tables. Deployment data 
from webhooks, from what I can see is not present on many dashboards, but one 
dashboard in particular has an issue.
   
   Because we now use one single webhook, which is then added to multiple 
projects, the query for the `DORA Details - Deployment Frequency` dashboard, 
specifically the `Deployment list in the selected project(s)` panel is 
incorrectly attributing deployments to projects.
   
   Looking into it, we can see that the `project_mapping` table has the 
cicd_scope row for the same webook id for the two projects we used to test. 
This is still expected, because we will be reusing the webhook.
   
   Looking at this part of the query:
   
   ```sql
   with _deployment_commit_rank as(
     SELECT
        pm.project_name,
        IF(cdc._raw_data_table != '', cdc._raw_data_table, cdc.cicd_scope_id) 
as _raw_data_table,
        cdc.id,
       cdc.display_title,
       cdc.url,
        cdc.cicd_deployment_id,
        cdc.cicd_scope_id,
        result,
        environment,
       finished_date,
       row_number() over(partition by cdc.cicd_deployment_id order by 
finished_date desc) as _deployment_commit_rank
     FROM cicd_deployment_commits cdc
     left join project_mapping pm on cdc.cicd_scope_id = pm.row_id and 
pm.`table` = 'cicd_scopes'
     WHERE
       pm.project_name in ($project)
        and result = 'SUCCESS'
        and environment = 'PRODUCTION'
   )
   ```
   I believe the issue to be around the line where the `row_number()` is 
determined. Because two rows, but for different projects exist, it does not 
treat these as distinctly different.
   
   I'm not a db dev, nor a dba, so I'm out of my depth to try and solve this 
issue. Any suggestions here, would be welcomed. 
   


-- 
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]

Reply via email to