Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

chore(ci): gate Trunk test-span uploads behind a repo variable (#72143)

Georges-Antoine Assi4cbf324038f4
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index 15987890df58..ea8c3e9d4f77 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -22,7 +22,10 @@
# failure" step owns the pass/fail verdict. The shadow strips all of it — no
# Trunk posting from a non-blocking timing trial — and so also omits the test
# steps' continue-on-error and that verdict step, letting each shard's test
-# exit code be the verdict directly)
+# exit code be the verdict directly. Canonical now also gates each quarantine
+# gate on the TRUNK_UPLOAD_ENABLED repo variable as a kill-switch; since the
+# shadow strips the gate entirely, that variable is a no-op here and there is
+# nothing to mirror)
# - Per-test failure rollup: canonical's django_tests gate uploads product JUnit and, when a
# test job fails, downloads that shard's JUnit to list the actual failing tests. The shadow
# strips artifact uploads (above), so it has nothing to download and keeps the plain
diff --git a/.github/workflows/ci-ai.yml b/.github/workflows/ci-ai.yml
index ddfe8a1ed6c5..cc0a97f2bcab 100644
--- a/.github/workflows/ci-ai.yml
+++ b/.github/workflows/ci-ai.yml
@@ -204,8 +204,10 @@ jobs:
# Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
# so a Trunk outage never fails the job. Runs the token only on internal PRs,
# master, and the merge queue — never on fork PRs or Dependabot, which have no secret.
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this upload skips.
- name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
continue-on-error: true
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
diff --git a/.github/workflows/ci-backend.yml b/.github/workflows/ci-backend.yml
index 8a5f1585e920..fc81a47098f2 100644
--- a/.github/workflows/ci-backend.yml
+++ b/.github/workflows/ci-backend.yml
@@ -891,10 +891,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
# the verdict, so a Trunk outage can't red a passing shard. Internal PRs only (needs the
# secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: products/*/junit-product.xml
@@ -2946,10 +2948,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
# the verdict, so a Trunk outage can't red a passing shard. Internal PRs only (needs the
# secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate (Core)
id: quarantine_gate_core
continue-on-error: true
- if: ${{ !cancelled() && matrix.segment == 'Core' && needs.changes.outputs.backend == 'true' && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && matrix.segment == 'Core' && needs.changes.outputs.backend == 'true' && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: junit-core.xml
@@ -2961,7 +2965,7 @@ jobs:
- name: Quarantine gate (Temporal)
id: quarantine_gate_temporal
continue-on-error: true
- if: ${{ !cancelled() && matrix.segment == 'Temporal' && needs.changes.outputs.backend == 'true' && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && matrix.segment == 'Temporal' && needs.changes.outputs.backend == 'true' && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: junit-temporal.xml
diff --git a/.github/workflows/ci-dagster.yml b/.github/workflows/ci-dagster.yml
index 4f9d0581fd44..25258112b691 100644
--- a/.github/workflows/ci-dagster.yml
+++ b/.github/workflows/ci-dagster.yml
@@ -437,8 +437,10 @@ jobs:
# Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
# so a Trunk outage never fails the job. Runs the token only on internal PRs,
# master, and the merge queue — never on fork PRs or Dependabot, which have no secret.
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this upload skips.
- name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
continue-on-error: true
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.yml
index d8c74c24ab63..33c8ed5a432f 100644
--- a/.github/workflows/ci-e2e-playwright.yml
+++ b/.github/workflows/ci-e2e-playwright.yml
@@ -963,10 +963,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on Playwright failure" step
# below is the verdict, so a Trunk outage can't red a passing job. Internal PRs only
# (needs the secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: playwright/junit-results.xml
diff --git a/.github/workflows/ci-frontend.yml b/.github/workflows/ci-frontend.yml
index f26f5097edd2..ea56d816cd82 100644
--- a/.github/workflows/ci-frontend.yml
+++ b/.github/workflows/ci-frontend.yml
@@ -695,10 +695,12 @@ jobs:
# the verdict, so a Trunk outage can't red a passing shard. FOSS and EE share test files,
# so each segment uploads under its own variant. Internal PRs only (needs the secret);
# cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: junit-results/junit-${{ matrix.segment }}-${{ matrix.chunk }}.xml
@@ -753,10 +755,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on jest failure" step below is
# the verdict. See the jest job for the full rationale. cli-version pinned, not 'latest'.
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: junit-results/junit-replay-shared.xml
diff --git a/.github/workflows/ci-llm-gateway.yml b/.github/workflows/ci-llm-gateway.yml
index bc46354460d9..907b56622602 100644
--- a/.github/workflows/ci-llm-gateway.yml
+++ b/.github/workflows/ci-llm-gateway.yml
@@ -104,10 +104,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
# the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
# secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: services/llm-gateway/junit.xml
diff --git a/.github/workflows/ci-mcp.yml b/.github/workflows/ci-mcp.yml
index cb33301d6209..d3dfc1ade326 100644
--- a/.github/workflows/ci-mcp.yml
+++ b/.github/workflows/ci-mcp.yml
@@ -578,10 +578,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
# the verdict, so a Trunk outage can't red a passing job. Internal PRs only (needs the
# secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: services/mcp/junit-integration.xml
diff --git a/.github/workflows/ci-nodejs.yml b/.github/workflows/ci-nodejs.yml
index bfb301bcd9b3..247bc30588ff 100644
--- a/.github/workflows/ci-nodejs.yml
+++ b/.github/workflows/ci-nodejs.yml
@@ -403,10 +403,12 @@ jobs:
# Best-effort Trunk upload (continue-on-error); the "Fail on test failure" step below is
# the verdict, so a Trunk outage can't red a passing shard. Internal PRs only (needs the
# secret); cli-version pinned, not 'latest' (skips the release redirect).
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this gate skips, so nothing uploads and no known flakes are quarantined.
- name: Quarantine gate
id: quarantine_gate
continue-on-error: true
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
junit-paths: junit-results/junit-*.xml
diff --git a/.github/workflows/ci-python.yml b/.github/workflows/ci-python.yml
index 8fb515316b01..891fc2f2638b 100644
--- a/.github/workflows/ci-python.yml
+++ b/.github/workflows/ci-python.yml
@@ -237,8 +237,10 @@ jobs:
# Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
# so a Trunk outage never fails the job. Runs the token only on internal PRs,
# master, and the merge queue — never on fork PRs or Dependabot, which have no secret.
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this upload skips.
- name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
continue-on-error: true
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
diff --git a/.github/workflows/ci-rust.yml b/.github/workflows/ci-rust.yml
index b06e4e9577d5..8909f20bcdf5 100644
--- a/.github/workflows/ci-rust.yml
+++ b/.github/workflows/ci-rust.yml
@@ -470,8 +470,10 @@ jobs:
# Upload results to Trunk for flaky-test detection. Non-gating (continue-on-error),
# so a Trunk outage never fails the job. Runs the token only on internal PRs,
# master, and the merge queue — never on fork PRs or Dependabot, which have no secret.
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this upload skips.
- name: Upload test results to Trunk
- if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' }}
+ if: ${{ !cancelled() && env.RUNS_ON_INTERNAL_PR == 'true' && github.repository == 'PostHog/posthog' && github.actor != 'dependabot[bot]' && vars.TRUNK_UPLOAD_ENABLED == 'true' }}
continue-on-error: true
uses: trunk-io/analytics-uploader@385f1ccdf345b4532dc4b6c665dd432b702b8e28 # v2.1.2
with:
diff --git a/.github/workflows/ci-storybook.yml b/.github/workflows/ci-storybook.yml
index 6c06a04b3df5..8fd927f48457 100644
--- a/.github/workflows/ci-storybook.yml
+++ b/.github/workflows/ci-storybook.yml
@@ -995,7 +995,9 @@ jobs:
# Storybook CI is skipped on merge_group, so visual-regression won't run there;
# != 'skipped' keeps this from spinning a runner that downloads nothing, while still
# uploading failed-test results (the flake signal Trunk needs) on master push.
- if: always() && github.repository == 'PostHog/posthog' && github.event_name != 'pull_request' && needs.visual-regression.result != 'skipped'
+ # The TRUNK_UPLOAD_ENABLED repo variable is the kill-switch: when it is not 'true'
+ # this job skips, so no results upload.
+ if: always() && github.repository == 'PostHog/posthog' && github.event_name != 'pull_request' && needs.visual-regression.result != 'skipped' && vars.TRUNK_UPLOAD_ENABLED == 'true'
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with: