forked from thestormforge/optimize-trials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-entrypoint.sh
executable file
·38 lines (30 loc) · 1.14 KB
/
docker-entrypoint.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
#!/bin/bash
set -e
if [ -z "${BLAZEMETER_API_ID}" ]; then
echo "ERROR: BLAZEMETER_API_ID not found. An API ID and an API Secret are required to access BlazeMeter cloud." > /dev/stderr
exit 1
fi
if [ -z "${BLAZEMETER_API_SECRET}" ]; then
echo "ERROR: BLAZEMETER_API_SECRET not found. An API ID and an API Secret are required to access BlazeMeter cloud." > /dev/stderr
exit 1
fi
if [ -z "${BLAZEMETER_TEST_URL}" ]; then
echo "ERROR: BLAZEMETER_TEST_URL not found. You must specify the URL to a BlazeMeter cloud test to run." > /dev/stderr
exit 1
fi
# Add the basic Taurus arguments
args=(--log="blazemeter.log" -cloud)
# Add the Blazemeter API token
args+=(-o modules.cloud.token="${BLAZEMETER_API_ID}:${BLAZEMETER_API_SECRET}")
# Add the Blazemeter test URL
args+=(-o modules.cloud.test="${BLAZEMETER_TEST_URL}")
# Execute Taurus
bzt "${args[@]}"
# Push the basic statistics
if [ -n "${PUSHGATEWAY_URL}" ]; then
mlr --c2j "remove-empty-columns" "then" "rename" -g -r '\.0,' /tmp/final-stats.csv \
| jq -r 'keys[] as $k | "\($k) \(.[$k])"' \
| curl --data-binary @- "${PUSHGATEWAY_URL}"
else
echo "WARN: No PUSHGATEWAY_URL configured" > /dev/stderr
fi