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 depot ci-backend shadow behind toggle variable (#60992)

Raúl Negrón-Otero7be4ac234019
diff --git a/.depot/workflows/ci-backend.yml b/.depot/workflows/ci-backend.yml
index e0a022d94fad..dce78747df07 100644
--- a/.depot/workflows/ci-backend.yml
+++ b/.depot/workflows/ci-backend.yml
@@ -25,6 +25,13 @@
# If these tests get too slow, look at increasing concurrency and re-timing the tests by manually dispatching
# .depot/workflows/ci-backend-update-test-timing.yml action
name: Backend CI
+# Every job is gated on the CI_ENABLE_DEPOT_SHADOW Depot CI variable (see the `changes`
+# job): `true` runs the shadow, anything else (incl. unset) skips it. This is a Depot
+# variable, NOT a GitHub one — Depot CI reads its own `vars` store. Toggle with:
+# depot ci vars add CI_ENABLE_DEPOT_SHADOW=true --repo PostHog/posthog (enable)
+# depot ci vars remove CI_ENABLE_DEPOT_SHADOW --repo PostHog/posthog (disable)
+# The companion drift check (.github/workflows/ci-backend-shadow-drift.yml) runs on
+# GitHub Actions and reads a same-named GitHub repository variable — set both.
on:
push:
branches:
@@ -88,6 +95,10 @@ jobs:
# Job to decide if we should run backend ci
# See https://github.com/dorny/paths-filter#conditional-execution for more details
changes:
+ # Shadow on/off switch. `changes` is the root of the `needs` graph, so gating
+ # it skips every downstream job. `django_tests` repeats the gate because its
+ # `always()` would otherwise survive the skip cascade.
+ if: vars.CI_ENABLE_DEPOT_SHADOW == 'true'
runs-on: depot-ubuntu-latest # was: ubuntu-latest. Mapped standard GitHub runner to Depot equivalent.
timeout-minutes: 5
name: Determine need to run backend and migration checks
@@ -1146,7 +1157,9 @@ jobs:
name: Django Tests Pass
runs-on: depot-ubuntu-latest # was: ubuntu-latest. Mapped standard GitHub runner to Depot equivalent.
timeout-minutes: 5
- if: always()
+ # always() collates skipped/failed matrix jobs; gated so it doesn't spin up a
+ # lone runner when the shadow is off.
+ if: always() && vars.CI_ENABLE_DEPOT_SHADOW == 'true'
steps:
- name: Check matrix outcome
run: |
diff --git a/.github/workflows/ci-backend-shadow-drift.yml b/.github/workflows/ci-backend-shadow-drift.yml
index def77251641a..8d2236efb8bf 100644
--- a/.github/workflows/ci-backend-shadow-drift.yml
+++ b/.github/workflows/ci-backend-shadow-drift.yml
@@ -6,7 +6,12 @@ name: Backend CI shadow drift check
# without this check, canonical drifts silently and the depot timing trial stops
# measuring the same work.
#
-# Cheap to run — only triggers when one of the two files changes.
+# Cheap to run — only triggers when one of the two files changes. Gated on the
+# CI_ENABLE_DEPOT_SHADOW GitHub repository variable so drift enforcement tracks the
+# shadow's on/off state — no point keeping the shadow in sync while it is off. This
+# workflow runs on GitHub Actions, so its `vars` come from GitHub (Settings →
+# Secrets and variables → Actions → Variables), separate from the same-named Depot
+# CI variable that gates the shadow itself.
on:
pull_request:
@@ -24,6 +29,7 @@ concurrency:
jobs:
check:
name: Both ci-backend files updated together
+ if: vars.CI_ENABLE_DEPOT_SHADOW == 'true'
runs-on: ubuntu-latest
# 5 min absorbs cold-runner startup + the explicit depth=100 fetch of BASE_SHA below.
# `actions/checkout` defaults to depth=1 (HEAD only); a full-history clone is unnecessary