: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
ci: skip docker image build when unused, harden e2e changes checkout (#59780)
Arno Hillen4fc0639479c9
diff --git a/.github/workflows/ci-e2e-playwright.yml b/.github/workflows/ci-e2e-playwright.ymlindex af5ef5085c89..0458b15b900f 100644--- a/.github/workflows/ci-e2e-playwright.yml+++ b/.github/workflows/ci-e2e-playwright.yml@@ -1,7 +1,7 @@## This workflow runs CI E2E tests with Playwright.#-# It relies on the container image built by 'container-images-ci.yml'.+# It relies on the posthog-node image built by 'ci-nodejs-container.yml'.#name: E2E CI Playwrighton:@@ -77,11 +77,20 @@ jobs:# fetch-depth=1000 + blob:none mirrors ci-backend / ci-dagster so HEAD^2# (PR branch tip) is reachable for the merge-base step below without the# cost of fetching blobs.+ #+ # sparse-checkout works around an actions/[email protected] flake: with+ # blob:none, the post-fetch `git checkout` lazy-fetches every blob in HEAD+ # and the per-blob credential lookup intermittently fails with "could not+ # read Username for github.com" (e.g. #59779 on 2026-05-23, blocked merge+ # until the job was retried). Materializing only the one file this job+ # reads collapses the lazy fetch to a single blob.- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:fetch-depth: 1000filter: blob:noneclean: false+ sparse-checkout: .github/clickhouse-versions.json+ sparse-checkout-cone-mode: false- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1id: app-tokendiff --git a/.github/workflows/container-images-ci.yml b/.github/workflows/container-images-ci.ymlindex b8b830630c31..72996729eb35 100644--- a/.github/workflows/container-images-ci.yml+++ b/.github/workflows/container-images-ci.yml@@ -2,6 +2,10 @@ name: Container Images CIon:pull_request:+ # Mirror ci-hobby.yml's trigger types so the `hobby-preview` label can+ # retroactively kick off a build. ci-hobby.yml omits `reopened`, so we+ # do too — otherwise reopens would build an image with no consumer.+ types: [opened, synchronize, labeled, unlabeled]merge_group:concurrency:@@ -17,9 +21,17 @@ jobs:permissions:contents: readpull-requests: read- # Set job outputs to values from filter stepoutputs:- docker_files: ${{ steps.filter.outputs.docker_files }}+ # The image is only consumed by ci-hobby.yml. Skip the ~20 min build+ # when ci-hobby would also skip, plus on changes to inputs that can+ # only break inside the Docker build (workflow self-edits, frontend+ # lockfile bumps that ci-hobby's filter ignores).+ should_build: >-+ ${{+ steps.filter.outputs.hobby == 'true'+ || steps.filter.outputs.build_inputs == 'true'+ || contains(github.event.pull_request.labels.*.name, 'hobby-preview')+ }}steps:- uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1id: app-token@@ -31,12 +43,41 @@ jobs:id: filterwith:token: ${{ steps.app-token.outputs.token || github.token }}- predicate-quantifier: 'every'filters: |- docker_files:- - '**'- - '!rust/**'- - '!livestream/**'+ # Keep `hobby:` in sync with the same-named filter in ci-hobby.yml —+ # drift means hobby waits for an image we never build (or vice versa).+ hobby:+ - Dockerfile+ - docker-compose.base.yml+ - docker-compose.hobby.yml+ - 'bin/deploy-hobby'+ - 'bin/hobby-ci.py'+ - 'bin/upgrade-hobby'+ - 'bin/migrate-*-hobby'+ - 'bin/docker'+ - 'bin/docker-worker'+ - 'bin/docker-worker-beat'+ - 'bin/docker-worker-celery'+ - 'bin/docker-server'+ - 'bin/docker-server-unit'+ - 'bin/celery-queues.env'+ - 'bin/migrate'+ - 'bin/migrate-check'+ - 'bin/posthog-node'+ - 'bin/hobby-installer/**'+ - 'docker/**'+ - uv.lock+ - .github/workflows/ci-hobby.yml+ # Inputs that can break inside the Docker build but aren't covered+ # by the `hobby:` filter — workflow self-edits, `.dockerignore`+ # (silently changes the build context), and `pnpm-lock.yaml` so+ # Renovate-style dep bumps are exercised on PR (otherwise they'd+ # only fail at merge_group / master push).+ build_inputs:+ - .github/workflows/container-images-ci.yml+ - .github/actions/build-n-cache-image/**+ - .dockerignore+ - pnpm-lock.yamlposthog_build:needs: changes@@ -48,7 +89,7 @@ jobs:id-token: write # allow issuing OIDC tokens for this workflow runcontents: read # allow at least reading the repo contents, add other permissions if necessary# Only on PostHog/posthog, as there's no docker login on forks- if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.docker_files == 'true') || github.event_name == 'merge_group' }}+ if: ${{ (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && needs.changes.outputs.should_build == 'true') || github.event_name == 'merge_group' }}outputs:digest: ${{ steps.build.outputs.digest }}