Upgrade test: fail when nothing was upgraded, and retry a lost push

A channel that holds the version the machine already has upgrades
nothing, and every other check passes on a machine that was only
rebooted: rc is in that state today. A twelfth check requires the
Omarchy package to have changed.

Two runs on different branches both push pictures to one branch. The
second to push was refused and its comment never written. The push is
now tried again on top of whatever got there first; each run's folder is
its own, so there is nothing to merge.
This commit is contained in:
Emir Beganovic committed 2026-10-10 00:20:27 +02:00
1 parent b5936a6cbe
commit d6a32f0dcf
2 files changed
+22 -11

No files matched your search

+19 -11
View File
@@ -155,20 +155,28 @@ jobs:
set -euo pipefail
[ -s evidence/before.png ] || [ -s evidence/after.png ] || { echo "no pictures to commit"; exit 0; }
url=https://x-access-token:$GH_TOKEN@github.com/$GITHUB_REPOSITORY.git
dir=$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
git init -q shots && cd shots
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
if git fetch -q --depth 1 "$url" "$SHOTS_BRANCH" 2>/dev/null; then
git checkout -q -b "$SHOTS_BRANCH" FETCH_HEAD
else
git checkout -q --orphan "$SHOTS_BRANCH"
fi
dir=$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT
mkdir -p "$dir"
cp ../evidence/*.png "$dir/"
git add "$dir"
git commit -q -m "Upgrade test $GITHUB_RUN_ID, attempt $GITHUB_RUN_ATTEMPT: $FROM to $TO"
git push -q "$url" "$SHOTS_BRANCH"
# Runs on other branches push here too. A push that loses the race
# is made again on top of whatever won: the folder is this run's own,
# so there is never anything to merge.
for attempt in 1 2 3 4 5; do
if git fetch -q --depth 1 "$url" "$SHOTS_BRANCH" 2>/dev/null; then
git checkout -q -B "$SHOTS_BRANCH" FETCH_HEAD
else
git checkout -q --orphan "$SHOTS_BRANCH" 2>/dev/null || true
fi
mkdir -p "$dir"
cp ../evidence/*.png "$dir/"
git add "$dir"
git commit -q -m "Upgrade test $GITHUB_RUN_ID, attempt $GITHUB_RUN_ATTEMPT: $FROM to $TO"
if git push -q "$url" "HEAD:refs/heads/$SHOTS_BRANCH"; then break; fi
[ "$attempt" -lt 5 ] || { echo "::error::could not push the pictures after 5 tries"; exit 1; }
echo "The push lost a race, trying again"
sleep $((attempt * 2))
done
echo "base=https://raw.githubusercontent.com/$GITHUB_REPOSITORY/$(git rev-parse HEAD)/$dir" >>"$GITHUB_OUTPUT"
- name: Write the comment
+3
View File
@@ -192,6 +192,9 @@ check "No migration was skipped ($(a migrations_skipped) skipped)" test "$(a mig
check "The system came back from the reboot by itself (came back: $rebooted)" test "$rebooted" = yes
check "It is a new boot (boot ID $(b boot_id) → $(a boot_id))" test -n "$(a boot_id)" -a "$(a boot_id)" != "$(b boot_id)"
check "It is on the $channel channel (got: $(a channel))" test "$(a channel)" = "$channel"
# A channel that holds what the machine already had upgrades nothing, and
# every other check would pass on a machine that was only rebooted.
check "Omarchy itself changed ($(b omarchy) → $(a omarchy))" test -n "$(a omarchy)" -a "$(a omarchy)" != "$(b omarchy)"
check "The running kernel is an installed one ($(a kernel))" test "$(a kernel_is_installed)" = yes
check "systemd reports the system running (got: $(a system_state))" test "$(a system_state)" = running
failed="$(a failed_units) $(a failed_user_units)"