@@ -279,7 +279,7 @@ func (r *GitRepositoryReconciler) reconcile(ctx context.Context, sp *patch.Seria
279
279
fmt .Errorf ("failed to create temporary working directory: %w" , err ),
280
280
sourcev1 .DirCreationFailedReason ,
281
281
)
282
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
282
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
283
283
return sreconcile .ResultEmpty , e
284
284
}
285
285
defer func () {
@@ -486,7 +486,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
486
486
fmt .Errorf ("failed to configure proxy options: %w" , err ),
487
487
sourcev1 .AuthenticationFailedReason ,
488
488
)
489
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e . Err . Error () )
489
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
490
490
// Return error as the world as observed may change
491
491
return sreconcile .ResultEmpty , e
492
492
}
@@ -498,7 +498,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
498
498
fmt .Errorf ("failed to parse url '%s': %w" , obj .Spec .URL , err ),
499
499
sourcev1 .URLInvalidReason ,
500
500
)
501
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e . Err . Error () )
501
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
502
502
return sreconcile .ResultEmpty , e
503
503
}
504
504
@@ -508,7 +508,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
508
508
fmt .Errorf ("failed to configure authentication options: %w" , err ),
509
509
sourcev1 .AuthenticationFailedReason ,
510
510
)
511
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e . Err . Error () )
511
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
512
512
// Return error as the world as observed may change
513
513
return sreconcile .ResultEmpty , e
514
514
}
@@ -523,7 +523,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
523
523
if artifacts .Diff (obj .Status .IncludedArtifacts ) {
524
524
message := "included artifacts differ from last observed includes"
525
525
if obj .Status .IncludedArtifacts != nil {
526
- conditions .MarkTrue (obj , sourcev1 .ArtifactOutdatedCondition , "IncludeChange" , message )
526
+ conditions .MarkTrue (obj , sourcev1 .ArtifactOutdatedCondition , "IncludeChange" , "%s" , message )
527
527
}
528
528
rreconcile .ProgressiveStatus (true , obj , meta .ProgressingReason , "building artifact: %s" , message )
529
529
if err := sp .Patch (ctx , obj , r .patchOptions ... ); err != nil {
@@ -544,7 +544,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
544
544
fmt .Errorf ("git repository is empty" ),
545
545
"EmptyGitRepository" ,
546
546
)
547
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e . Err . Error () )
547
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
548
548
return sreconcile .ResultEmpty , e
549
549
}
550
550
// Assign the commit to the shared commit reference.
@@ -597,7 +597,7 @@ func (r *GitRepositoryReconciler) reconcileSource(ctx context.Context, sp *patch
597
597
if ! obj .GetArtifact ().HasRevision (commitReference (obj , commit )) {
598
598
message := fmt .Sprintf ("new upstream revision '%s'" , commitReference (obj , commit ))
599
599
if obj .GetArtifact () != nil {
600
- conditions .MarkTrue (obj , sourcev1 .ArtifactOutdatedCondition , "NewRevision" , message )
600
+ conditions .MarkTrue (obj , sourcev1 .ArtifactOutdatedCondition , "NewRevision" , "%s" , message )
601
601
}
602
602
rreconcile .ProgressiveStatus (true , obj , meta .ProgressingReason , "building artifact: %s" , message )
603
603
if err := sp .Patch (ctx , obj , r .patchOptions ... ); err != nil {
@@ -703,14 +703,14 @@ func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context, sp *pat
703
703
fmt .Errorf ("failed to stat target artifact path: %w" , err ),
704
704
sourcev1 .StatOperationFailedReason ,
705
705
)
706
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
706
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
707
707
return sreconcile .ResultEmpty , e
708
708
} else if ! f .IsDir () {
709
709
e := serror .NewGeneric (
710
710
fmt .Errorf ("invalid target path: '%s' is not a directory" , dir ),
711
711
sourcev1 .InvalidPathReason ,
712
712
)
713
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
713
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
714
714
return sreconcile .ResultEmpty , e
715
715
}
716
716
@@ -720,7 +720,7 @@ func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context, sp *pat
720
720
fmt .Errorf ("failed to create artifact directory: %w" , err ),
721
721
sourcev1 .DirCreationFailedReason ,
722
722
)
723
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
723
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
724
724
return sreconcile .ResultEmpty , e
725
725
}
726
726
unlock , err := r .Storage .Lock (artifact )
@@ -751,7 +751,7 @@ func (r *GitRepositoryReconciler) reconcileArtifact(ctx context.Context, sp *pat
751
751
fmt .Errorf ("unable to archive artifact to storage: %w" , err ),
752
752
sourcev1 .ArchiveOperationFailedReason ,
753
753
)
754
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
754
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
755
755
return sreconcile .ResultEmpty , e
756
756
}
757
757
@@ -800,7 +800,7 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, sp *patc
800
800
fmt .Errorf ("path calculation for include '%s' failed: %w" , incl .GitRepositoryRef .Name , err ),
801
801
"IllegalPath" ,
802
802
)
803
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
803
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
804
804
return sreconcile .ResultEmpty , e
805
805
}
806
806
@@ -821,7 +821,7 @@ func (r *GitRepositoryReconciler) reconcileInclude(ctx context.Context, sp *patc
821
821
fmt .Errorf ("failed to copy '%s' include from %s to %s: %w" , incl .GitRepositoryRef .Name , incl .GetFromPath (), incl .GetToPath (), err ),
822
822
"CopyFailure" ,
823
823
)
824
- conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , e . Err . Error () )
824
+ conditions .MarkTrue (obj , sourcev1 .StorageOperationFailedCondition , e .Reason , "%s" , e )
825
825
return sreconcile .ResultEmpty , e
826
826
}
827
827
}
@@ -872,7 +872,7 @@ func (r *GitRepositoryReconciler) gitCheckout(ctx context.Context, obj *sourcev1
872
872
fmt .Errorf ("failed to create Git client: %w" , err ),
873
873
sourcev1 .GitOperationFailedReason ,
874
874
)
875
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e . Err . Error () )
875
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
876
876
return nil , e
877
877
}
878
878
defer gitReader .Close ()
@@ -883,7 +883,7 @@ func (r *GitRepositoryReconciler) gitCheckout(ctx context.Context, obj *sourcev1
883
883
fmt .Errorf ("failed to checkout and determine revision: %w" , err ),
884
884
sourcev1 .GitOperationFailedReason ,
885
885
)
886
- conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e . Err . Error () )
886
+ conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , "%s" , e )
887
887
return nil , e
888
888
}
889
889
@@ -902,7 +902,7 @@ func (r *GitRepositoryReconciler) fetchIncludes(ctx context.Context, obj *source
902
902
"NotFound" ,
903
903
)
904
904
e .RequeueAfter = r .requeueDependency
905
- conditions .MarkTrue (obj , sourcev1 .IncludeUnavailableCondition , e .Reason , e . Err . Error () )
905
+ conditions .MarkTrue (obj , sourcev1 .IncludeUnavailableCondition , e .Reason , "%s" , e )
906
906
return nil , e
907
907
}
908
908
@@ -913,7 +913,7 @@ func (r *GitRepositoryReconciler) fetchIncludes(ctx context.Context, obj *source
913
913
"NoArtifact" ,
914
914
)
915
915
e .RequeueAfter = r .requeueDependency
916
- conditions .MarkTrue (obj , sourcev1 .IncludeUnavailableCondition , e .Reason , e . Err . Error () )
916
+ conditions .MarkTrue (obj , sourcev1 .IncludeUnavailableCondition , e .Reason , "%s" , e )
917
917
return nil , e
918
918
}
919
919
@@ -953,7 +953,7 @@ func (r *GitRepositoryReconciler) verifySignature(ctx context.Context, obj *sour
953
953
fmt .Errorf ("PGP public keys secret error: %w" , err ),
954
954
"VerificationError" ,
955
955
)
956
- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e . Err . Error () )
956
+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , "%s" , e )
957
957
return sreconcile .ResultEmpty , e
958
958
}
959
959
@@ -974,7 +974,7 @@ func (r *GitRepositoryReconciler) verifySignature(ctx context.Context, obj *sour
974
974
errors .New ("cannot verify tag object's signature if a tag reference is not specified" ),
975
975
"InvalidVerificationMode" ,
976
976
)
977
- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , err .Reason , err . Err . Error () )
977
+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , err .Reason , "%s" , err )
978
978
return sreconcile .ResultEmpty , err
979
979
}
980
980
if ! git .IsSignedTag (* tag ) {
@@ -985,7 +985,7 @@ func (r *GitRepositoryReconciler) verifySignature(ctx context.Context, obj *sour
985
985
fmt .Errorf ("cannot verify signature of tag '%s' since it is not signed" , commit .ReferencingTag .String ()),
986
986
"InvalidGitObject" ,
987
987
)
988
- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , err .Reason , err . Err . Error () )
988
+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , err .Reason , "%s" , err )
989
989
return sreconcile .ResultEmpty , err
990
990
}
991
991
@@ -996,7 +996,7 @@ func (r *GitRepositoryReconciler) verifySignature(ctx context.Context, obj *sour
996
996
fmt .Errorf ("signature verification of tag '%s' failed: %w" , tag .String (), err ),
997
997
"InvalidTagSignature" ,
998
998
)
999
- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e . Err . Error () )
999
+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , "%s" , e )
1000
1000
// Return error in the hope the secret changes
1001
1001
return sreconcile .ResultEmpty , e
1002
1002
}
@@ -1012,7 +1012,7 @@ func (r *GitRepositoryReconciler) verifySignature(ctx context.Context, obj *sour
1012
1012
fmt .Errorf ("signature verification of commit '%s' failed: %w" , commit .Hash .String (), err ),
1013
1013
"InvalidCommitSignature" ,
1014
1014
)
1015
- conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , e . Err . Error () )
1015
+ conditions .MarkFalse (obj , sourcev1 .SourceVerifiedCondition , e .Reason , "%s" , e )
1016
1016
// Return error in the hope the secret changes
1017
1017
return sreconcile .ResultEmpty , e
1018
1018
}
@@ -1027,7 +1027,7 @@ func (r *GitRepositoryReconciler) verifySignature(ctx context.Context, obj *sour
1027
1027
reason := meta .SucceededReason
1028
1028
mode := obj .Spec .Verification .GetMode ()
1029
1029
obj .Status .SourceVerificationMode = & mode
1030
- conditions .MarkTrue (obj , sourcev1 .SourceVerifiedCondition , reason , message .String ())
1030
+ conditions .MarkTrue (obj , sourcev1 .SourceVerifiedCondition , reason , "%s" , message .String ())
1031
1031
r .eventLogf (ctx , obj , eventv1 .EventTypeTrace , reason , message .String ())
1032
1032
return sreconcile .ResultSuccess , nil
1033
1033
}
0 commit comments