From 2b4691946e0c9864adbb41f5043125b74dd61e51 Mon Sep 17 00:00:00 2001 From: lym953 <10097700+lym953@users.noreply.github.com> Date: Wed, 28 Oct 2026 12:05:19 -0400 Subject: [PATCH 1/2] fix(integration-tests): fail the Python build when pip fails The build function runs in an if condition, where set -e is off, so a pip failure produced a package with only the handler file and a passing build. Co-Authored-By: Claude Opus 5.5 --- integration-tests/scripts/build-python.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/integration-tests/scripts/build-python.sh b/integration-tests/scripts/build-python.sh index 83d4b9530..18c9ab8dc 100755 --- a/integration-tests/scripts/build-python.sh +++ b/integration-tests/scripts/build-python.sh @@ -60,12 +60,18 @@ build_python_lambda() { # Install dependencies with Docker using ARM64 platform # Use the same image that CDK would use for consistency # Mount pip cache for faster package downloads - docker run --rm --platform linux/arm64 \ + # set -e is off inside a function that an if condition calls, so check + # the exit status. The package/ check below cannot see + # a pip failure, because it runs after the .py files are copied in. + if ! docker run --rm --platform linux/arm64 \ -v "$LAMBDA_DIR":/workspace \ -v "$PIP_CACHE_DIR":/root/.cache/pip \ -w /workspace \ public.ecr.aws/sam/build-python3.12 \ - pip install -r requirements.txt -t package/ + pip install -r requirements.txt -t package/; then + echo "✗ Build failed: pip install failed" + return 1 + fi # Copy source files to package directory cp -r "$LAMBDA_DIR"/*.py "$LAMBDA_DIR/package/" 2>/dev/null || true From 72f39db97d98495dd5f2fd3d6c318be015be8012 Mon Sep 17 00:00:00 2001 From: lym953 <10097700+lym953@users.noreply.github.com> Date: Wed, 4 Nov 2026 12:11:08 -0500 Subject: [PATCH 2/2] fix(integration-tests): name the docker run step in the build failure message Docker can fail before pip starts, so print the step and its exit status instead of blaming pip. Co-Authored-By: Claude Opus 5.5 --- integration-tests/scripts/build-python.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration-tests/scripts/build-python.sh b/integration-tests/scripts/build-python.sh index 18c9ab8dc..68d9e1f50 100755 --- a/integration-tests/scripts/build-python.sh +++ b/integration-tests/scripts/build-python.sh @@ -63,15 +63,15 @@ build_python_lambda() { # set -e is off inside a function that an if condition calls, so check # the exit status. The package/ check below cannot see # a pip failure, because it runs after the .py files are copied in. - if ! docker run --rm --platform linux/arm64 \ + docker run --rm --platform linux/arm64 \ -v "$LAMBDA_DIR":/workspace \ -v "$PIP_CACHE_DIR":/root/.cache/pip \ -w /workspace \ public.ecr.aws/sam/build-python3.12 \ - pip install -r requirements.txt -t package/; then - echo "✗ Build failed: pip install failed" + pip install -r requirements.txt -t package/ || { + echo "✗ Build failed: docker run ... pip install exited with status $?" return 1 - fi + } # Copy source files to package directory cp -r "$LAMBDA_DIR"/*.py "$LAMBDA_DIR/package/" 2>/dev/null || true