Merge pull request #14178 from edsantiago/bloat_fix

bloat check: make more robust
This commit is contained in:
OpenShift Merge Robot
2022-05-10 10:16:00 -04:00
committed by GitHub

View File

@ -250,16 +250,23 @@ function _run_altbuild() {
case "$ALT_NAME" in case "$ALT_NAME" in
*Each*) *Each*)
git fetch origin git fetch origin
# The check-size script, introduced 2022-03-22 in #13518, # The make-and-check-size script, introduced 2022-03-22 in #13518,
# runs 'make' (the original purpose of this check) against # runs 'make' (the original purpose of this check) against
# each commit, then checks image sizes to make sure that # each commit, then checks image sizes to make sure that
# none have grown beyond a given limit. That of course # none have grown beyond a given limit. That of course
# requires a baseline, which is why we use '^' to start # requires a baseline, so our first step is to build the
# with the *parent* commit of this PR, not the first commit. # branch point of the PR.
local context_dir savedhead pr_base
context_dir=$(mktemp -d --tmpdir make-size-check.XXXXXXX) context_dir=$(mktemp -d --tmpdir make-size-check.XXXXXXX)
make build-all-new-commits \ savedhead=$(git rev-parse HEAD)
GIT_BASE_BRANCH=origin/"${DEST_BRANCH}^" \ # Push to PR base. First run of the script will write size files
MAKE="hack/make-and-check-size $context_dir" pr_base=$(git merge-base --fork-point origin/$DEST_BRANCH)
git checkout $pr_base
hack/make-and-check-size $context_dir
# pop back to PR, and run incremental makes. Subsequent script
# invocations will compare against original size.
git checkout $savedhead
git rebase $pr_base -x "hack/make-and-check-size $context_dir"
rm -rf $context_dir rm -rf $context_dir
;; ;;
*Windows*) *Windows*)