summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2022-08-06 10:16:41 +0000
committerMaxim Kuvyrkov <maxim.kuvyrkov@linaro.org>2022-08-08 13:56:32 +0000
commit27ec3d01e125f6f5e29c33c685fd79050d57ec98 (patch)
tree892ec2b6d26f36e8b991f7b8942e8e270cc54331
parent3b5333a1e4301cb21c5ef9df0dd6655c6004b454 (diff)
round-robin.sh: Rework handling of base-artifacts history
Instead of keeping builds for regressions only, keep history for all successful commits (update_baseline == force is successful by definition). Trim ancient history (delete non-essential artifacts) to keep size manageable. This will store adequate history of builds for [upcoming] dashboard. Change-Id: Iaa129a5c7f41e9c3ca9f1829ba668ea972792741
-rw-r--r--round-robin.sh73
1 files changed, 32 insertions, 41 deletions
diff --git a/round-robin.sh b/round-robin.sh
index ab7b10bb..86161d8f 100644
--- a/round-robin.sh
+++ b/round-robin.sh
@@ -763,46 +763,35 @@ update_baseline ()
(
set -euf -o pipefail
- local amend=""
-
if [ x"${rr[update_baseline]}" = x"ignore" ]; then
return
- elif [ x"${rr[update_baseline]}" = x"init" ]; then
- amend="--amend"
- else
- # ${rr[update_baseline]} == onsuccess, force
- local prev_head=""
-
- # We discard baseline entries for results worse or same than
- # the current one, but keep entries for results that are better
- # (so that we have a record of pending regressions).
- while true; do
- ${rr[no_regression_p]} base-artifacts ${rr[top_artifacts]} &
- if ! wait $!; then
- break
- fi
-
- prev_head=""
- if git -C base-artifacts rev-parse HEAD^ >/dev/null 2>&1; then
- # For every regression we want to keep artifacts for the first-bad
- # build, so reset to the most relevant regression (marked by reset-baseline).
- if [ -f base-artifacts/reset-baseline ] \
- && [ x"${rr[update_baseline]}" = x"onsuccess" ]; then
- prev_head=$(git -C base-artifacts rev-parse HEAD)
- fi
- git -C base-artifacts reset --hard HEAD^
- else
- # We got to the beginning of git history, so amend the current
- # commit. The initial state of baseline is "empty" branch,
- # which we treat as worst possible in ${rr[no_regression_p]}().
- amend="--amend"
- break
- fi
- done
+ fi
- if [ x"$prev_head" != x"" ]; then
- git -C base-artifacts reset --hard $prev_head
- fi
+ # - For the last 100 builds: keep everything
+ # - For the rest of the builds: delete non-essential artifacts
+ # - NN-<step> directories are non-essential, the rest -- jenkins/,
+ # dashboard/, etc. -- are essential.
+ local old_commit
+ old_commit=$(git -C base-artifacts rev-parse HEAD~100 \
+ 2>/dev/null)
+
+ if [ x"$old_commit" != x"" ]; then
+ local head
+ head=$(git -C base-artifacts rev-parse HEAD)
+
+ # Remove directories starting with number from $old_commit
+ # and older.
+ git -C base-artifacts checkout -detach $old_commit
+ git -C base-artifacts filter-repo --force \
+ --invert-paths --path-regex '^[0-9].*' \
+ --refs HEAD
+
+ # Reparent history on the new version of $old_commit.
+ local new_old_commit
+ new_old_commit=$(git -C base-artifacts rev-parse HEAD)
+ git -C base-artifacts checkout --detach $head
+ git -C base-artifacts replace $old_commit $new_old_commit
+ git -C base-artifacts filter-repo --force --refs HEAD
fi
# Rsync current artifacts. Make sure to use -I rsync option since
@@ -813,11 +802,13 @@ update_baseline ()
# in base-artifacts.git repo (though they will be uploaded to jenkins).
rsync -aI --del --exclude /.git ${rr[top_artifacts]}/ base-artifacts/
- local rev_count
- if [ x"$amend" = x"" ]; then
- rev_count=$(git -C base-artifacts rev-list --count HEAD)
- else
+ local rev_count amend=""
+
+ if [ x"${rr[update_baseline]}" = x"init" ]; then
rev_count="0"
+ amend="--amend"
+ else
+ rev_count=$(git -C base-artifacts rev-list --count HEAD)
fi
local msg_title="$rev_count: ${rr[update_baseline]}"