diff --git a/.env.example b/.env.example index 8064091ff..b64fabba7 100644 --- a/.env.example +++ b/.env.example @@ -10,3 +10,6 @@ POSTHOG_PERSONAL_API_KEY=phx_... # POSTHOG_REGION is optional, defaults to 'us'. Can also be passed via --region flag or workflow input. # POSTHOG_REGION=us POSTHOG_WIZARD_PROJECT_ID=123 + +# Optional: upload key for the source-maps e2e. Defaults to POSTHOG_PERSONAL_API_KEY (needs error_tracking:write). +# SOURCE_MAPS_CLI_KEY=phx... diff --git a/.github/workflows/wizard-ci.yml b/.github/workflows/wizard-ci.yml index 8d515df74..404bde455 100644 --- a/.github/workflows/wizard-ci.yml +++ b/.github/workflows/wizard-ci.yml @@ -665,6 +665,8 @@ jobs: POSTHOG_REGION: ${{ needs.discover.outputs.input_posthog_region }} POSTHOG_PERSONAL_API_KEY: ${{ secrets.GH_APP_POSTHOG_WIZARD_CI_BOT_POSTHOG_PERSONAL_KEY }} POSTHOG_WIZARD_PROJECT_ID: ${{ secrets.GH_APP_POSTHOG_WIZARD_CI_BOT_TARGET_PROJECT_ID }} + # The existing CI key, now with error_tracking:write, doubles as the source-maps upload key. + SOURCE_MAPS_CLI_KEY: ${{ secrets.GH_APP_POSTHOG_WIZARD_CI_BOT_POSTHOG_PERSONAL_KEY }} WIZARD_PATH: ${{ env.WIZARD_PATH }} CONTEXT_MILL_PATH: ${{ env.CONTEXT_MILL_PATH }} WIZARD_REF: ${{ needs.discover.outputs.input_wizard_ref }} diff --git a/apps/manifest.json b/apps/manifest.json index 33e8a77a5..0aaa1f733 100644 --- a/apps/manifest.json +++ b/apps/manifest.json @@ -69,7 +69,7 @@ "dir": "error-tracking-upload-source-maps", "label": "Upload Source Maps", "description": "Wire up PostHog Error Tracking source-map upload", - "ciCapable": false + "ciCapable": true } ] } diff --git a/services/wizard-ci/e2e.ts b/services/wizard-ci/e2e.ts index fe06efbf8..17d87f5cb 100644 --- a/services/wizard-ci/e2e.ts +++ b/services/wizard-ci/e2e.ts @@ -152,6 +152,8 @@ export function runE2e(opts: E2eOptions): number { for (const k of Object.keys(childEnv)) if (STRIP_HOST_AUTH.test(k)) delete childEnv[k]; childEnv.POSTHOG_PERSONAL_API_KEY = apiKey; + // The source-maps upload key defaults to the CI key (which has error_tracking:write); SOURCE_MAPS_CLI_KEY overrides it locally. + childEnv.SOURCE_MAPS_CLI_KEY = process.env.SOURCE_MAPS_CLI_KEY ?? apiKey; childEnv.APP_DIR = appDir; childEnv.PROJECT_ID = projectId; childEnv.POSTHOG_REGION = region; @@ -176,10 +178,12 @@ export function runE2e(opts: E2eOptions): number { /* harness crashed before writing */ } - // The integration flow ends at keep-skills/skillsComplete; other programs - // (e.g. self-driving) end at their own outro, so assert against that instead. - const isIntegration = !opts.program || opts.program === "posthog-integration"; - const programChecks: Array<[string, boolean]> = isIntegration + // Integration and source-maps end at keep-skills; terminal-outro programs (self-driving) assert the outro. + const endsAtKeepSkills = + !opts.program || + opts.program === "posthog-integration" || + opts.program === "error-tracking-upload-source-maps"; + const programChecks: Array<[string, boolean]> = endsAtKeepSkills ? [ ["full interactive flow reached keep-skills", !!result?.screenPath?.includes("keep-skills")], ["skillsComplete", result?.skillsComplete === true],