@@ -4,8 +4,10 @@ set_application_name = ParameterKey=ApplicationFriendlyName,ParameterValue
44
55prod_aws_account = 298118738376
66dev_aws_account = 427040638965
7+ current_aws_account := $(shell aws sts get-caller-identity --query Account --output text)
78
89src_directory_root = src/
10+ dist_ui_directory_root = dist_ui/
911integration_test_directory_root = tests/live_integration/
1012
1113# CHANGE ME (as needed)
@@ -24,22 +26,23 @@ common_params = --no-confirm-changeset \
2426 --s3-prefix $(application_key ) \
2527 --resolve-s3
2628
29+ s3_bucket_prefix = "$(current_aws_account ) -$(region ) -$(application_key ) "
30+ ui_s3_bucket = "$(s3_bucket_prefix ) -ui"
31+
2732GIT_HASH := $(shell git rev-parse --short HEAD)
2833
29- .PHONY : build clean
34+ .PHONY : clean
3035
3136check_account_prod :
32- @aws_account_id=$$(aws sts get-caller-identity --query Account --output text ) ; \
33- if [ " $$ aws_account_id" != " $( prod_aws_account) " ]; then \
34- echo " Error: running in incorrect account $$ aws_account_id, expected account ID $( prod_aws_account) " ; \
35- exit 1; \
36- fi
37+ ifneq ($(current_aws_account ) ,$(prod_aws_account ) )
38+ $(error Error: running in account $(current_aws_account), expected account ID $(prod_aws_account))
39+ endif
40+
3741check_account_dev :
38- @aws_account_id=$$(aws sts get-caller-identity --query Account --output text ) ; \
39- if [ " $$ aws_account_id" != " $( dev_aws_account) " ]; then \
40- echo " Error: running in incorrect account $$ aws_account_id, expected account ID $( dev_aws_account) " ; \
41- exit 1; \
42- fi
42+ ifneq ($(current_aws_account ) ,$(dev_aws_account ) )
43+ $(error Error: running in account $(current_aws_account), expected account ID $(dev_aws_account))
44+ endif
45+
4346
4447clean :
4548 rm -rf .aws-sam
@@ -61,11 +64,12 @@ local:
6164 VITE_BUILD_HASH=$(GIT_HASH ) yarn run dev
6265
6366deploy_prod : check_account_prod build
64- aws sts get-caller-identity --query Account --output text
65- sam deploy $( common_params ) --parameter-overrides $( run_env ) =prod $( set_application_prefix ) = $( application_key ) $( set_application_name ) = " $( application_name ) "
67+ sam deploy $( common_params ) --parameter-overrides $( run_env ) =prod $( set_application_prefix ) = $( application_key ) $( set_application_name ) = " $( application_name ) " S3BucketPrefix= " $( s3_bucket_prefix ) "
68+ aws s3 sync $( dist_ui_directory_root ) s3:// $( ui_s3_bucket ) / --delete
6669
6770deploy_dev : check_account_dev build
68- sam deploy $(common_params ) --parameter-overrides $(run_env ) =dev $(set_application_prefix ) =$(application_key ) $(set_application_name ) =" $( application_name) "
71+ sam deploy $(common_params ) --parameter-overrides $(run_env ) =dev $(set_application_prefix ) =$(application_key ) $(set_application_name ) =" $( application_name) " S3BucketPrefix=" $( s3_bucket_prefix) "
72+ aws s3 sync $(dist_ui_directory_root ) s3://$(ui_s3_bucket ) / --delete
6973
7074install :
7175 yarn -D
@@ -86,7 +90,7 @@ test_e2e: install
8690 yarn test:e2e
8791
8892dev_health_check :
89- curl -f https://$( application_key ) .aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://manage. qa.acmuiuc.org
93+ curl -f https://core .aws.qa.acmuiuc.org/api/v1/healthz && curl -f https://core.aws. qa.acmuiuc.org/
9094
9195prod_health_check :
92- curl -f https://$( application_key ) .aws.acmuiuc.org /api/v1/healthz && curl -f https://manage .acm.illinois.edu
96+ curl -f https://core.acm.illinois.edu /api/v1/healthz && curl -f https://core .acm.illinois.edu
0 commit comments