Skip to content

Conversation

@bashSunny101
Copy link

PR description
Summary

  • Detects when a user provides an uncompressed .tar (not a gzipped chart) to Helm chart parsing and returns a clear, actionable error telling them to use .tgz / .tar.gz (or helm package).

What changed

  • Add ErrUncompressedTarProvided to surface a helpful message and remedies when Helm's gzip reader fails.
  • Update ParseFileAsHelmChart (files/identification.go) to detect the "gzip: invalid header" failure for .tar and return the new error.
  • Add unit test TestUncompressedHelmTarError (files/tests/sanitization_test.go) that builds an in-memory uncompressed tar containing Chart.yaml and asserts the new error path.

Files touched

  • files/error.go — new error constructor for uncompressed .tar.
  • files/identification.go — improved detection and error handling around loader.LoadArchive.
  • files/tests/sanitization_test.go — added unit test.

Why

  • Helm expects charts as gzipped tarballs (e.g., .tgz). When an uncompressed .tar is supplied the gzip reader fails with an opaque "gzip: invalid header". This change makes the failure actionable for users.

Tests

  • Added unit test covering the uncompressed .tar case.
  • Ran go test ./... locally; tests pass.

Related

How to validate locally

  1. Run the test suite:
    go test ./...

@welcome
Copy link

welcome bot commented Oct 12, 2025

Yay, your first pull request! 👍 A contributor will be by to give feedback soon. In the meantime, you can find updates in the #github-notifications channel in the community Slack.
Be sure to double-check that you have signed your commits. Here are instructions for making signing an implicit activity while performing a commit.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @bashSunny101, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the user experience when working with Helm charts by introducing more specific and actionable error messages. Previously, attempting to load an uncompressed ".tar" file as a Helm chart would result in a cryptic "gzip: invalid header" error. This change now explicitly identifies such cases, providing a clear explanation that Helm requires gzipped archives (.tgz or .tar.gz) and offers practical solutions, thereby reducing user confusion and improving debugging efficiency.

Highlights

  • Improved Helm Chart Error Handling: The system now specifically detects when an uncompressed ".tar" archive is provided for a Helm chart, which previously resulted in an opaque error.
  • Actionable Error Message: Instead of a generic "gzip: invalid header" error, users will now receive a clear message (ErrUncompressedTarProvided) explaining that Helm expects compressed tarballs (.tgz or .tar.gz) and provides remedies.
  • New Error Constructor: A new error constructor, ErrUncompressedTarProvided, has been added to files/error.go to encapsulate this specific error scenario and its suggested solutions.
  • Updated Chart Parsing Logic: The ParseFileAsHelmChart function in files/identification.go has been updated to intercept the "gzip: invalid header" error when a ".tar" file is encountered and return the new, more informative error.
  • Comprehensive Unit Testing: A new unit test, TestUncompressedHelmTarError, has been added to files/tests/sanitization_test.go to ensure the correct behavior and error path for uncompressed Helm ".tar" archives.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@bashSunny101 bashSunny101 force-pushed the fix/helm-uncompressed-tar-error branch from ab18dd8 to 5ecd41c Compare October 12, 2025 10:33
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a helpful error message for when a user provides an uncompressed .tar archive for a Helm chart, which is a great improvement for user experience. The implementation is solid, and the new unit test effectively covers the new error path. I have a couple of suggestions to make the error detection more robust and to improve the quality of the test code.

@bashSunny101 bashSunny101 force-pushed the fix/helm-uncompressed-tar-error branch from 78138b9 to d276481 Compare October 12, 2025 10:40
@bashSunny101
Copy link
Author

@Darshan174 hi,
Kindly merge this PR, it's got an approval and every checks are passing at my end.🙇

@Darshan174 Darshan174 requested a review from lekaf974 October 15, 2025 07:09
Copy link
Contributor

@lekaf974 lekaf974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small comments added, LGTM otherwise.

- Rename ErrUncompressedTarProvided to ErrUncompressedTar
- Add dedicated error code ErrUncompressedTarCode (meshkit-11305)
- Simplify error function to use inline values (follow codebase pattern)
- Replace generic fmt.Errorf with meshkit error ErrInvalidHelmChart
- Update test to check for new error code

Signed-off-by: Sunny <[email protected]>
@bashSunny101 bashSunny101 requested a review from lekaf974 October 17, 2025 03:53
@bashSunny101
Copy link
Author

I have made requested changes to this PR, kindly review it.
@lekaf974

Comment on lines +245 to +246
if errors.GetCode(err) != files.ErrUncompressedTarCode {
t.Fatalf("expected error code %s, got %s (err: %v)", files.ErrUncompressedTarCode, errors.GetCode(err), err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if errors.GetCode(err) != files.ErrUncompressedTarCode {
t.Fatalf("expected error code %s, got %s (err: %v)", files.ErrUncompressedTarCode, errors.GetCode(err), err)
assert.NotNil(t, err) // to replace previous if
assert.Equal(t, files.ErrUncompressedTarCode, errors.GetCode(err))

ErrUncompressedTarCode,
errors.Critical,
[]string{fmt.Sprintf("The file '%s' appears to be an uncompressed TAR archive.", fileName)},
[]string{fmt.Sprintf("Helm expects chart archives to be compressed (e.g., .tgz or .tar.gz). Error details: %s", err.Error())},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[]string{fmt.Sprintf("Helm expects chart archives to be compressed (e.g., .tgz or .tar.gz). Error details: %s", err.Error())},
[]string{fmt.Sprintf("Expected archives to be compressed (e.g., .tgz or .tar.gz). Error details: %s", err.Error())},

errors.Critical,
[]string{fmt.Sprintf("The file '%s' appears to be an uncompressed TAR archive.", fileName)},
[]string{fmt.Sprintf("Helm expects chart archives to be compressed (e.g., .tgz or .tar.gz). Error details: %s", err.Error())},
[]string{"The archive was created as an uncompressed .tar, but Helm requires compressed archives."},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
[]string{"The archive was created as an uncompressed .tar, but Helm requires compressed archives."},
[]string{"The archive was created as an uncompressed .tar, but archives required to be compressed."},

[]string{"The archive was created as an uncompressed .tar, but Helm requires compressed archives."},
[]string{
"Compress the .tar file to .tgz or .tar.gz and try again.",
"Create the Helm chart archive using 'helm package' or gzip the archive before uploading.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Create the Helm chart archive using 'helm package' or gzip the archive before uploading.",
"If it is a Helm chart archive, create using 'helm package' or gzip the archive before uploading.",

Copy link
Contributor

@lekaf974 lekaf974 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another review after we will be good to merged

Good job

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.

[Helm] Improve import error message for unsupported uncompressed Helm .tar

4 participants