-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathenv_setup.sh
39 lines (32 loc) · 1.07 KB
/
env_setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/bash
#
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
#
#
# Setup environment variables for development
# Source library
source lib.sh
# Check whether script is running in a sub-shell
if [ "${BASH_SOURCE}" == "$0" ]; then
log_error '"env_setup.sh" should be sourced. Run "source env_setup.sh" or ". env_setup.sh"'
exit 1
fi
# Parse command line arguments
parse_args "$@"
[[ $? -ne 0 ]] && return 1
# Load ${CONFIG_FILE} and export environment variables
load_config
# Check required environment variables
check_required_env_vars
[[ $? -ne 0 ]] && return 1
c_group=${TARGET_ENV}${COMMON_GROUP}${GROUP_SUFFIX}
k8_group=${TARGET_ENV}${K8_GROUP}${GROUP_SUFFIX}
if [ "${CLOUD_ENV}" == "azure" ]; then
echo "azure"
else
gcloud config set project $GOOGLE_PROJECT_ID
gcloud container clusters get-credentials $ACS_NAME --zone $GOOGLE_ZONE
kubectl config set-context $(kubectl config current-context) --namespace=${TARGET_ENV}
gcloud auth configure-docker --quiet
fi