Skip to content

Commit 5a1bf7d

Browse files
myleshortonclaude
andcommitted
ci: use --ignore-package-exit-codes and harden the version parse, per review
- bash on Windows truncates exit codes to 8 bits, so matching choco's MSI reboot codes (1641/3010) by value could never work; choco's --ignore-package-exit-codes makes it exit 0 unless it itself detected a failure, which also covers 1605/1614. - The flutter version parse now requires exactly one match and a version-shaped result before writing GITHUB_OUTPUT. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent b9c8c56 commit 5a1bf7d

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

.github/workflows/build-windows.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,15 @@ jobs:
109109
# on Windows to parse it, and chocolatey.org 504s on that step failed the
110110
# v9.1.18 and v9.1.19 release builds. The direct version input skips it.
111111
run: |
112-
version=$(sed -n 's/^[[:space:]]*flutter:[[:space:]]*"\{0,1\}\([0-9][^"]*\)"\{0,1\}[[:space:]]*$/\1/p' .github/flutter-version.yaml)
113-
if [ -z "$version" ]; then
114-
echo "could not parse a flutter version from .github/flutter-version.yaml" >&2
112+
matches=$(sed -n 's/^[[:space:]]*flutter:[[:space:]]*"\{0,1\}\([0-9][^"]*\)"\{0,1\}[[:space:]]*$/\1/p' .github/flutter-version.yaml)
113+
if [ "$(printf '%s\n' "$matches" | grep -c .)" -ne 1 ]; then
114+
echo "expected exactly one flutter version in .github/flutter-version.yaml, got:" >&2
115+
printf '%s\n' "$matches" >&2
116+
exit 1
117+
fi
118+
version=$(printf '%s' "$matches" | tr -d '[:space:]')
119+
if ! printf '%s' "$version" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.]+)?$'; then
120+
echo "parsed flutter version does not look like a version: '$version'" >&2
115121
exit 1
116122
fi
117123
echo "version=$version" >> "$GITHUB_OUTPUT"

scripts/ci/choco-retry.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,20 @@
55
# has failed two consecutive Windows release builds (v9.1.18-beta 2026-07-26:
66
# mingw + yq; v9.1.19-beta 2026-08-05: yq). A transient feed error should cost
77
# a retry, not the build.
8+
#
9+
# --ignore-package-exit-codes: MSI success-with-reboot codes (1641/3010) would
10+
# otherwise surface as nonzero — and 8-bit-truncated by bash on Windows, so
11+
# unmatchable by value — and read as failures. With the flag, choco exits 0
12+
# unless it itself detected a failure.
813
set -u
914

1015
for attempt in 1 2 3 4 5; do
11-
choco install "$@"
12-
code=$?
13-
# 1641/3010 are MSI "success, reboot initiated/required" — fine on CI.
14-
case $code in
15-
0 | 1641 | 3010) exit 0 ;;
16-
esac
16+
if choco install "$@" --ignore-package-exit-codes; then
17+
exit 0
18+
fi
1719
if [ "$attempt" -lt 5 ]; then
1820
delay=$((attempt * 30))
19-
echo "choco install $* exited $code (attempt $attempt/5); retrying in ${delay}s..." >&2
21+
echo "choco install $* failed (attempt $attempt/5); retrying in ${delay}s..." >&2
2022
sleep "$delay"
2123
fi
2224
done

0 commit comments

Comments
 (0)