@@ -473,17 +473,16 @@ func (r *HelmChartReconciler) buildFromHelmRepository(ctx context.Context, obj *
473473 if err != nil {
474474 e := & serror.Event {
475475 Err : fmt .Errorf ("failed to get public key for chart signature verification: %w" , err ),
476- Reason : sourcev1 .AuthenticationFailedReason ,
476+ Reason : sourcev1 .VerificationFailedReason ,
477477 }
478- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e .Error ())
478+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e .Err . Error ())
479479 return sreconcile .ResultEmpty , e
480480 }
481481 opts .Keyring = keyring
482482
483483 // Build the chart
484484 ref := chart.RemoteReference {Name : obj .Spec .Chart , Version : obj .Spec .Version }
485485 build , err := cb .Build (ctx , ref , util .TempPathForObj ("" , ".tgz" , obj ), opts )
486-
487486 if err != nil {
488487 return sreconcile .ResultEmpty , err
489488 }
@@ -607,9 +606,9 @@ func (r *HelmChartReconciler) buildFromTarballArtifact(ctx context.Context, obj
607606 if err != nil {
608607 e := & serror.Event {
609608 Err : fmt .Errorf ("failed to get public key for chart signature verification: %w" , err ),
610- Reason : sourcev1 .AuthenticationFailedReason ,
609+ Reason : sourcev1 .VerificationFailedReason ,
611610 }
612- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e .Error ())
611+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e .Err . Error ())
613612 return sreconcile .ResultEmpty , e
614613 }
615614 opts .Keyring = keyring
@@ -698,10 +697,11 @@ func (r *HelmChartReconciler) reconcileArtifact(ctx context.Context, obj *source
698697 if b .ProvFilePath != "" {
699698 provArtifact := r .Storage .NewArtifactFor (obj .Kind , obj .GetObjectMeta (), b .Version , fmt .Sprintf ("%s-%s.tgz.prov" , b .Name , b .Version ))
700699 if err = r .Storage .CopyFromPath (& provArtifact , b .ProvFilePath ); err != nil {
701- return sreconcile . ResultEmpty , & serror.Event {
700+ e := & serror.Event {
702701 Err : fmt .Errorf ("unable to copy Helm chart provenance file to storage: %w" , err ),
703- Reason : sourcev1 .StorageOperationFailedCondition ,
702+ Reason : sourcev1 .ArchiveOperationFailedReason ,
704703 }
704+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e .Err .Error ())
705705 }
706706 }
707707
@@ -803,14 +803,13 @@ func (r *HelmChartReconciler) garbageCollect(ctx context.Context, obj *sourcev1.
803803 localPath := r .Storage .LocalPath (* obj .GetArtifact ())
804804 provFilePath := localPath + ".prov"
805805 dir := filepath .Dir (localPath )
806- callbacks := make ([]func (path string , info os.FileInfo ) bool , 0 )
807- callbacks = append (callbacks , func (path string , info os.FileInfo ) bool {
806+ callback := func (path string , info os.FileInfo ) bool {
808807 if path != localPath && path != provFilePath && info .Mode ()& os .ModeSymlink != os .ModeSymlink {
809808 return true
810809 }
811810 return false
812- })
813- if _ , err := r .Storage .RemoveConditionally (dir , callbacks ); err != nil {
811+ }
812+ if _ , err := r .Storage .RemoveConditionally (dir , callback ); err != nil {
814813 return & serror.Event {
815814 Err : fmt .Errorf ("garbage collection of old artifacts failed: %w" , err ),
816815 Reason : "GarbageCollectionFailed" ,
@@ -1036,11 +1035,13 @@ func observeChartBuild(obj *sourcev1.HelmChart, build *chart.Build, err error) {
10361035
10371036 if build .VerificationSignature != nil && build .ProvFilePath != "" {
10381037 var sigVerMsg strings.Builder
1039- sigVerMsg .WriteString (fmt .Sprintf ("chart signed by: %v " , strings .Join (build .VerificationSignature .Identities [:], "," )))
1040- sigVerMsg .WriteString (fmt .Sprintf (" using key with fingeprint: %X " , build .VerificationSignature .KeyFingerprint ))
1041- sigVerMsg .WriteString (fmt .Sprintf (" and hash verified: %s " , build .VerificationSignature .FileHash ))
1038+ sigVerMsg .WriteString (fmt .Sprintf ("chart signed by: '%v' " , strings .Join (build .VerificationSignature .Identities [:], "," )))
1039+ sigVerMsg .WriteString (fmt .Sprintf (" using key with fingeprint: '%X' " , build .VerificationSignature .KeyFingerprint ))
1040+ sigVerMsg .WriteString (fmt .Sprintf (" and hash verified: '%s' " , build .VerificationSignature .FileHash ))
10421041
10431042 conditions .MarkTrue (obj , sourcev1 .SourceVerifiedCondition , sourcev1 .ChartVerifiedSucceededReason , sigVerMsg .String ())
1043+ } else {
1044+ conditions .Delete (obj , sourcev1 .SourceVerifiedCondition )
10441045 }
10451046
10461047 if err != nil {
0 commit comments