From 6a8b5889f1b687fce009c4a5589b10603726c592 Mon Sep 17 00:00:00 2001 From: Hidde Beydals Date: Mon, 22 Nov 2021 22:10:31 +0100 Subject: [PATCH] controllers: absolute local path for cached chart Signed-off-by: Hidde Beydals --- controllers/helmchart_controller.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/controllers/helmchart_controller.go b/controllers/helmchart_controller.go index d6c46137a..899b5389e 100644 --- a/controllers/helmchart_controller.go +++ b/controllers/helmchart_controller.go @@ -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 { @@ -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())