Files
Tony d9088aeec6
ci / 📄 License Check (push) Has been cancelled
ci / ✅ Semantic Pull Request (push) Has been cancelled
ci / 🔤 Check Spelling (push) Has been cancelled
ci / 👀 Detect Changes (push) Has been cancelled
ci / 🎯 Build ${{ matrix.package }} (${{ matrix.os }}) (push) Has been cancelled
ci / 🎯 Build ${{ matrix.package }} (push) Has been cancelled
ci / 🔎 Verify ${{ matrix.package }} (push) Has been cancelled
ci / ci (push) Has been cancelled
Deploy Artifact Proxy Dev / ☁️ Artifact Proxy (push) Has been cancelled
Shorebird CI / changes (push) Has been cancelled
Shorebird CI / CSpell (push) Has been cancelled
Shorebird CI / artifact_proxy (push) Has been cancelled
Shorebird CI / dex (push) Has been cancelled
Shorebird CI / discord_gcp_alerts (push) Has been cancelled
Shorebird CI / flutter_version_resolver (push) Has been cancelled
Shorebird CI / jwt (push) Has been cancelled
Shorebird CI / scoped_deps (push) Has been cancelled
Shorebird CI / shorebird_build_trace (push) Has been cancelled
Shorebird CI / shorebird_ci (push) Has been cancelled
Shorebird CI / shorebird_cli (push) Has been cancelled
Shorebird CI / shorebird_code_push_client (push) Has been cancelled
Shorebird CI / shorebird_code_push_protocol (push) Has been cancelled
Shorebird CI / shorebird_redis_client (push) Has been cancelled
Shorebird CI / stripe_api (push) Has been cancelled
Shorebird CI / required (push) Has been cancelled
Refactor Shorebird CLI to support configurable URLs and improve test coverage
- Updated AAR releaser test to use ShorebirdProcess.defaultFlutterStorageBaseUrl.
- Changed macOS releaser test to reference a new troubleshooting URL.
- Enhanced shorebird_yaml_test with deserialization for AOT patch metadata.
- Modified network_checker_test to check self-hosted URLs from ShorebirdEnv.
- Added tests for artifact paths in shorebird_artifacts_test.
- Updated shorebird_cli_command_runner_test to reflect new repository URL.
- Improved shorebird_env_test with additional tests for shorebirdRoot and engine revision fallback.
- Adjusted shorebird_flutter_test to use environment variables for Flutter Git URL.
- Updated shorebird_process_test to utilize default Flutter storage URL.
- Enhanced shorebird_validator_test to link to the default hosted URL.
- Updated shorebird_web_console_test to use the configured hosted URL.
- Refactored code_push_client to use default hosted URL for API requests.
- Updated README and generation scripts for the code_push_protocol package to reflect new OpenAPI spec source.
- Modified shared.sh to allow configurable Flutter repository and storage URLs.

Signed-off-by: Tony <tonylu@tony-cloud.com>
2026-06-25 17:21:56 +08:00

91 lines
3.1 KiB
Markdown

# Artifact Proxy
This is a tool for proxying Flutter artifacts from a derived Flutter engine
revision back to the base Flutter engine revision. This is useful for
when you need to modify _some_ of the Flutter artifacts but not all of them.
This is a development tool which maps requests to configurable artifact origins.
By default, Flutter artifacts are redirected to the public Flutter storage
origin and Shorebird-specific artifacts are redirected to the local open mirror
root at `http://localhost:8080/artifacts`.
## Usage
Uses `config.dart` to configure recognized artifact URL patterns. Runtime
origins are configured with environment variables:
- `SHOREBIRD_ARTIFACT_BASE_URL`: root for open Shorebird manifests and
artifacts, defaulting to `http://localhost:8080/artifacts`
- `ARTIFACT_PROXY_FLUTTER_BASE_URL`: root for upstream Flutter artifacts,
defaulting to `https://storage.googleapis.com`
```bash
# Run locally with hot-reload enabled.
PORT=8081 DEV=true dart --enable-vm-service run bin/server.dart
```
And then in a separate terminal:
```
FLUTTER_STORAGE_BASE_URL=http://localhost:8081 flutter precache -a
```
You should use a separate checkout of Flutter when running this, so you don't
poison the cache of your main Flutter checkout.
## Updating config.dart
If you run into 404s when fetching artifacts, ensure that the expected manifest
exists at:
```text
$SHOREBIRD_ARTIFACT_BASE_URL/shorebird/$engineRevision/artifacts_manifest.yaml
```
If it does, you may need to update the artifact list in `config.dart` and, if
the artifact is one we're providing, add it in
`../../../scripts/write_artifact_manifest.py`.
To do so, point Flutter at this proxy with `FLUTTER_STORAGE_BASE_URL`, run a
Shorebird/Flutter command that downloads the missing artifact, then add the
observed URL pattern to `packages/artifact_proxy/lib/config.dart`.
If you changed Flutter tool code while debugging, remove the flutter_tools
snapshot:
```bash
cd bin/cache/flutter/bin/cache
rm flutter_tools.s*
```
- Run a Shorebird command (`shorebird run` works well).
- For each artifact that 404s, add a line to
`packages/artifact_proxy/lib/config.dart`, following the conventions for
capturing engine revisions and escaping relevant characters.
## Generating an `artifacts_manifest.yaml`
To generate a new `artifacts_manifest.yaml` for a specific Flutter engine
revision, use the workspace helper:
```
../../../scripts/write_artifact_manifest.py \
--flutter-engine-revision <flutter_engine_revision> \
--output artifacts_manifest.yaml
```
`--flutter-engine-revision` is the upstream Flutter engine revision used for
unchanged artifacts. Upload the generated file under the custom Shorebird engine
revision path shown below.
Then upload the `artifacts_manifest.yaml` to:
```text
$SHOREBIRD_ARTIFACT_BASE_URL/shorebird/<shorebird_engine_revision>/artifacts_manifest.yaml
```
The GitHub CI engine artifacts include a `mirror/` subtree for the override
files listed by this manifest. Copy the contents of that subtree to
`$SHOREBIRD_ARTIFACT_BASE_URL` alongside the manifest and `patch-*.zip`
artifacts.