Skip to content

Commit

Permalink
Avoid NPE if ECR list imagese returns images without tags before images
Browse files Browse the repository at this point in the history
with tags
  • Loading branch information
brtrvn committed Dec 14, 2023
1 parent e7f14f6 commit 67ef35a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1181,7 +1181,7 @@ public SQSBatchResponse processValidateOnboardingQueue(SQSEvent event, Context c
Map<String, Object> service = (Map<String, Object>) serviceConfig.getValue();
Map<String, Object> serviceCompute = (Map<String, Object>) 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
Expand All @@ -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;
}
Expand Down

0 comments on commit 67ef35a

Please sign in to comment.