eschumm751 opened a new issue, #6869:
URL: https://github.com/apache/incubator-devlake/issues/6869

   ### Search before asking
   
   - [X] I had searched in the 
[issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and 
found no similar issues.
   
   
   ### What happened
   
   deployments downloaded via the github connector only show a FAILURE result.  
Successful deployments have no result set in the cicd_deployments table (or 
DORA validation dashboard) and have OTHER set as 
   
   ### What do you expect to happen
   
   Successful deployments should set result to SUCCESS and status DONE to 
generate deployments for DORA dashboards.
   
   ### How to reproduce
   
   Configure a github connector as part of a project with successful and failed 
deployements.  ingest the logs.  View the DORA validation dashboard or the 
underlying mysql database.
   
   ### Anything else
   
   Hello,
   
   I am trying to get deployments to parse from gitops, but it appears that the 
converter is not parsing successful deployments properly.  The cicd_deployments 
table's result column only contains values in the result column for failures.  
This seems to be because the converter code here is looking at the State 
member, which doesn't actually contain "SUCCESS" for a successful deployment, 
from the data I am seeing from calls to our github.com repository.  We are 
creating these deployments via api from our pipeline setting status to 
"failure" or "success". (I'm running v.0.20.0-beta8)
   
   Pulling deployments from the raw_github_graphql_deployment table seems to 
point out a flaw in this logic, at least for my data:  Success is set on 
LastStatus only if it is the active deployment, so failed deployments will only 
be populated.
   
   Failed deployment:
   ```
                   {
                       "Task": "deploy",
                       "Id": "DE_kwDOJViRD85JhakS",
                       "CommitOid": "2dd81bcbec927df94153fd23b7a7935491e5feda",
                       "Environment": "production",
                       "State": "FAILURE",
                       "DatabaseId": 1233496338,
                       "Description": "Deploy 0.0.18 to production",
                       "Payload": "",
                       "Ref": null,
                       "LatestStatus": {
                           "Id": "DES_kwDOJViRD86vyS6U",
                           "State": "FAILURE",
                           "updatedAt": "2023-12-20T00:26:09Z"
                       },
                       "Repository": {
                           "Id": "R_kgDOJViRDw",
                           "Name": "locations",
                           "Url": 
"https://github.com/BrightlySoftware/locations";
                       },
                       "CreatedAt": "2023-12-20T00:26:09Z",
                       "UpdatedAt": "2023-12-20T00:26:09Z"
                   },
   ```
   Successful Deployment (inactive):
   
   ```
   {
                       "Task": "deploy",
                       "Id": "DE_kwDOKMiVkc5MmKAA",
                       "CommitOid": "8158e2000c44f9cf54640a962d178dc98e6755af",
                       "Environment": "production",
                       "State": "INACTIVE",
                       "DatabaseId": 1285070848,
                       "Description": "Deploy 0.0.17 to production",
                       "Payload": "",
                       "Ref": null,
                       "LatestStatus": {
                           "Id": "DES_kwDOKMiVkc64xqtd",
                           "State": "INACTIVE",
                           "updatedAt": "2024-01-22T21:06:22Z"
                       },
                       "Repository": {
                           "Id": "R_kgDOKMiVkQ",
                           "Name": "dgp-test",
                           "Url": "https://github.com/BrightlySoftware/dgp-test";
                       },
                       "CreatedAt": "2024-01-22T19:06:32Z",
                       "UpdatedAt": "2024-01-22T21:06:22Z"
                   },
   ```
   
   Successful Deployment (if it is currently active):
   
   ```
   {
                       "Task": "deploy",
                       "Id": "DE_kwDOKMiVkc5Mm_x7",
                       "CommitOid": "7cf924eb079bee9e9578eab72229de2dde72517b",
                       "Environment": "production",
                       "State": "ACTIVE",
                       "DatabaseId": 1285291131,
                       "Description": "Deploy 0.0.18 to production",
                       "Payload": "",
                       "Ref": null,
                       "LatestStatus": {
                           "Id": "DES_kwDOKMiVkc64xqsx",
                           "State": "SUCCESS",
                           "updatedAt": "2024-01-22T21:06:22Z"
                       },
                       "Repository": {
                           "Id": "R_kgDOKMiVkQ",
                           "Name": "dgp-test",
                           "Url": "https://github.com/BrightlySoftware/dgp-test";
                       },
                       "CreatedAt": "2024-01-22T21:06:21Z",
                       "UpdatedAt": "2024-01-22T21:06:22Z"
                   },
   ```
   
   I think that the logic should be  success = (State == "ACTIVE" && 
LatestStatus.State == "SUCCESS") || (State == "INACTIVE" && Latest.State == 
"INACTIVE")
   
   Looking at the [source 
code](https://github.com/apache/incubator-devlake/blob/main/backend/plugins/github/tasks/deployment_convertor.go#L84C25-L84C30),
 it appears that it is expecting different behavior from the api than I see 
captured in my tables.
   
   Link to question in 
[slack](https://devlake-io.slack.com/archives/C03APJ20VM4/p1706126424621969)
   
   ### Version
   
   v.0.20.0-beta8
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   


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