Skip to content

fix(argocd): report a Degraded rollout as a failed deployment - #9354

Merged
klesh merged 1 commit into
apache:mainfrom
PDGGK:fix-argocd-degraded-deployment-result
Nov 10, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
PDGGK:fix-argocd-degraded-deployment-result

Conversation

@PDGGK

@PDGGK PDGGK commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

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.

A sync can succeed while the rollout it starts never becomes healthy, and
the plugin only looks at the sync phase, so such a deployment was stored
with result SUCCESS. Record the application's health on the newest history
entry when it is collected and turn a Succeeded sync whose rollout is
Degraded into result FAILURE.

Signed-off-by: Zihan Dai <dzh1436286758@gmail.com>
@klesh
klesh merged commit 4dc01bf into apache:main Nov 10, 2026
10 checks passed
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.

[Bug][Argocd] Bug title all deployments reported as  Succeeded  — health status ignored, sync history phase hardcoded

2 participants