-
Notifications
You must be signed in to change notification settings - Fork 45
/
Copy pathdeploy-staging.sh
executable file
·49 lines (42 loc) · 1.17 KB
/
deploy-staging.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
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bash
# Copyright The Linux Foundation and each contributor to CommunityBridge.
# SPDX-License-Identifier: MIT
# The golang lambda file list
declare -a lambdas=("backend-aws-lambda"
"user-subscribe-lambda"
"metrics-aws-lambda"
"dynamo-events-lambda"
"zipbuilder-scheduler-lambda"
"zipbuilder-lambda")
echo "Installing dependencies..."
yarn install
missing_lambda=0
echo "Testing if the lambdas have been copied over..."
for i in "${lambdas[@]}"; do
echo "Testing lambda file: ${i}..."
if [[ ! -f "${i}" ]]; then
echo "MISSING - lambda file: ${i}"
missing_lambda=1
else
echo "PRESENT - lambda file: ${i}"
fi
done
if [[ ${missing_lambda} -ne 0 ]]; then
echo "Missing one or more lambda files - building golang binaries in 5 seconds..."
sleep 5
pushd "../cla-backend-go" || exit
make all-linux
popd || exit
echo "Copying over files..."
cp "${lambdas[@]}" .
else
echo "All golang lambda files present."
fi
for i in "${lambdas[@]}"; do
echo "Testing file: ${i}..."
if ! diff -q "../cla-backend-go/${i}" "${i}" &>/dev/null; then
echo "Golang file differs: ../cla-backend-go/${i} ${i}"
exit 1
fi
done
time yarn deploy:staging