Skip to content

Improve error message for invalid Helm chart repository URLs#2063

Open
ogulcanaydogan wants to merge 1 commit into
fluxcd:mainfrom
ogulcanaydogan:fix/654-descriptive-helm-repo-error
Open

Improve error message for invalid Helm chart repository URLs#2063
ogulcanaydogan wants to merge 1 commit into
fluxcd:mainfrom
ogulcanaydogan:fix/654-descriptive-helm-repo-error

Conversation

@ogulcanaydogan
Copy link
Copy Markdown
Contributor

What's changed

Wrap the two error paths in the HelmRepository reconciler with a helm-CLI-style message that includes the repository URL:

looks like "https://example.com" is not a valid chart repository or cannot be reached: <underlying error>

CacheIndex failure (e.g. 404 from upstream): the underlying HTTPGetter error already carries the URL and status, but the operator event only showed failed to fetch Helm repository index. Users had to correlate the URL from the HelmRepository spec manually.

LoadFromPath failure (e.g. server returns HTML at 200): IndexFromBytes fails to unmarshal the index YAML, but the error only said failed to load Helm repository from index YAML with no URL context.

Both cases now surface:

looks like "https://my-repo.example.com" is not a valid chart repository or cannot be reached: <root cause>

The format mirrors what helm repo add emits and what was requested in #654.

How to test

  1. Create a HelmRepository pointing to a non-existent URL (404): the Ready=False condition message will include the repository URL.
  2. Point to a URL that returns HTML instead of a YAML index: same format.

Related

Closes #654

Precedent: #2013 / commit 790be38 (improved SSH key error message, same pattern).

Wrap the errors from CacheIndex() and LoadFromPath() in reconcileSource
with a helm-CLI-style message that includes the configured repository URL.
When the index cannot be fetched or fails to parse (e.g. server returns
HTML instead of YAML), the user now sees:

  looks like "https://example.com" is not a valid chart repository or
  cannot be reached: <underlying error>

instead of the cryptic YAML parse error or generic fetch failure.

Fixes fluxcd#654

Signed-off-by: Ogulcan Aydogan <ogulcanaydogan@hotmail.com>
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.

Report descriptive error for invalid chart repository URLs / index data

1 participant