Skip to content

Commit

Permalink
make sure db gets destroyed, try fix stack names
Browse files Browse the repository at this point in the history
  • Loading branch information
emileten committed Feb 22, 2024
1 parent c96cb1c commit c46aaed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,16 @@ jobs:
deactivate
cd -
# we'll use that to name the stack
- name: Get branch names
id: branch-names
uses: tj-actions/branch-names@v8
# use short commit SHA to name stacks
- uses: benjlevesque/[email protected]
id: short-sha
with:
length: 6

- name: Deploy test stack
id: deploy_step
env:
PROJECT_ID: ${{ steps.branch-names.outputs.current_branch }}
PROJECT_ID: ${{ steps.short-sha.outputs.sha }}
run: |
source .deployment_venv/bin/activate
Expand All @@ -68,7 +69,7 @@ jobs:
- name: Tear down any infrastructure
if: always()
env:
PROJECT_ID: ${{ steps.branch-names.outputs.current_branch }}
PROJECT_ID: ${{ steps.short-sha.outputs.sha }}
run: |
cd integration_tests/cdk
# run this only if we find a 'cdk.out' directory, which means there might be things to tear down
Expand Down
10 changes: 6 additions & 4 deletions integration_tests/cdk/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
Stack,
aws_ec2,
aws_rds,
App
App,
RemovalPolicy
)
from constructs import Construct
from eoapi_cdk import (
Expand Down Expand Up @@ -86,7 +87,8 @@ def __init__(
subnet_type=aws_ec2.SubnetType.PUBLIC,
),
allocated_storage=app_config.db_allocated_storage,
instance_type=aws_ec2.InstanceType(app_config.db_instance_type)
instance_type=aws_ec2.InstanceType(app_config.db_instance_type),
removal_policy=RemovalPolicy.DESTROY
)

pgstac_db.db.connections.allow_default_port_from_any_ipv4()
Expand Down Expand Up @@ -136,11 +138,11 @@ def __init__(

app_config = build_app_config()

vpc_stack_id = f"{app_config.build_service_name('vpc')}".replace('/','')
vpc_stack_id = f"{app_config.project_id}vpc"

vpc_stack = VpcStack(scope=app, app_config=app_config, id=vpc_stack_id)

pgstac_infra_stack_id = f"{app_config.build_service_name('pgstac')}".replace('/','')
pgstac_infra_stack_id = f"{app_config.project_id}pgstac"

pgstac_infra_stack = pgStacInfraStack(
scope=app,
Expand Down

0 comments on commit c46aaed

Please sign in to comment.