summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Santiago <santiago@redhat.com>2022-05-10 05:27:13 -0600
committerMatthew Heon <mheon@redhat.com>2022-06-14 13:14:15 -0400
commitce407828d029f189ebb0649ac724bc4b4066e79d (patch)
tree2217d0d975eabef31092234a55fd3371031c52b0
parent42e70a0c9477ffd4e6f5129f8b50be43de216188 (diff)
downloadpodman-ce407828d029f189ebb0649ac724bc4b4066e79d.tar.gz
podman-ce407828d029f189ebb0649ac724bc4b4066e79d.tar.bz2
podman-ce407828d029f189ebb0649ac724bc4b4066e79d.zip
bloat check: make more robust
The use of 'C^' (parent) in 'git rebase' is counterintuitive, at least to me: when C is a merge of multiple commits, rebase picks each of those commits. That probably makes good sense to a git expert, which I'm not. Solution: forget using '^', just calculate the baseline sizes by doing a checkout of the PR's parent. Also: compute PR parent using git-merge-base instead of blindly trusting $DEST_BRANCH (which may be volatile as other PRs are merged). Also: run git-rebase directly, not via make rule. That indirection is too confusing here. Signed-off-by: Ed Santiago <santiago@redhat.com>
-rwxr-xr-xcontrib/cirrus/runner.sh19
1 files changed, 13 insertions, 6 deletions
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index c4a714691..1ec18c861 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -250,16 +250,23 @@ function _run_altbuild() {
case "$ALT_NAME" in
*Each*)
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
# each commit, then checks image sizes to make sure that
# none have grown beyond a given limit. That of course
- # requires a baseline, which is why we use '^' to start
- # with the *parent* commit of this PR, not the first commit.
+ # requires a baseline, so our first step is to build the
+ # branch point of the PR.
+ local context_dir savedhead pr_base
context_dir=$(mktemp -d --tmpdir make-size-check.XXXXXXX)
- make build-all-new-commits \
- GIT_BASE_BRANCH=origin/"${DEST_BRANCH}^" \
- MAKE="hack/make-and-check-size $context_dir"
+ savedhead=$(git rev-parse HEAD)
+ # Push to PR base. First run of the script will write size files
+ 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
;;
*Windows*)