-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
33 lines (28 loc) · 769 Bytes
/
deploy.sh
File metadata and controls
33 lines (28 loc) · 769 Bytes
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
#! /bin/bash -x
echo "Deploying developer-challenge to google cloud \n"
# Returns a list of all gcloud deployment versions
gcloud_list() {
local gcloud="$(gcloud app versions list )"
local array=()
for word in $gcloud
do
array+=($word)
done
echo "${array[@]}"
}
# Deletes unnecessary deployments that are not utilized
delete_version() {
local array=($@)
for ((i = 0; i < ${#array[@]}; ++i)); do
if [[ ${array[$i]} == *"0.00"* ]]; then
local version=${array[$i - 1]}
local command="gcloud -q app versions delete $version"
eval $command
fi
done
}
# Executes functions
list=$(gcloud_list)
delete_version $list
# deploy to google cloud provider
gcloud app deploy --stop-previous-version