diff --git a/integration-tests/scripts/build-python.sh b/integration-tests/scripts/build-python.sh index 83d4b9530..68d9e1f50 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 + # 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. 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/ || { + echo "✗ Build failed: docker run ... pip install exited with status $?" + return 1 + } # Copy source files to package directory cp -r "$LAMBDA_DIR"/*.py "$LAMBDA_DIR/package/" 2>/dev/null || true