forked from keptn-sandbox/keptn-on-k3s
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtrigger.performance.testing.sh
executable file
·37 lines (29 loc) · 1.06 KB
/
trigger.performance.testing.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
#!/bin/bash
PROJECT=$1
STAGE=$2
SERVICE=$3
TESTSTRATEGY=$4
URL=${5//\//\\/}
VERSION=$6
USER=$7
if [[ -z "$VERSION" ]]; then
VERSION="1.0"
fi
if [[ -z "$USER" ]]; then
USER="noname"
fi
if [[ -z "$PROJECT" || -z "$STAGE" || -z "$SERVICE" || -z "$URL" || -z "$TESTSTRATEGY" ]]; then
echo "Please specify project, stage, service, test strategy and URL. Optionally specify your version and user:"
echo "Usage: $0 PROJECT STAGE SERVICE TESTSTRATEGY URL [VERSION] [USER]"
echo "Example: $0 perfservice performance simplenodeservice performance http://YOURURL 1.1 Andi"
exit 1
fi
# Generate a temp file with replaced placeholders
inputfile="performance.testing.triggered.placeholder.json"
tmpfile="performance.testing.triggered.placeholder.tmp"
if [ -f $tmpfile ] ; then
rm -f $tmpfile
fi
sed -e "s/\$PROJECT/$PROJECT/" -e "s/\$STAGE/$STAGE/" -e "s/\$SERVICE/$SERVICE/" -e "s/\$TESTSTRATEGY/$TESTSTRATEGY/" -e "s/\$USER/$USER/" -e "s/\$VERSION/$VERSION/" -e "s/\$URL/$URL/" $inputfile >> $tmpfile
# now lets execute the keptn command
keptn send event --file=$tmpfile