Skip to content

fix(helm): Allow empty version for localpath chart #3815

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brandtkeller
Copy link
Member

@brandtkeller brandtkeller commented May 16, 2025

Description

chart version can be any value for localPath helm charts and this is used in the naming of the helm archive within the zarf package. This can result in confusion and inaccuracy of artifact versions were one to inspect/decompress a package.

Given that a chart name in the ZarfPackageConfig must be unique (and is enforced during create) - then allowing for version being not present should not create any collisions.

This PR makes the following assumptions:

  • localPath charts should not require a version be specified
  • return an error when expected and actual versions mismatch.

This PR helps decide on paths forward.

Related Issue

Fixes #3813

Checklist before merging

@brandtkeller brandtkeller self-assigned this May 16, 2025
@brandtkeller brandtkeller requested review from a team as code owners May 16, 2025 16:23
Copy link

netlify bot commented May 16, 2025

Deploy Preview for zarf-docs canceled.

Name Link
🔨 Latest commit bafe5e4
🔍 Latest deploy log https://app.netlify.com/projects/zarf-docs/deploys/6827845ae946d500087791ff

Copy link

codecov bot commented May 16, 2025

Codecov Report

Attention: Patch coverage is 22.22222% with 7 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/internal/packager/helm/repo.go 20.00% 3 Missing and 1 partial ⚠️
src/internal/packager/helm/common.go 0.00% 2 Missing and 1 partial ⚠️
Files with missing lines Coverage Δ
src/pkg/lint/validate.go 92.00% <100.00%> (ø)
src/internal/packager/helm/common.go 33.33% <0.00%> (-1.20%) ⬇️
src/internal/packager/helm/repo.go 23.42% <20.00%> (-0.34%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@brandtkeller brandtkeller changed the title fix(helm): pull localpath chart version from loaded chart fix(helm): Allow empty version for localpath chart May 16, 2025
if err != nil {
return err
}

if chart.Version != "" && chart.Version != loadedChart.Metadata.Version {
// this is important as deploy will use teh chart version to find the chart tarball location
return fmt.Errorf("expected chart version %s does not match the actual chart metadata version %s", chart.Version, loadedChart.Metadata.Version)
Copy link
Contributor

Choose a reason for hiding this comment

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

++ erroring here makes sense to me

@AustinAbro321
Copy link
Contributor

I agree with this change, however we must consider how this will effect packages created and deployed with different versions of Zarf. A package using localpath without a version, will not deploy on earlier versions of Zarf.

The error will be:

2025-05-22 10:49:41 ERR failed to deploy package: unable to deploy component "demo-helm-charts": open /tmp/zarf-3011270750/components/demo-helm-charts/values/podinfo-local--0: no such file or directory

I don't think we have this written down anywhere (we should write it down), but a goal with Zarf has been to not assume people have the same Zarf version for create and deploy. This change is also proposed by a comment in #2245, which will happen with #3433

Adding this for context, open to other solutions besides waiting for the next schema version

@brandtkeller
Copy link
Member Author

@AustinAbro321 superb callout and catch - I will get that note added to the draft principles document. Otherwise I fully agree that this should not be merged as-is. I will think about compatibility otherwise we may need to close this out.

@brandtkeller brandtkeller marked this pull request as draft May 22, 2025 15:51
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.

When specifying a helm chart via a localPath, the version field should not be required
3 participants