Skip to content

Commit 87bc4ab

Browse files
committed
controllers: store HelmChart Artifact with suffix
This adds a Unix suffix to the HelmChart Artifact filename, to ensure it is unique for sequential builds triggered due to e.g. a controller restart. The result of this is that consumers who _think_ they are fetching an artifact with a certain checksum run into a 404 when attempting to download a previously advertised but now unavailable file, instead of running into a checksum validation error (due to non-repetitive Helm builds). For more information, see: #610 Signed-off-by: Hidde Beydals <[email protected]>
1 parent 02c8fba commit 87bc4ab

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

controllers/helmchart_controller.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -626,11 +626,11 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, obj *source
626626
}()
627627

628628
// Create artifact from build data
629-
artifact := r.Storage.NewArtifactFor(obj.Kind, obj.GetObjectMeta(), b.Version, fmt.Sprintf("%s-%s.tgz", b.Name, b.Version))
629+
artifact := r.Storage.NewArtifactFor(obj.Kind, obj.GetObjectMeta(), b.Version, fmt.Sprintf("%s-%s-%d.tgz", b.Name, b.Version, time.Now().Unix()))
630630

631631
// Return early if the build path equals the current artifact path
632632
if curArtifact := obj.GetArtifact(); curArtifact != nil && r.Storage.LocalPath(*curArtifact) == b.Path {
633-
ctrl.LoggerFrom(ctx).Info("artifact up-to-date", "revision", artifact.Revision)
633+
ctrl.LoggerFrom(ctx).Info("artifact up-to-date", "revision", curArtifact.Revision)
634634
return sreconcile.ResultSuccess, nil
635635
}
636636

0 commit comments

Comments
 (0)