Skip to content

Commit f4a4ba7

Browse files
author
Bob Strahan
committed
Add ECR DescribeImages permission and improve logging visibility
1 parent dfb2f56 commit f4a4ba7

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

patterns/pattern-2/template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ Resources:
209209
Effect: Allow
210210
Action:
211211
- ecr:DescribeImageScanFindings
212+
- ecr:DescribeImages
212213
- ecr:StartImageScan
213214
# Required for Amazon Inspector Enhanced Scanning
214215
# https://docs.aws.amazon.com/AmazonECR/latest/userguide/image-scanning-enhanced-iam.html

src/lambda/start_codebuild/index.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def _verify_ecr_images_available(ecr_uri: str, image_version: str) -> bool:
114114
LOGGER.info("image %s scan still in progress", image_tag)
115115
return False
116116

117-
LOGGER.debug("image %s verified (scan status: %s)", image_tag, scan_status)
117+
LOGGER.info("image %s verified (scan status: %s)", image_tag, scan_status)
118118

119119
except ClientError as error:
120120
if error.response["Error"]["Code"] == "ImageNotFoundException":
@@ -242,7 +242,7 @@ def _delete_all_ecr_images(repository_name: str) -> None:
242242
if not image_ids:
243243
continue
244244
images_to_delete.extend(image_ids)
245-
LOGGER.debug(
245+
LOGGER.info(
246246
"queued %s images for deletion from repository %s",
247247
len(image_ids),
248248
repository_name,
@@ -254,7 +254,7 @@ def _delete_all_ecr_images(repository_name: str) -> None:
254254

255255
for chunk_start in range(0, len(images_to_delete), 100):
256256
chunk = images_to_delete[chunk_start : chunk_start + 100]
257-
LOGGER.debug(
257+
LOGGER.info(
258258
"deleting %s images from repository %s",
259259
len(chunk),
260260
repository_name,

0 commit comments

Comments
 (0)