diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a7a490d..0455e7b 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -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/short-sha@v3.0 + 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 @@ -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 diff --git a/integration_tests/cdk/app.py b/integration_tests/cdk/app.py index c7dbcbe..da66306 100644 --- a/integration_tests/cdk/app.py +++ b/integration_tests/cdk/app.py @@ -3,7 +3,8 @@ Stack, aws_ec2, aws_rds, - App + App, + RemovalPolicy ) from constructs import Construct from eoapi_cdk import ( @@ -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() @@ -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"vpc{app_config.project_id}" 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"pgstac{app_config.project_id}" pgstac_infra_stack = pgStacInfraStack( scope=app, diff --git a/integration_tests/cdk/package-lock.json b/integration_tests/cdk/package-lock.json index 5fa908a..50ea4e4 100644 --- a/integration_tests/cdk/package-lock.json +++ b/integration_tests/cdk/package-lock.json @@ -12,9 +12,9 @@ } }, "node_modules/aws-cdk": { - "version": "2.128.0", - "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.128.0.tgz", - "integrity": "sha512-epOAr/0WKqmyaKqBc7N0Ky5++93pu+v6yVN9jNOa4JYkAkGbeTS3vR9bj/W0o94jnlgWevG3HNHr83jtRvw/4A==", + "version": "2.129.0", + "resolved": "https://registry.npmjs.org/aws-cdk/-/aws-cdk-2.129.0.tgz", + "integrity": "sha512-Gh/dG2aY0cvlLumYUXalg28/knVI/TrN6NZMBpRWe4gGJe/RH5JROIVB2GOEMMajkew9EiFH0ZeoC+pQ57diaQ==", "bin": { "cdk": "bin/cdk" },