@@ -24,6 +24,7 @@ import (
24
24
"os"
25
25
"time"
26
26
27
+ "github.com/docker/go-units"
27
28
helmgetter "helm.sh/helm/v3/pkg/getter"
28
29
corev1 "k8s.io/api/core/v1"
29
30
"k8s.io/apimachinery/pkg/runtime"
@@ -425,10 +426,20 @@ func (r *HelmRepositoryReconciler) reconcileArtifact(ctx context.Context, obj *s
425
426
}
426
427
}
427
428
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
+
428
439
r .AnnotatedEventf (obj , map [string ]string {
429
440
"revision" : artifact .Revision ,
430
441
"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 )
432
443
433
444
// Record it on the object.
434
445
obj .Status .Artifact = artifact .DeepCopy ()
0 commit comments