-
Notifications
You must be signed in to change notification settings - Fork 5
/
steps.sh
executable file
·38 lines (27 loc) · 1.57 KB
/
steps.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
docker-compose up -d
npm i && npm run build
cd dist
zip -r ./createMatches.zip ./createMatchesHandler.js
zip -r ./calculateRunRate.zip ./calculateRunRateHandler.js
cd ..
awslocal lambda create-function --function-name CreateMatchesFunction --runtime nodejs12.x --handler createMatchesHandler.handler --role arn:aws:iam::012345678901:role/DummyRole --zip-file fileb://dist/createMatches.zip
awslocal lambda create-function --function-name CalculateRunRateFunction --runtime nodejs12.x --handler calculateRunRateHandler.handler --role arn:aws:iam::012345678901:role/DummyRole --zip-file fileb://dist/calculateRunRate.zip
aws stepfunctions --endpoint http://localhost:8083 create-state-machine --definition file://state-machine.json --name "NetRunRateCalculatorStateMachine" --role-arn "arn:aws:iam::012345678901:role/DummyRole"
aws stepfunctions --endpoint http://localhost:8083 start-execution --state-machine arn:aws:states:us-east-1:123456789012:stateMachine:NetRunRateCalculatorStateMachine --name test --input "{\"teamA\":\"India\", \"teamB\": \"Australia\", \"numMatches\": 3, \"matchType\": \"t20\"}"
function shutdown() {
echo $1
echo $2
docker-compose down -v
exit $3
}
while true; do
output=$(aws stepfunctions --endpoint http://localhost:8083 describe-execution --execution-arn arn:aws:states:us-east-1:123456789012:execution:NetRunRateCalculatorStateMachine:test 2>&1)
case $output in
*'SUCCEEDED'*)
shutdown "${GREEN}***EXECUTION SUCCESSFUL!***${NC}" "$output" "0"
;;
*'FAILED'*)
shutdown "${RED}***EXECUTION FAILED!***${NC}" "$output" "1"
;;
esac
done