-
Notifications
You must be signed in to change notification settings - Fork 0
/
tasks_github_actions.sh
executable file
·61 lines (49 loc) · 1.21 KB
/
tasks_github_actions.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
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
set -Eeo pipefail
task="$1"
function build_lambda {
lambda_name=$1
lambda_services=$2
build_dir=lambda/build/$lambda_name
rm -rf $build_dir
mkdir -p $build_dir
if test "$lambda_services"; then
cp -r ./$lambda_services $build_dir
fi
cp lambda/$lambda_name/*.py $build_dir
pushd $build_dir
zip -r -X ../$lambda_name.zip .
popd
}
function build_lambda_layer {
layer_name=$1
build_dir=lambda/build/layers/$layer_name
rm -rf $build_dir/python
mkdir -p $build_dir/python
requirements_file=lambda/$layer_name-requirements.txt
if test -f "$requirements_file"; then
python3 -m venv create_layer
source create_layer/bin/activate
pip install -r $requirements_file
fi
cp -r create_layer/lib $build_dir/python
pushd $build_dir
zip -r -X ../$layer_name.zip .
popd
}
echo "--- ${task} ---"
case "${task}" in
build-lambdas)
build_lambda_layer mi-enrichment
build_lambda bulk-ods-update utils
build_lambda error-alarm-alert
build_lambda splunk-cloud-event-uploader
build_lambda event-enrichment utils
build_lambda s3-event-uploader
;;
*)
echo "Invalid task: '${task}'"
exit 1
;;
esac
set +e