Skip to content

feat: support custom sourcemap intake endpoint for private deployments#5

Merged
Fiona2016 merged 1 commit into
publishfrom
feat/custom-sourcemap-endpoint
Jun 10, 2026
Merged

feat: support custom sourcemap intake endpoint for private deployments#5
Fiona2016 merged 1 commit into
publishfrom
feat/custom-sourcemap-endpoint

Conversation

@Fiona2016

Copy link
Copy Markdown
Collaborator

What

Adds a sourcemapEndpoint option to the plugin so ProGuard/R8 mapping files can be uploaded to a self-hosted RUM ingest (private deployment) instead of only the predefined Flashcat sites (CN / STAGING).

The endpoint can be provided three ways, resolved with the precedence extension DSL > flashcat-ci.json > FLASHCAT_SOURCEMAP_INTAKE_URL env var. If the value omits the /sourcemap/upload path it is appended automatically (trailing slashes / surrounding whitespace are tolerated).

flashcat {
    sourcemapEndpoint = "https://rum.example.com" // -> https://rum.example.com/sourcemap/upload
}

Why these two extra fixes

While verifying the feature two issues surfaced:

  1. Inconsistent precedence. sourcemapEndpoint resolved env before the CI config file (env wins), whereas site resolves CI config before env (CI wins). A user setting both an env var and flashcat-ci.json would get opposite behavior for the two settings. Aligned sourcemapEndpoint to the existing site order: extension > CI config > env.

  2. API-key validation / error pointed at the public site host. On an upload error the plugin validated the API key against https://api.<site>/api/v1/validate and reported site=<public host> — wrong for a private deployment on a different host. Now, when a custom endpoint is in use, the validation call is skipped (the validate URL for a private deployment is unknown) and errors reference the actual upload endpoint.

Tests

  • OkHttpUploaderTest (24): custom-endpoint upload, path resolution (resolveSourcemapUploadEndpoint), plus new cases for custom-endpoint 403 (→ InvalidApiKeyException, no validation request) and 400 (validation skipped).
  • MappingFileUploadTaskTest (26): three resolution sources + precedence; flipped the env-vs-CI test to assert CI now wins.
  • DdAndroidGradlePluginTest (34): config wiring.

All 84 tests pass locally (failures=0, errors=0).

Note: ./gradlew :…:build fails locally only because the bundled JaCoCo agent can't instrument JDK 21 (Unsupported class file major version 65). CI runs JDK 17, so this does not affect the pipeline.

Docs

README.md and 快速开始.md updated with the new option, env var, and flashcat-ci.json key.

🤖 Generated with Claude Code

Add a `sourcemapEndpoint` option so mapping files can be uploaded to a
self-hosted RUM ingest instead of the predefined Flashcat sites. The
endpoint can be set three ways, with precedence extension DSL > flashcat-ci.json
> FLASHCAT_SOURCEMAP_INTAKE_URL env var. When the value omits the
`/sourcemap/upload` path it is appended automatically.

Consistency & correctness:
- Align the env-vs-CI precedence for `sourcemapEndpoint` with the existing
  `site` resolution order (extension > CI config > env), instead of the
  previous extension > env > CI ordering.
- When a custom endpoint is in use, skip the API-key validation call against
  the predefined site's `api.*` host (its validate URL is unknown for a
  private deployment) and report errors against the actual upload endpoint
  rather than the misleading site hostname.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Fiona2016 Fiona2016 merged commit bafff82 into publish Jun 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant