@@ -24,6 +24,7 @@ import (
2424 "os"
2525 "time"
2626
27+ "github.com/docker/go-units"
2728 helmgetter "helm.sh/helm/v3/pkg/getter"
2829 corev1 "k8s.io/api/core/v1"
2930 "k8s.io/apimachinery/pkg/runtime"
@@ -425,10 +426,20 @@ func (r *HelmRepositoryReconciler) reconcileArtifact(ctx context.Context, obj *s
425426 }
426427 }
427428
429+ // Calculate the artifact size to be included in the NewArtifact event.
430+ fi , err := os .Stat (chartRepo .CachePath )
431+ if err != nil {
432+ return sreconcile .ResultEmpty , & serror.Event {
433+ Err : fmt .Errorf ("unable to read the artifact: %w" , err ),
434+ Reason : sourcev1 .StorageOperationFailedReason ,
435+ }
436+ }
437+ size := units .HumanSize (float64 (fi .Size ()))
438+
428439 r .AnnotatedEventf (obj , map [string ]string {
429440 "revision" : artifact .Revision ,
430441 "checksum" : artifact .Checksum ,
431- }, corev1 .EventTypeNormal , "NewArtifact" , "stored artifact for revision '%s'" , artifact . Revision )
442+ }, corev1 .EventTypeNormal , "NewArtifact" , "fetched index of size %s from '%s'" , size , chartRepo . URL )
432443
433444 // Record it on the object.
434445 obj .Status .Artifact = artifact .DeepCopy ()
0 commit comments