Skip to content

Commit 1e3a08c

Browse files
authored
fix(build): unblock Algolia prerendering for CI and macOS local builds (#1170)
* docs: document macOS bazelrc.user setup for production build CONTRIBUTING.mdの初回ビルド手順に、macOSでpnpm buildを通すための .bazelrc.userコピー手順をIMPORTANTコールアウトとして追記。 .bazelrc.user.exampleにも同等の日本語コメントを併記して コントリビューターが英語コメントを読まなくても意図を把握できるようにした。 macOSのBazel sandboxがプレレンダリング中のAlgolia API呼び出しを ブロックする問題はPR #1137で対処済みだが、CONTRIBUTING.mdに 言及がなく初回コントリビューターが踏むため、文書化する。 * ci: allow network in sandbox for Algolia API during SSR prerender build-ubuntu / adev-preview-build の両 workflow で pnpm run build が Algolia の RetryError で失敗していたため、 setup-bazel の bazelrc ブロックに --sandbox_default_allow_network を追加して sandbox からの egress を許可する。 build/.bazelrc 由来の --nosandbox_default_allow_network は home-tier の bazelrc(setup-bazel が書き出す)で上書きされる。
1 parent 02d5a20 commit 1e3a08c

4 files changed

Lines changed: 17 additions & 1 deletion

File tree

.bazelrc.user.example

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Local development settings for macOS
22
# Copy this file to .bazelrc.user to enable these settings.
3-
#
43
# macOS sandbox blocks network access during prerendering (Algolia API calls).
54
# Use local spawn strategy to allow network access.
5+
#
6+
# macOS向けのローカル開発設定です。
7+
# このファイルを .bazelrc.user という名前でコピーすると有効になります。
8+
# macOSのBazel sandboxは、プレレンダリング中のネットワークアクセス(Algolia API呼び出し)を
9+
# ブロックするため、sandboxを使わないlocal spawn strategyに切り替えて回避します。
610
build --spawn_strategy=local

.github/workflows/adev-preview-build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ jobs:
4141
build --jobs=2
4242
build --discard_analysis_cache
4343
build --nokeep_state_after_build
44+
# Allow network access in sandbox for Algolia API calls during SSR prerendering.
45+
build --sandbox_default_allow_network
4446
- run: pnpm install --frozen-lockfile
4547
- name: Build
4648
run: pnpm run build

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ jobs:
4545
build --jobs=2
4646
build --discard_analysis_cache
4747
build --nokeep_state_after_build
48+
# Allow network access in sandbox for Algolia API calls during SSR prerendering.
49+
build --sandbox_default_allow_network
4850
- run: pnpm install
4951
- name: Build
5052
run: pnpm run build

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ $ pnpm install
5454
$ pnpm build
5555
```
5656

57+
> [!IMPORTANT]
58+
> macOSでビルドする場合は、`pnpm build` を実行する前に `.bazelrc.user.example``.bazelrc.user` という名前でコピーしてください(`.bazelrc.user``.gitignore` 対象です)。
59+
> macOSのBazel sandboxがプレレンダリング中のネットワークアクセス(Algolia API呼び出し)をブロックするため、これがないとビルドが失敗します。
60+
>
61+
> ```
62+
> $ cp .bazelrc.user.example .bazelrc.user
63+
> ```
64+
5765
### 開発用サーバーを使った作業
5866
5967
開発用ローカルサーバーを起動すると、ビルド結果を確認しながら翻訳作業ができます。

0 commit comments

Comments
 (0)