Add timestamp to report file names for scripts which run tests
* Added functions.sh file to store reusable bash functions
* Replaced 'latest' in generated report names by timestamps
Related-PROD: PROD-37187
Change-Id: I9e2bc7989a685b0f2f94fb909a8f2f1cc7a6d803
diff --git a/k8s/workspace/run-k8s-perf.sh b/k8s/workspace/run-k8s-perf.sh
index c3cae14..549428d 100644
--- a/k8s/workspace/run-k8s-perf.sh
+++ b/k8s/workspace/run-k8s-perf.sh
@@ -1,4 +1,6 @@
#!/bin/bash
+
+. "$(dirname "$0")/functions.sh"
##
echo "### Checking rally environments"
status=$(kubectl -n qa-space get pod | grep rally | tr -s " " | cut -d' ' -f3)
@@ -18,7 +20,8 @@
kubectl exec -n qa-space --stdin rally -- rally task start /rally/rally-files/k8s-mos-scn-i100c5.yaml
# generate report
echo "# Generating report"
- fname=$MY_CLIENTSHORTNAME-mos-k8s-perf-latest.html
+ fname="$MY_CLIENTSHORTNAME-mos-k8s-perf-$(get_timestamp).html"
kubectl exec -n qa-space --stdin rally -- rally task report $(kubectl exec -n qa-space --stdin rally -- rally task list | grep kubernetes | cut -d' ' -f2 | tail -1) --html-static --out ${fname}
- kubectl cp qa-space/rally:/rally/${fname} $MY_PROJFOLDER/reports/${fname}
+ kubectl cp qa-space/rally:/rally/${fname} "${MY_PROJFOLDER}/reports/${fname}"
+ update_latest_report_to "${MY_PROJFOLDER}/reports/${fname}"
fi