@@ -102,6 +102,14 @@ var ociRepositoryFailConditions = []string{
102
102
sourcev1 .StorageOperationFailedCondition ,
103
103
}
104
104
105
+ type invalidOCIURLError struct {
106
+ err error
107
+ }
108
+
109
+ func (e invalidOCIURLError ) Error () string {
110
+ return e .err .Error ()
111
+ }
112
+
105
113
// ociRepositoryReconcileFunc is the function type for all the v1beta2.OCIRepository
106
114
// (sub)reconcile functions. The type implementations are grouped and
107
115
// executed serially to perform the complete reconcile of the object.
@@ -337,9 +345,16 @@ func (r *OCIRepositoryReconciler) reconcileSource(ctx context.Context, obj *sour
337
345
// Determine which artifact revision to pull
338
346
url , err := r .getArtifactURL (obj , options )
339
347
if err != nil {
348
+ if _ , ok := err .(invalidOCIURLError ); ok {
349
+ e := serror .NewStalling (
350
+ fmt .Errorf ("failed to determine the artifact address for '%s': %w" , obj .Spec .URL , err ),
351
+ sourcev1 .URLInvalidReason )
352
+ return sreconcile .ResultEmpty , e
353
+ }
354
+
340
355
e := serror .NewGeneric (
341
- fmt .Errorf ("failed to determine the artifact address for '%s': %w" , obj .Spec .URL , err ),
342
- sourcev1 .URLInvalidReason )
356
+ fmt .Errorf ("failed to determine the artifact tag for '%s': %w" , obj .Spec .URL , err ),
357
+ sourcev1 .OCIOperationFailedReason )
343
358
conditions .MarkTrue (obj , sourcev1 .FetchFailedCondition , e .Reason , e .Err .Error ())
344
359
return sreconcile .ResultEmpty , e
345
360
}
@@ -464,7 +479,7 @@ func (r *OCIRepositoryReconciler) parseRepositoryURL(obj *sourcev1.OCIRepository
464
479
func (r * OCIRepositoryReconciler ) getArtifactURL (obj * sourcev1.OCIRepository , options []crane.Option ) (string , error ) {
465
480
url , err := r .parseRepositoryURL (obj )
466
481
if err != nil {
467
- return "" , err
482
+ return "" , invalidOCIURLError { err }
468
483
}
469
484
470
485
if obj .Spec .Reference != nil {
0 commit comments