Skip to content
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

controllers: absolute local path for cached chart #500

Merged
merged 1 commit into from
Nov 23, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions controllers/helmchart_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,19 +327,17 @@ func (r *HelmChartReconciler) fromHelmRepository(ctx context.Context, repo sourc
}
}

var cachedChart string
if artifact := c.GetArtifact(); artifact != nil {
cachedChart = artifact.Path
}

// Build the chart
cb := chart.NewRemoteBuilder(chartRepo)
ref := chart.RemoteReference{Name: c.Spec.Chart, Version: c.Spec.Version}
opts := chart.BuildOptions{
ValuesFiles: c.GetValuesFiles(),
CachedChart: cachedChart,
Force: force,
}
if artifact := c.GetArtifact(); artifact != nil {
opts.CachedChart = r.Storage.LocalPath(*artifact)
}

// Set the VersionMetadata to the object's Generation if ValuesFiles is defined
// This ensures changes can be noticed by the Artifact consumer
if len(opts.GetValuesFiles()) > 0 {
Expand All @@ -355,7 +353,7 @@ func (r *HelmChartReconciler) fromHelmRepository(ctx context.Context, repo sourc

// If the path of the returned build equals the cache path,
// there are no changes to the chart
if b.Path == cachedChart {
if b.Path == opts.CachedChart {
// Ensure hostname is updated
if c.GetArtifact().URL != newArtifact.URL {
r.Storage.SetArtifactURL(c.GetArtifact())
Expand Down