File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,9 @@ source $ROOT/dev/config/env.sh
2424source $ROOT /dev/util.sh
2525
2626GCR_HOST=${GCR_HOST:- " gcr.io" }
27+ GCP_PROJECT_ID=${GCP_PROJECT_ID:- }
28+ AWS_ACCOUNT_ID=${AWS_ACCOUNT_ID:- }
29+ AWS_REGION=${AWS_REGION:- }
2730
2831provider=" local"
2932include_slim=" false"
@@ -182,6 +185,22 @@ function cleanup_ecr() {
182185 done
183186}
184187
188+ function validate_env() {
189+ local provider=$1
190+
191+ if [ " $provider " = " aws" ]; then
192+ if [ -z ${AWS_REGION} ] || [ -z ${AWS_ACCOUNT_ID} ]; then
193+ echo " error: environment variables AWS_REGION and AWS_ACCOUNT_ID should be exported in dev/config/env.sh"
194+ exit 1
195+ fi
196+ elif [ " $provider " = " gcp" ]; then
197+ if [ -z ${GCP_PROJECT_ID} ]; then
198+ echo " error: environment variables GCP_PROJECT_ID should be exported in dev/config/env.sh"
199+ exit 1
200+ fi
201+ fi
202+ }
203+
185204# export functions for parallel command
186205export -f build_and_push
187206export -f push
@@ -190,6 +209,9 @@ export -f blue_echo
190209export -f green_echo
191210export -f registry_login
192211
212+ # validate environment is correctly set on env.sh
213+ validate_env " $provider "
214+
193215# usage: registry.sh clean --provider aws|gcp|local
194216if [ " $cmd " = " clean" ]; then
195217 if [ " $provider " = " aws" ]; then
You can’t perform that action at this time.
0 commit comments