From 67ef35a23945d4461fa05b8dc47529b1bda9e635 Mon Sep 17 00:00:00 2001 From: brtrvn Date: Wed, 13 Dec 2023 17:12:09 -0800 Subject: [PATCH] Avoid NPE if ECR list imagese returns images without tags before images with tags --- .../aws/partners/saasfactory/saasboost/OnboardingService.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java b/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java index afd0a347..ac91bb4c 100644 --- a/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java +++ b/services/onboarding-service/src/main/java/com/amazon/aws/partners/saasfactory/saasboost/OnboardingService.java @@ -1181,7 +1181,7 @@ public SQSBatchResponse processValidateOnboardingQueue(SQSEvent event, Context c Map service = (Map) serviceConfig.getValue(); Map serviceCompute = (Map) service.get("compute"); String ecrRepo = (String) serviceCompute.get("containerRepo"); - String imageTag = (String) serviceCompute.get("containerTag"); + String imageTag = (String) serviceCompute.getOrDefault("containerTag", "latest"); if (Utils.isNotBlank(ecrRepo)) { try { ListImagesResponse dockerImages = ecr.listImages(request -> request @@ -1190,7 +1190,7 @@ public SQSBatchResponse processValidateOnboardingQueue(SQSEvent event, Context c // ListImagesResponse::hasImageIds will return true if the imageIds object is not null if (dockerImages.hasImageIds()) { for (ImageIdentifier image : dockerImages.imageIds()) { - if (image.imageTag().equals(imageTag)) { + if (imageTag.equals(image.imageTag())) { imageAvailable = true; break; }