Skip to content

Commit d3d0a33

Browse files
committed
Migrate CodePipeline deployment to UV
- Install UV in CodeBuild environment - Replace 'pip install -e .' with 'uv sync --no-dev' - Use uv sync for lock-file based reproducible builds - Add UV version check for early failure detection - Update deployment message to indicate UV-based deployment
1 parent b173e95 commit d3d0a33

File tree

32 files changed

+490
-87
lines changed

32 files changed

+490
-87
lines changed

Dockerfile.optimized

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ COPY lib/idp_common_pkg /build/lib/idp_common_pkg
2424
# Install dependencies from the specified dependency group
2525
RUN --mount=type=cache,target=/root/.cache/uv \
2626
if [ -n "$DEPENDENCY_GROUP" ]; then \
27-
uv pip install --python python3.12 --target /opt/python "/build[${DEPENDENCY_GROUP}]"; \
27+
uv pip install --python python3.12 --project /build --group "$DEPENDENCY_GROUP" --target /opt/python; \
2828
else \
2929
echo "ERROR: DEPENDENCY_GROUP not specified" && exit 1; \
3030
fi
@@ -43,4 +43,4 @@ COPY ${FUNCTION_PATH}/*.py ${LAMBDA_TASK_ROOT}/
4343
ENV PYTHONPATH=/opt/python:${LAMBDA_TASK_ROOT}
4444

4545
# Set handler
46-
CMD ["index.handler"]
46+
CMD ["index.handler"]

lib/idp_common_pkg/clean_build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ rm -rf *.egg-info/
88
find . -name "__pycache__" -type d -exec rm -rf {} +
99
find . -name "*.pyc" -delete
1010

11-
echo "Building package..."
12-
pip install -e .
11+
echo "Syncing package with UV..."
12+
cd ../.. && uv sync --all-extras --group dev
1313

1414
echo "Done!"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Makefile for BDAProjectLambda
2+
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3+
PROJECT_ROOT := $(abspath $(MAKEFILE_DIR)/../../../../)
4+
5+
build-BDAProjectLambda:
6+
uv pip install --target "$(ARTIFACTS_DIR)" --python 3.12 --project "$(PROJECT_ROOT)" --group lambda-bda-project
7+
cp *.py "$(ARTIFACTS_DIR)/"
8+
rm -rf "$(ARTIFACTS_DIR)"/__pycache__
9+
10+
.PHONY: build-BDAProjectLambda

options/bda-lending-project/src/bda_project_lambda/requirements.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

options/bda-lending-project/template.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ Resources:
8686
BDAProjectLambda:
8787
Type: AWS::Serverless::Function
8888
Metadata:
89+
BuildMethod: makefile
8990
cfn_nag:
9091
rules_to_suppress:
9192
- id: W89
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Makefile for CreateOSSIndexLambdaFunction
2+
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3+
PROJECT_ROOT := $(abspath $(MAKEFILE_DIR)/../../../../)
4+
5+
build-CreateOSSIndexLambdaFunction:
6+
uv pip install --target "$(ARTIFACTS_DIR)" --python 3.12 --project "$(PROJECT_ROOT)" --group lambda-kb-opensearch
7+
cp *.py "$(ARTIFACTS_DIR)/"
8+
rm -rf "$(ARTIFACTS_DIR)"/__pycache__
9+
10+
.PHONY: build-CreateOSSIndexLambdaFunction

options/bedrockkb/src/opensearch_index_custom_resource/requirements.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Makefile for S3VectorManagerFunction
2+
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3+
PROJECT_ROOT := $(abspath $(MAKEFILE_DIR)/../../../../)
4+
5+
build-S3VectorManagerFunction:
6+
uv pip install --target "$(ARTIFACTS_DIR)" --python 3.12 --project "$(PROJECT_ROOT)" --group lambda-kb-s3-vectors
7+
cp *.py "$(ARTIFACTS_DIR)/"
8+
rm -rf "$(ARTIFACTS_DIR)"/__pycache__
9+
10+
.PHONY: build-S3VectorManagerFunction

options/bedrockkb/src/s3_vectors_manager/requirements.txt

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Makefile for StartIngestionJobFunction
2+
MAKEFILE_DIR := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
3+
PROJECT_ROOT := $(abspath $(MAKEFILE_DIR)/../../../../)
4+
5+
build-StartIngestionJobFunction:
6+
uv pip install --target "$(ARTIFACTS_DIR)" --python 3.12 --project "$(PROJECT_ROOT)" --group lambda-kb-ingestion
7+
cp *.py "$(ARTIFACTS_DIR)/"
8+
rm -rf "$(ARTIFACTS_DIR)"/__pycache__
9+
10+
.PHONY: build-StartIngestionJobFunction

0 commit comments

Comments
 (0)