PDGGK opened a new pull request, #9354:
URL: https://github.com/apache/devlake/pull/9354

   ### Summary
   
   An Argo CD sync can succeed while the rollout it starts fails: the manifests 
apply, the new pods then crash-loop and the application goes Degraded. The 
plugin only reads the sync phase, so those deployments were saved in 
`cicd_deployments` and `cicd_deployment_commits` with result SUCCESS and 
counted as good deployments. `_tool_argocd_sync_operations.health_status` has 
been in the schema from the start, but nothing ever filled it.
   
   Argo CD keeps health on the application, not per sync, and 
`status.history[]` entries carry no health. So it can only be tied to a sync 
while that sync is the newest one. The collector now writes the application's 
health onto the newest history entry when it reads the application. If 
`operationState` shows a newer sync that failed or is still running, nothing is 
written, because that health does not belong to the last history entry. The 
next collection returns the same entry without the value, so the extractor 
keeps the last health it saw for that sync and stores it in `health_status`. 
The convertor reports a Succeeded sync whose health is Degraded as FAILURE, and 
sets `original_result` to Degraded so the reason sits next to `original_status` 
Succeeded.
   
   Only Degraded changes the result. Progressing and the other states are left 
as they are: Progressing is normal right after every sync, and a run that lands 
mid-rollout should not take the deployment out of the DORA numbers. The issue 
also says failed operations get dropped, but `isRedundantOperationState` only 
skips Succeeded, so Failed and Error already come through as FAILURE and I did 
not touch that. History entries that were never the newest one during a 
collection, and everything after a full resync (which clears the raw rows), 
have no health recorded and stay SUCCESS. Argo CD offers nothing to recover it 
from.
   
   How I tested it. I ran the real collect, extract and convert subtasks in 
Docker against MySQL 8.4 and a stub Argo CD API that returns an application 
with two history entries and health Degraded. Unmodified main stored SUCCESS 
for both deployments. With the change, the newest one is FAILURE and the older 
one SUCCESS. After a second incremental run where a newer sync landed and the 
application was Healthy again, the Degraded deployment stayed FAILURE and the 
new one was SUCCESS. An application whose operation is Failed leaves the last 
good deployment SUCCESS. A Healthy application is unchanged.
   
   `TestSyncOperationDataFlow` is a new e2e test that feeds raw rows from two 
collections through the extractor and convertor. With the production changes 
reverted it fails with `expected: "FAILURE" actual: "SUCCESS"` on the Degraded 
deployment, and without the carry-over in the extractor it fails the same way. 
The unit tests cover which entry gets tagged and the result mapping. `go test 
./plugins/argocd/...`, gofmt and golangci-lint v2.15.0 pass.
   
   I did not run this against a real Argo CD server: the stub uses the field 
names from Argo CD's API types. I did not run it on PostgreSQL, and I did not 
run the e2e suites of other plugins.
   
   ### Does this close any open issues?
   Closes #9329
   
   ### Screenshots
   None.
   
   ### Other Information
   None.
   


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