Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/cdk-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: CDK Deploy

on:
push:
branches:
- main
paths:
- 'cdk/**'
pull_request:
branches:
- main
paths:
- 'cdk/**'
workflow_dispatch:

permissions:
id-token: write
contents: read

jobs:
cdk-deploy:
runs-on: ubuntu-latest
defaults:
run:
working-directory: cdk

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: 'cdk/requirements*.txt'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install CDK CLI
run: npm install -g aws-cdk

- name: Install Python dependencies
run: pip install -r requirements.txt

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION || 'us-east-1' }}

- name: CDK Synth
run: cdk synth

- name: CDK Diff
if: github.event_name == 'pull_request'
run: cdk diff

- name: CDK Deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: cdk deploy --all --require-approval never
6 changes: 3 additions & 3 deletions cdk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

import aws_cdk as cdk

from cdk.cdk.ecr_stack import EcrStack
from cdk.cdk.ecs_stack import EcsStack
from cdk.cdk.lambda_stack import LambdaStack
from cdk.ecr_stack import EcrStack
from cdk.ecs_stack import EcsStack
from cdk.lambda_stack import LambdaStack

app = cdk.App()

Expand Down
4 changes: 2 additions & 2 deletions cdk/cdk/ecs_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
aws_ecr as ecr,
)

from config import Config
from cdk.config import Config
from constructs import Construct

class EcsStack(Stack):
Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(self, scope: Construct, construct_id: str, ecr_repository: ecr.IRep

vpc.add_interface_endpoint(
"ECRApiEndpoint",
service=ec2.InterfaceVpcEndpointAwsService.ECR_API,
service=ec2.InterfaceVpcEndpointAwsService.ECR,
security_groups=[endpoint_security_group]
)

Expand Down
4 changes: 2 additions & 2 deletions cdk/cdk/lambda_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Duration
)

from config import Config
from cdk.config import Config
from constructs import Construct

class LambdaStack(Stack):
Expand All @@ -29,7 +29,7 @@ def __init__(self, scope: Construct, construct_id: str,
self, "DistributedPathTracerFunction",
function_name="DistributedPathTracerFunction",
architecture=_lambda.Architecture.X86_64,
code=_lambda.EcrImageCode.from_ecr(ecr_repository, tag_or_digest="preprocessor-latest"),
code=_lambda.EcrImageCode.from_ecr_image(ecr_repository, tag_or_digest="preprocessor-latest"),
handler=_lambda.Handler.FROM_IMAGE,
runtime=_lambda.Runtime.FROM_IMAGE,
memory_size=1024,
Expand Down