Skip to content

Commit 743d133

Browse files
Revert "Merge pull request #874 from ClickHouse/website-latest-snapshot"
This reverts commit 5226887, reversing changes made to 153c080.
1 parent fce02cd commit 743d133

1 file changed

Lines changed: 23 additions & 27 deletions

File tree

generate-results.sh

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,33 @@
11
#!/bin/bash -e
22

33
# Results live under <system>/results/YYYYMMDD/<basename>.json.
4-
# For the website we use only the latest date subdirectory of each
5-
# system's results/, and include every file in that subdirectory.
6-
# Older subdirectories are kept on disk as history but not displayed.
7-
# Entries tagged "historical" are also filtered out.
4+
# For the website we keep only the latest dated copy per (system, basename),
5+
# and we skip entries tagged "historical" — those are kept in the repo
6+
# as archival data but are not displayed on the dashboard.
87

98
echo "const data = [" > data.generated.js.new
109
FIRST=1
1110

12-
for dir in */; do
13-
dir="${dir%/}"
14-
case "$dir" in
15-
hardware|versions|gravitons) continue;;
16-
esac
17-
[ -d "$dir/results" ] || continue
18-
latest=$(LANG=C ls -1 "$dir/results" 2>/dev/null | sort | tail -1)
19-
[ -n "$latest" ] || continue
20-
[ -d "$dir/results/$latest" ] || continue
21-
22-
for file in "$dir/results/$latest"/*.json; do
23-
[ -f "$file" ] || continue
24-
if ! entry=$(jq --compact-output --arg src "$file" \
25-
'select((.tags // []) | index("historical") | not) | . + {"source": $src}' \
26-
"$file"); then
27-
echo "Error in $file — skipping" >&2
28-
continue
29-
fi
30-
[ -z "$entry" ] && continue
31-
[ "${FIRST}" = "0" ] && echo -n ','
32-
printf '%s\n' "$entry"
33-
FIRST=0
34-
done
11+
# Build "<system>/<basename> <full-path>" lines, then keep the last (latest)
12+
# row per key — sorted ascending by date, since YYYYMMDD sorts lexically.
13+
LANG="" ls -1 */results/*/*.json \
14+
| grep -Ev '^(hardware|versions|gravitons)/' \
15+
| sort \
16+
| awk -F/ '{ print $1"/"$NF" "$0 }' \
17+
| awk '{ latest[$1] = $2 } END { for (k in latest) print latest[k] }' \
18+
| sort \
19+
| while read -r file
20+
do
21+
if ! entry=$(jq --compact-output --arg src "$file" \
22+
'select((.tags // []) | index("historical") | not) | . + {"source": $src}' \
23+
"$file"); then
24+
echo "Error in $file — skipping" >&2
25+
continue
26+
fi
27+
[ -z "$entry" ] && continue
28+
[ "${FIRST}" = "0" ] && echo -n ','
29+
printf '%s\n' "$entry"
30+
FIRST=0
3531
done >> data.generated.js.new
3632
echo '];' >> data.generated.js.new
3733

0 commit comments

Comments
 (0)