-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: send results reports via email
- Loading branch information
1 parent
c35c66d
commit 02698b3
Showing
7 changed files
with
120 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SERVER_URL= | ||
CHES_CLIENT_ID= | ||
CHES_CLIENT_SECRET= | ||
RECEPIENT= | ||
ADMIN_USERNAME= | ||
ADMIN_PASSWORD= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,28 @@ | ||
include .env | ||
|
||
SHELL := /usr/bin/env bash | ||
NAMESPACE := | ||
NAME := sso-benchmark-runner | ||
NAMESPACE := c6af30-dev | ||
SCENARIO := keycloak.scenario.authentication.AuthorizationCode | ||
SERVER_URL := | ||
ADMIN_USERNAME := | ||
ADMIN_PASSWORD := | ||
|
||
# make sure scenario is set to the correct value | ||
# test #1 - 34 users per second for 30 minutes (1800 seconds) with 101 users per realm and 101 clients per realm | ||
ADDITIONAL_CONFIG := "--users-per-sec=34 --ramp-up=300 --users-per-realm=101 --measurement=1800 --clients-per-realm=101" | ||
ADDITIONAL_CONFIG := "--measurement=30" | ||
|
||
# make <comand> NAMESPACE="<namespace>" | ||
|
||
.PHONY: run_job | ||
run_job: | ||
oc -n $(NAMESPACE) process -f ./openshift/dc.yaml -p SCENARIO=$(SCENARIO) -p SERVER_URL=$(SERVER_URL) -p ADMIN_USERNAME=$(ADMIN_USERNAME) -p ADMIN_PASSWORD=$(ADMIN_PASSWORD) -p ADDITIONAL_CONFIG=$(ADDITIONAL_CONFIG)| oc -n $(NAMESPACE) apply -f - | ||
oc -n $(NAMESPACE) process -f ./openshift/dc.yaml \ | ||
-p SCENARIO=$(SCENARIO) \ | ||
-p SERVER_URL=$(SERVER_URL) \ | ||
-p ADMIN_USERNAME=$(ADMIN_USERNAME) \ | ||
-p ADMIN_PASSWORD=$(ADMIN_PASSWORD) \ | ||
-p ADDITIONAL_CONFIG=$(ADDITIONAL_CONFIG) \ | ||
-p CHES_CLIENT_ID=$(CHES_CLIENT_ID) \ | ||
-p CHES_CLIENT_SECRET=$(CHES_CLIENT_SECRET) \ | ||
-p RECEPIENT=$(RECEPIENT) \ | ||
-p NAME=$(NAME) | ||
| oc -n $(NAMESPACE) apply -f - | ||
|
||
.PHONY: cleanup | ||
cleanup: | ||
oc -n $(NAMESPACE) delete job sso-benchmark-runner | ||
oc -n $(NAMESPACE) delete pvc sso-benchmark-runner-pvc | ||
oc -n $(NAMESPACE) delete job $(NAME) | ||
oc -n $(NAMESPACE) delete secret $(NAME)-secret |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# Configuration | ||
SENDER="[email protected]" | ||
SUBJECT="Keycloak Benchmark Results - $(date +'%Y-%m-%d %H:%M:%S')" | ||
BODY="Please find the attached benchmark results.\nYou need to base64 decode the attached file (base64 -d -i results.tar.gz) before extracting it.\nRegards,\nBCGov SSO Team" | ||
RESULTS_DIR="./results" | ||
ATTACHMENT_NAME="results.tar.gz" | ||
|
||
./bin/kcb.sh --scenario="$SCENARIO" --server-url="$SERVER_URL" --admin-username="$ADMIN_USERNAME" --admin-password="$ADMIN_PASSWORD" $ADDITIONAL_CONFIG | ||
|
||
if [ -d "$RESULTS_DIR" ]; then | ||
|
||
if [ -f "$ATTACHMENT_NAME" ]; then | ||
rm "$ATTACHMENT_NAME" | ||
fi | ||
|
||
tar -czvf "$ATTACHMENT_NAME" "$RESULTS_DIR" | ||
|
||
if [ $? -eq 0 ]; then | ||
echo "Folder '$RESULTS_DIR' compressed successfully to '$ATTACHMENT_NAME'." | ||
|
||
echo "Getting access token from '$TOKEN_URL'." | ||
|
||
# Get the access token | ||
ACCESS_TOKEN=$(curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=$CHES_CLIENT_ID" -d "client_secret=$CHES_CLIENT_SECRET" -d "grant_type=client_credentials" "$CHES_TOKEN_URL" | jq -r '.access_token') | ||
|
||
BASE64_DATA=$(base64 -i $ATTACHMENT_NAME) | ||
|
||
echo '{"from": "'"$SENDER"'", "to": ["'"$RECEPIENT"'"], "subject": "'"$SUBJECT"'", "body": "'"$BODY"'", "bodyType": "text", "attachments": [{"filename": "'"$ATTACHMENT_NAME"'", "content": "'"$BASE64_DATA"'"}]}' | curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $ACCESS_TOKEN" --data-binary @- "$MAIL_SERVER" | ||
|
||
else | ||
echo "Error: Failed to compress folder '$RESULTS_DIR'." | ||
fi | ||
else | ||
echo "Folder '$RESULTS_DIR' does not exist." | ||
fi | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters