fix(ec2): align catalog image owner filtering (#3463)

* fix(ec2): align catalog image owner filtering

* fix(ec2): preserve catalog aliases in image filters

* test(ec2): pin supported image owner selectors
This commit is contained in:
Franklin G. Mendoza authored and GitHub committed 2026-09-12 23:28:52 -05:00
1 parent 505b5d286e
commit a6f1751dfb
2 files changed
+38 -1

No files matched your search

@@ -4546,9 +4546,13 @@ public class Ec2Service implements ContainerTeardown, ResourceProvider {
List<Image> catalogImages = imageCatalog.images().stream()
.filter(Ec2ImageCatalog.CatalogImage::advertised)
.filter(img -> img.matchesIdOrAlias(imageIds))
.filter(img -> img.matchesOwner(owners))
// Catalog aliases (for example ami-amazonlinux2) are a Floci compatibility layer,
// so catalog filters must run before toImage() discards idsAndAliases(). Owner
// matching still runs on the materialized image so AWS aliases such as amazon/self
// are resolved against the real owner account id consistently with registered images.
.filter(img -> matchesImageFilters(img, filters))
.map(Ec2ImageCatalog.CatalogImage::toImage)
.filter(img -> matchesImageOwners(img, owners))
.collect(Collectors.toList());
List<Image> createdImages = registeredImages.scan(k -> true).stream()
.filter(img -> region.equals(img.getRegion()))