diff options
author | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2018-11-08 10:34:43 +0000 |
---|---|---|
committer | Maxim Kuvyrkov <maxim.kuvyrkov@linaro.org> | 2018-11-14 09:52:02 +0000 |
commit | f27e649e27312c3d09681422ebb5dc23eaad8518 (patch) | |
tree | aa0a331b8eae04c147356d9b98215aeb38c39aa4 /tcwg_kernel-build.sh | |
parent | 4d4514c4ae6c5dd2f02ecd4a8b09394f9f3b986a (diff) |
tcwg_kernel-build.sh: Fill in update_baseline and push_baseline
... and add git_push helper.
Change-Id: I2bdbbc14aa08f9bb10b1690780542c6e049c4b73
Diffstat (limited to 'tcwg_kernel-build.sh')
-rwxr-xr-x | tcwg_kernel-build.sh | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tcwg_kernel-build.sh b/tcwg_kernel-build.sh index 1ace57c3..f9ba98b0 100755 --- a/tcwg_kernel-build.sh +++ b/tcwg_kernel-build.sh @@ -528,12 +528,65 @@ check_regression () ) } +# Commit current result and artifacts to the baseline repository update_baseline () { + ( + set -euf -o pipefail + + local amend="" + 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 no_regression_p; do + if git -C base-artifacts rev-parse HEAD^ >/dev/null 2>&1; then + prev_head=$(git -C base-artifacts rev-parse HEAD) + 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 no_regression_p(). + amend="--amend" + prev_head="" + break + fi + done + + # For every regression we want to keep artifacts for the first-bad + # build, so discard one less than needed. + if [ x"$prev_head" != x"" ]; then + git -C base-artifacts reset --hard $prev_head + fi + + # Rsync current artifacts. + # !!! From this point on logs and other artifacts won't be included + # in base-artifacts.git repo. + rsync -a --del --exclude /.git $top_artifacts/ base-artifacts/ + + build_rev=$(git -C ${git_dirs[$current_project]} rev-parse HEAD) + + cd base-artifacts + git add . + git commit $amend -m "$current_project-$build_rev: $(tail -n1 $top_artifacts/results) + +$(cat $top_artifacts/results)" + ) } +# Push to $current_project baseline branch and to base-artifacts repo. push_baseline () { + ( + set -euf -o pipefail + + assert ! $git_read_only + + git_init_linaro_local_remote base-artifacts baseline false + git_push base-artifacts baseline $baseline + git_push ${git_dirs[$current_project]} baseline $baseline + ) } run_step reset_artifacts |