From 6c35f9e26195e0ed2b7f4e30b01105aae0623002 Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Mon, 4 May 2026 15:18:47 -0700 Subject: [PATCH 1/2] ci: wrap bazel build steps in retry-with-backoff action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hit a transient `502 Bad Gateway` from GitHub's CDN on `MobileNativeFoundation/index-import` (a transitive `rules_swift` download) on `main`'s post-merge CI for #293. Same pattern we already handle for SPM resolution via `./.github/actions/retry`. Apply the existing retry action to both `bazelisk build` steps — the action retries up to 6 times with exponential backoff (15s → 240s), so a single CDN flake doesn't fail the whole job. The `Build Example` step was using `working-directory:`; folded the `cd` into the retry action's `command` since the composite action runs from the parent's cwd. --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5ea3f6f0..da9cc210 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -265,10 +265,13 @@ jobs: - name: Select Xcode Version run: sudo xcode-select --switch /Applications/Xcode_26.0.app/Contents/Developer - name: Build Sources - run: bazelisk build //Sources/... + uses: ./.github/actions/retry + with: + command: bazelisk build //Sources/... - name: Build Example - working-directory: Examples/ExampleBazelIntegration - run: bazelisk build //Subproject:Subproject //ExampleBazelIntegration:ExampleBazelIntegration + uses: ./.github/actions/retry + with: + command: cd Examples/ExampleBazelIntegration && bazelisk build //Subproject:Subproject //ExampleBazelIntegration:ExampleBazelIntegration readme-validation: name: Check Markdown links From 201875b91a7b1e96b25f2fb8fceb98eea6fef90a Mon Sep 17 00:00:00 2001 From: Dan Federman Date: Mon, 4 May 2026 15:25:03 -0700 Subject: [PATCH 2/2] ci: subshell the bazel example retry + explain why we retry the build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Codex P1: the original `cd Examples/ExampleBazelIntegration && ...` mutated the shell's cwd inside the retry loop. On a first-attempt failure (the exact case this change targets), the second attempt would run `cd Examples/ExampleBazelIntegration` from inside that directory and fail at the cd, never retrying Bazel. Wrap the command in a subshell `(cd … && …)` so each attempt starts from the repo root. Also add a comment block explaining why we retry the whole build rather than isolating dependency resolution like the SPM jobs do — Bazel resolves external repos lazily during the build, with no equivalent of `swift package resolve` to wrap separately. --- .github/workflows/ci.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da9cc210..de11f5bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -264,6 +264,17 @@ jobs: uses: actions/checkout@v6 - name: Select Xcode Version run: sudo xcode-select --switch /Applications/Xcode_26.0.app/Contents/Developer + # Wrapping `bazelisk build` in retry — not just dependency + # resolution, like the SPM jobs above — because Bazel resolves + # external repos lazily during the build itself. There's no + # equivalent to `swift package resolve` we could isolate; a + # transient HTTP failure (e.g. on a `rules_swift` transitive + # like `MobileNativeFoundation/index-import`) surfaces as a + # build failure. Bazel caches successful downloads, so a retry + # after a flake is cheap. + # + # Each command runs in a subshell so a `cd` for the example + # build doesn't leak its cwd change into subsequent retries. - name: Build Sources uses: ./.github/actions/retry with: @@ -271,7 +282,7 @@ jobs: - name: Build Example uses: ./.github/actions/retry with: - command: cd Examples/ExampleBazelIntegration && bazelisk build //Subproject:Subproject //ExampleBazelIntegration:ExampleBazelIntegration + command: (cd Examples/ExampleBazelIntegration && bazelisk build //Subproject:Subproject //ExampleBazelIntegration:ExampleBazelIntegration) readme-validation: name: Check Markdown links