Skip to content

Commit

Permalink
chore(RHIDP-2920): Add collect-results CI script to dev-sandbox test (#…
Browse files Browse the repository at this point in the history
…69)

Signed-off-by: Pavel Macík <[email protected]>
  • Loading branch information
pmacik authored Jul 17, 2024
1 parent f3a3f40 commit 72296c2
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 3 deletions.
23 changes: 20 additions & 3 deletions ci-scripts/dev-sandbox/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ export RHDH_OPERATOR_NAMESPACE ?= rhdh-operator
export RHDH_OLM_CHANNEL ?= fast
export RHDH_OLM_OPERATOR_PACKAGE ?= rhdh

.PHONY: setup
setup:
./setup.sh
export ARTIFACT_DIR ?=

.PHONY: setup-toolchain-e2e
setup-toolchain-e2e:
./setup-toolchain-e2e.sh

.PHONY: deploy
deploy:
Expand All @@ -21,6 +23,10 @@ undeploy:
run:
./run.sh

.PHONY: collect-results
collect-results:
./collect-results.sh

.PHONY: clean
clean:
./clean.sh
Expand All @@ -29,3 +35,14 @@ clean:
show-counts:
./counts.sh

.PHONY: ci-setup
ci-setup: setup-toolchain-e2e deploy

.PHONY: ci-test
ci-test: run

.PHONY: ci-collect-results
ci-collect-results: collect-results

.PHONY: ci-clean
ci-clean: undeploy clean
48 changes: 48 additions & 0 deletions ci-scripts/dev-sandbox/collect-results.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck disable=SC1090,SC1091
source "$(readlink -m "$SCRIPT_DIR/../../test.env")"

rootdir=$(readlink -m "$SCRIPT_DIR/../..")

export ARTIFACT_DIR
ARTIFACT_DIR="${ARTIFACT_DIR:-"$rootdir/.artifacts"}"

export TMP_DIR
TMP_DIR=$(readlink -m "${TMP_DIR:-"$rootdir/.tmp"}")
mkdir -p "${TMP_DIR}"

out=$ARTIFACT_DIR/dev-sandbox/summary.csv
rm -rvf "$out"
while read -r baseline_csv; do
while read -r metrics; do
while IFS="," read -r -a tokens; do
metric="${tokens[0]}"
echo -n "${metric}" >>"$out"
for run_csv in $(find "$ARTIFACT_DIR/dev-sandbox" -type f -regex '.*\(run[0-9]*\|baseline\).csv' | sort -V); do
# shellcheck disable=SC2001
run_id=$(sed -e 's,.*\(run[0-9]*\|baseline\).csv,\1,g' <<<"$run_csv")
if [ "$metric" == "Item" ]; then
echo -n ",$run_id" >>"$out"
else
echo -n ",$(grep "$metric" "$run_csv" | sed -e 's/.*,\(.*\)/\1/g')" >>"$out"
fi
done
echo >>"$out"
done <<<"$metrics"
done <"$baseline_csv"
done <<<"$(find "${ARTIFACT_DIR}/dev-sandbox/" -name '*baseline.csv')"

while read -r baseline_counts_csv; do
while read -r metrics; do
while IFS="," read -r -a tokens; do
metric="${tokens[0]}"
echo -n "${metric}" >>"$out"
for run_csv in $(find "$ARTIFACT_DIR/dev-sandbox" -type f -regex '.*\(run[0-9]*\|baseline\)-counts-post.csv' | sort -V); do
echo -n ",$(grep "$metric" "$run_csv" | sed -e 's/.*,\(.*\)/\1/g')" >>"$out"
done
echo >>"$out"
done <<<"$metrics"
done <"$baseline_counts_csv"
done <<<"$(find "${ARTIFACT_DIR}/dev-sandbox/" -name '*baseline-counts-post.csv')"
File renamed without changes.

0 comments on commit 72296c2

Please sign in to comment.