Skip to content

🐛 argocd: getRevisionDetails fails with 500 for Helm chart sources in multi-source applications #7784

@driosalido

Description

@driosalido

📜 Description

When an ArgoCD Application is configured with multiple sources where one source is a Helm chart (spec.sources[i].chart), the backend calls the ArgoCD revision metadata endpoint using the Helm chart version string as the revision ID. ArgoCD returns HTTP 500 because that endpoint only accepts git commit SHAs, not Helm chart version strings.

This produces a continuous stream of backend 500 errors on every entity page load for any entity linked to a multi-source Helm+git-values application.

👍 Expected behavior

The plugin should detect that a source is a Helm chart (via spec.sources[i].chart) and skip the getRevisionDetails call for that source, or handle the 500 gracefully without surfacing it as an error.

👎 Actual Behavior with Screenshots

The backend logs a continuous stream of errors on every page load:

```
backstage-community-argocd error Request failed with status 500
Failed to fetch Revision data from Instance 'nonprod'
with revisionID '6.33.0'
with appName 'loki-mntn-gke-dev-01'
with appNamespace 'N/A'
with sourceIndex '0'
```

The ArgoCD API at GET /api/v1/applications/{name}/revisions/6.33.0/metadata returns 500 because 6.33.0 is a Helm chart version, not a git SHA.

👟 Reproduction steps

  1. Create a multi-source ArgoCD ApplicationSet with two sources:
    • Source 0: Helm chart (e.g. grafana/loki at targetRevision: 6.33.0)
    • Source 1: Git repository containing values files (targetRevision: HEAD, ref: values)
  2. Register the corresponding Backstage entity with argocd/app-selector annotation
  3. Open the entity page and observe the ArgoCD tab — the tab renders but the backend logs continuous 500 errors

📃 Context

Root cause: isAppHelmChartType only checks spec.source.chart (single-source path) and does not check spec.sources[i].chart for multi-source apps. Additionally, revisions.pop() picks the last revision (typically the git SHA of the values file source) rather than the Helm chart version.

Proposed fix:
```ts
// In getRevisionDetails or the caller:
const helmSourceIndex = app.spec.sources?.findIndex(s => s.chart);
if (helmSourceIndex !== undefined && helmSourceIndex >= 0) {
// Skip getRevisionDetails for Helm chart sources — the API only accepts git SHAs
return undefined;
}
```

Plugin versions:

  • @backstage-community/plugin-argocd v2.5.0
  • @backstage-community/plugin-argocd-backend v1.1.0

Related: #7785 — separate bug where non-default ArgoCD namespaces cause 403 on the same endpoint

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

Are you willing to submit PR?

No, but I'm happy to collaborate on a PR with someone else

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions