Skip to content
This repository was archived by the owner on Mar 27, 2023. It is now read-only.

Commit c86cf9a

Browse files
committed
refactored cdk.yml
1 parent c940f27 commit c86cf9a

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

gitlab-ci/aws/cdk.yml

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# This template uses AWS CDK and AWS CLI to make infrastrcutre updates
22
# and to deploy changes to the frontend and backend
33

4+
workflow:
5+
rules:
6+
- if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "master"'
7+
when: always
8+
49
variables:
510
ENVIRONMENT: dev
611

@@ -60,39 +65,29 @@ cdk deploy:
6065
Name=tag:StackName,Values=${ENVIRONMENT}-${APP_NAME} \
6166
Name=tag:aws-cdk:subnet-type,Values=Public \
6267
| jq -r '.Subnets | map(.SubnetId) | join(",")')
63-
64-
collectstatic:
65-
<<: *task
6668
script:
6769
- |
6870
aws ecs run-task \
6971
--cluster ${ENVIRONMENT}-${APP_NAME}-cluster \
70-
--task-definition ${ENVIRONMENT}-${APP_NAME}-collectstatic \
72+
--task-definition ${ENVIRONMENT}-${APP_NAME}-${TASK_SUFFIX} \
7173
--network-configuration "awsvpcConfiguration={subnets=[${subnets}],assignPublicIp=ENABLED}" \
7274
--count 1 \
7375
--launch-type FARGATE
7476
77+
collectstatic:
78+
<<: *task
79+
variables:
80+
TASK_SUFFIX: collectstatic
81+
7582
migrate:
7683
<<: *task
77-
script:
78-
- |
79-
aws ecs run-task \
80-
--cluster ${ENVIRONMENT}-${APP_NAME}-cluster \
81-
--task-definition ${ENVIRONMENT}-${APP_NAME}-migrate \
82-
--network-configuration "awsvpcConfiguration={subnets=[${subnets}],assignPublicIp=ENABLED}" \
83-
--count 1 \
84-
--launch-type FARGATE
84+
variables:
85+
TASK_SUFFIX: migrate
8586

8687
createsuperuser:
8788
<<: *task
88-
script:
89-
- |
90-
aws ecs run-task \
91-
--cluster ${ENVIRONMENT}-${APP_NAME}-cluster \
92-
--task-definition ${ENVIRONMENT}-${APP_NAME}-create-superuser \
93-
--network-configuration "awsvpcConfiguration={subnets=[${subnets}],assignPublicIp=ENABLED}" \
94-
--count 1 \
95-
--launch-type FARGATE
89+
variables:
90+
TASK_SUFFIX: create-superuser
9691

9792
cdk destroy:
9893
image: python:3.8

0 commit comments

Comments
 (0)