History

fix(mobile): preserve rollbacks during scheduled OTA retries

Theo Browne committed 2 months ago

Commit a11cfa21 parent e7204ff2 files · +70 −9Browse files

Showing the changes to .github (1 of 2 files). Show all

Unified · Split

.github/workflows/mobile-eas-production.yml+24−6
@@ -69,11 +69,10 @@ on: · 68 unmodified lines
69 schedule:69 schedule:
70 - cron: "17,47 * * * *"70 - cron: "17,47 * * * *"
71 71
72# Serialize runs so OTAs publish in merge order. GitHub keeps at most one72# Serialize push releases so OTAs publish in merge order. Scheduled retries
73# queued run per group, so a burst of merges collapses into one run of the73# use a separate group and cannot replace a queued push that must start builds.
74# newest commit — intermediate commits don't need their own OTA.
75concurrency:74concurrency:
76 group: mobile-eas-production75 group: mobile-eas-production-${{ github.event_name == 'schedule' && 'scheduled' || 'release' }}
77 cancel-in-progress: false76 cancel-in-progress: false
78 77
79jobs:78jobs:
@@ -277,9 +276,16 @@ jobs: · 197 unmodified lines
277 matching="$(eas build:list --platform "$platform" --build-profile production --status finished --fingerprint-hash "$hash" --limit 1 --json --non-interactive | jq 'length')"276 matching="$(eas build:list --platform "$platform" --build-profile production --status finished --fingerprint-hash "$hash" --limit 1 --json --non-interactive | jq 'length')"
278 if [ "$matching" -gt 0 ]; then277 if [ "$matching" -gt 0 ]; then
279 if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then278 if [ "$GITHUB_EVENT_NAME" = "schedule" ]; then
280 group="$(eas update:list --branch production --platform "$platform" --runtime-version "$hash" --limit 1 --json --non-interactive | jq -r '.currentPage[0].group // empty')"279 updates="$(eas update:list --branch production --platform "$platform" --runtime-version "$hash" --limit 2 --json --non-interactive)"
280 group="$(jq -r '.currentPage[0].group // empty' <<< "$updates")"
281 if [ -n "$group" ]; then281 if [ -n "$group" ]; then
282 published_commit="$(eas update:view "$group" --json | jq -r --arg platform "$platform" '.[] | select(.platform == $platform) | .gitCommitHash // empty')"282 update="$(eas update:view "$group" --json | jq -c --arg platform "$platform" 'map(select(.platform == $platform)) | .[0] // {}')"
283 if [ "$(jq -r '.isRollBackToEmbedded // false' <<< "$update")" = "true" ]; then
284 echo "$platform: preserving production rollback to the embedded update"
285 continue
286 fi
287
288 published_commit="$(jq -r '.gitCommitHash // empty' <<< "$update")"
283 if [ -n "$published_commit" ] &&289 if [ -n "$published_commit" ] &&
284 git cat-file -e "$published_commit^{commit}" 2>/dev/null &&290 git cat-file -e "$published_commit^{commit}" 2>/dev/null &&
285 git -C "$(git rev-parse --show-toplevel)" diff --quiet "$published_commit" HEAD -- \291 git -C "$(git rev-parse --show-toplevel)" diff --quiet "$published_commit" HEAD -- \
@@ -296,6 +302,18 @@ jobs: · 10 unmodified lines
296 echo "$platform: production OTA already contains the latest mobile changes"302 echo "$platform: production OTA already contains the latest mobile changes"
297 continue303 continue
298 fi304 fi
305
306 previous_group="$(jq -r '.currentPage[1].group // empty' <<< "$updates")"
307 if [ -n "$published_commit" ] && [ -n "$previous_group" ]; then
308 previous_commit="$(eas update:view "$previous_group" --json | jq -r --arg platform "$platform" '.[] | select(.platform == $platform) | .gitCommitHash // empty')"
309 if [ -n "$previous_commit" ] &&
310 [ "$published_commit" != "$previous_commit" ] &&
311 git cat-file -e "$previous_commit^{commit}" 2>/dev/null &&
312 git merge-base --is-ancestor "$published_commit" "$previous_commit"; then
313 echo "$platform: preserving production rollback to an earlier update"
314 continue
315 fi
316 fi
299 fi317 fi
300 fi318 fi
301 319