Skip to content

Commit 1916f08

Browse files
author
Bob Strahan
committed
• Update CHANGELOG to reflect current default value
1 parent f4a4ba7 commit 1916f08

File tree

4 files changed

+22
-9
lines changed

4 files changed

+22
-9
lines changed

CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ SPDX-License-Identifier: MIT-0
1313
- **Solution**: Enhanced CodeBuild custom resource to verify ECR image availability before completing, including:
1414
- Verification that all required Lambda images exist in ECR repository
1515
- Check that image scanning is complete (repository has `ScanOnPush: true`)
16-
- **New Parameter**: Added `EnablePattern2ECRImageScanning` parameter (default: true) to allow users to disable ECR vulnerability scanning if experiencing deployment issues
17-
- Recommended: Keep enabled (true) for production to maintain security posture
16+
- **New Parameter**: Added `EnablePattern2ECRImageScanning` parameter (current default: false) to allow users to enable/disable ECR vulnerability scanning if experiencing deployment issues
17+
- Recommended: Set enabled (true) for production to maintain security posture
1818
- Optional: Disable (false) only as temporary workaround for deployment reliability
1919

2020
## [0.4.1]

patterns/pattern-2/template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,7 @@ Resources:
327327
Action:
328328
- ecr:ListImages
329329
- ecr:BatchDeleteImage
330+
- ecr:DescribeImages
330331
Resource:
331332
- !GetAtt Pattern2ECRRepository.Arn
332333
# Used by custom resource helper poller

src/lambda/start_codebuild/index.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,18 +117,30 @@ def _verify_ecr_images_available(ecr_uri: str, image_version: str) -> bool:
117117
LOGGER.info("image %s verified (scan status: %s)", image_tag, scan_status)
118118

119119
except ClientError as error:
120-
if error.response["Error"]["Code"] == "ImageNotFoundException":
120+
error_code = error.response["Error"]["Code"]
121+
122+
# Retriable condition - image just doesn't exist yet, keep polling
123+
if error_code == "ImageNotFoundException":
121124
LOGGER.warning("image %s not found: %s", image_tag, error)
122-
return False
123-
LOGGER.error("error checking image %s: %s", image_tag, error)
124-
raise
125+
return False # Continue polling
126+
127+
# Fatal errors - permissions, validation, repository not found, etc.
128+
# Fail immediately instead of polling forever
129+
LOGGER.error(
130+
"fatal error checking image %s (error code: %s): %s",
131+
image_tag,
132+
error_code,
133+
error
134+
)
135+
raise # Fail custom resource immediately
125136

126137
LOGGER.info("all %d required images are available in ECR", len(required_images))
127138
return True
128139

129140
except Exception as exception: # pylint: disable=broad-except
130-
LOGGER.error("error verifying ECR images: %s", exception)
131-
return False
141+
# Any non-ClientError exception is unexpected and fatal
142+
LOGGER.error("unexpected fatal error verifying ECR images: %s", exception)
143+
raise # Fail custom resource immediately instead of polling forever
132144

133145

134146
@HELPER.poll_create

template.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ Parameters:
330330

331331
EnablePattern2ECRImageScanning:
332332
Type: String
333-
Default: "true"
333+
Default: "false"
334334
AllowedValues:
335335
- "true"
336336
- "false"

0 commit comments

Comments
 (0)