-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.sh
executable file
·49 lines (40 loc) · 1.02 KB
/
build.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
#!/bin/bash
# A few wrappers around the OpenWhisk platform.
set -e
readonly action='sslexpired'
readonly command="${1:-create}"
readonly api="/${action}"
readonly version="v1"
readonly wskCli="wsk -i" # remove -i if developing on Bluemix platform
cleanup() {
rm -f action.zip exec
}
trap cleanup ERR EXIT
usage() {
echo "Usage: $0 [create|update|run|delete]"
}
build() {
rm -f action.zip exec
env GOOS=linux GOARCH=amd64 go build -o exec "${action}.go"
zip action.zip exec
}
createupdate() {
$wskCli action $command $action action.zip --docker
}
run() {
$wskCli action invoke $action --blocking --result --param host $2 --param days $3
}
createapigateway() {
$wskCli api-experimental create $api /$version get $action
}
delete() {
$wskCli api-experimental delete $api
$wskCli action delete $action
}
case $1 in
create) set -x; build; createupdate; createapigateway;;
update) set -x; build; createupdate;;
run) set -x; run $*;;
delete) set -x; delete;;
*) usage; exit 1;;
esac