@@ -451,19 +451,16 @@ func (service *BaseService) SyncRepo(ctx context.Context, repo string) error {
451
451
}
452
452
453
453
// shouldIncludePlatform determines if a platform should be included in the sync
454
- // based on the configured platforms or architectures
454
+ // based on the configured platforms
455
455
func (service * BaseService ) shouldIncludePlatform (platform * ispec.Platform ) bool {
456
456
// Get platform specifications from the configuration
457
457
var platformSpecs []string
458
458
459
459
// Check if we have platform specifications
460
460
if len (service .config .Platforms ) > 0 {
461
461
platformSpecs = service .config .Platforms
462
- } else if len (service .config .Architectures ) > 0 {
463
- // Fall back to architectures for backward compatibility
464
- platformSpecs = service .config .Architectures
465
462
} else {
466
- // If no platforms or architectures are configured, include all
463
+ // If no platforms are configured, include all
467
464
return true
468
465
}
469
466
@@ -503,30 +500,15 @@ func (service *BaseService) shouldIncludePlatform(platform *ispec.Platform) bool
503
500
}
504
501
505
502
// shouldIncludeArchitecture determines if an architecture should be included in the sync
506
- // based on the configured architectures (if any)
507
503
// DEPRECATED: Use shouldIncludePlatform instead
508
504
func (service * BaseService ) shouldIncludeArchitecture (arch string ) bool {
509
- // If no architectures are configured, include all architectures
510
- if len (service .config .Architectures ) > 0 && len (service .config .Platforms ) == 0 {
511
- // Check if the architecture is in the configured list
512
- for _ , configArch := range service .config .Architectures {
513
- if configArch == arch {
514
- return true
515
- }
516
- }
517
- return false
518
- }
519
-
520
- // When using the Platforms field, we need a different check
521
- if len (service .config .Platforms ) > 0 {
522
- platform := & ispec.Platform {
523
- Architecture : arch ,
524
- }
525
- return service .shouldIncludePlatform (platform )
505
+ // Create a platform with just the architecture field
506
+ platform := & ispec.Platform {
507
+ Architecture : arch ,
526
508
}
527
509
528
- // No filters configured, include all
529
- return true
510
+ // Use the platform-based filtering method
511
+ return service . shouldIncludePlatform ( platform )
530
512
}
531
513
532
514
func (service * BaseService ) syncRef (ctx context.Context , localRepo string , remoteImageRef , localImageRef ref.Ref ,
@@ -558,11 +540,6 @@ func (service *BaseService) syncRef(ctx context.Context, localRepo string, remot
558
540
Strs ("platforms" , service .config .Platforms ).
559
541
Str ("image" , remoteImageRef .CommonName ()).
560
542
Msg ("filtering platforms during sync" )
561
- } else if len (service .config .Architectures ) > 0 {
562
- service .log .Info ().
563
- Strs ("architectures" , service .config .Architectures ).
564
- Str ("image" , remoteImageRef .CommonName ()).
565
- Msg ("filtering architectures during sync (deprecated)" )
566
543
}
567
544
568
545
// check if image is already synced
@@ -577,8 +554,8 @@ func (service *BaseService) syncRef(ctx context.Context, localRepo string, remot
577
554
service .log .Info ().Str ("remote image" , remoteImageRef .CommonName ()).
578
555
Str ("local image" , fmt .Sprintf ("%s:%s" , localRepo , remoteImageRef .Tag )).Msg ("syncing image" )
579
556
580
- // When architectures are specified, we need to filter the manifest list
581
- if len (service .config .Architectures ) > 0 {
557
+ // When platforms are specified, we need to filter the manifest list
558
+ if len (service .config .Platforms ) > 0 {
582
559
// Get the manifest to check if it's a manifest list
583
560
man , err := service .rc .ManifestGet (ctx , remoteImageRef )
584
561
if err != nil {
@@ -593,7 +570,7 @@ func (service *BaseService) syncRef(ctx context.Context, localRepo string, remot
593
570
if isIndexer {
594
571
service .log .Info ().
595
572
Str ("remote image" , remoteImageRef .CommonName ()).
596
- Msg ("filtering architectures for multi-arch image" )
573
+ Msg ("filtering platforms for multi-arch image" )
597
574
598
575
// Use ImageCopy with the architecture filtering options
599
576
err = service .rc .ImageCopy (ctx , remoteImageRef , localImageRef , copyOpts ... )
0 commit comments