: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
fix(error-tracking): attach git metadata to frontend releases (#82753)
Hugues Pouillote8569607cd25
diff --git a/.github/workflows/container-images-cd.yml b/.github/workflows/container-images-cd.ymlindex c8c03a9befe8..65e4f13544cf 100644--- a/.github/workflows/container-images-cd.yml+++ b/.github/workflows/container-images-cd.yml@@ -125,8 +125,16 @@ jobs:labels: ${{ steps.docker-meta.outputs.labels }}annotations: ${{ steps.docker-meta.outputs.annotations }}platforms: linux/arm64,linux/amd64+ # The GITHUB_* args become the git metadata on the error tracking release the+ # sourcemap upload stage creates. That stage builds in a container with no .git+ # directory, so the workflow has to hand them in (see Dockerfile).build-args: |COMMIT_HASH=${{ github.sha }}+ GITHUB_ACTIONS=true+ GITHUB_SHA=${{ github.sha }}+ GITHUB_REF_NAME=${{ github.ref_name }}+ GITHUB_REPOSITORY=${{ github.repository }}+ GITHUB_SERVER_URL=${{ github.server_url }}secrets: |posthog_upload_sourcemaps_cli_api_key=${{ secrets.POSTHOG_UPLOAD_SOURCEMAPS_CLI_API_KEY }}@@ -194,8 +202,16 @@ jobs:labels: ${{ steps.docker-meta.outputs.labels }}annotations: ${{ steps.docker-meta.outputs.annotations }}platforms: linux/arm64,linux/amd64+ # The GITHUB_* args become the git metadata on the error tracking release the+ # sourcemap upload stage creates. That stage builds in a container with no .git+ # directory, so the workflow has to hand them in (see Dockerfile).build-args: |COMMIT_HASH=${{ github.sha }}+ GITHUB_ACTIONS=true+ GITHUB_SHA=${{ github.sha }}+ GITHUB_REF_NAME=${{ github.ref_name }}+ GITHUB_REPOSITORY=${{ github.repository }}+ GITHUB_SERVER_URL=${{ github.server_url }}secrets: |posthog_upload_sourcemaps_cli_api_key=${{ secrets.POSTHOG_UPLOAD_SOURCEMAPS_CLI_API_KEY }}diff --git a/Dockerfile b/Dockerfileindex cf51198948f6..fb7a8a9863e9 100644--- a/Dockerfile+++ b/Dockerfile@@ -75,6 +75,22 @@ COPY --from=frontend-build /code/frontend/dist /code/frontend/dist# curl -LsSf "https://github.com/PostHog/posthog/releases/download/posthog-cli%2Fv<X.Y.Z>/posthog-cli-installer.sh" | sha256sumARG POSTHOG_CLI_VERSION=0.11.0ARG POSTHOG_CLI_INSTALLER_SHA256=74b0e2d967b688f57432be5bbb78f96cb5dde69f9283c0d8930a01efc132fbc2+# The CLI stamps the release it creates with git metadata (branch, remote, repo name) read from the+# GitHub Actions environment. Only frontend/dist is copied into this stage, so there is no .git+# directory to fall back on: without these the release is created with no link back to the code it+# was built from, and the CLI skips the metadata silently because --release-name/--release-version+# already let it create the release. The CLI treats empty values as absent, so local builds that+# pass none of these behave as before.+ARG GITHUB_ACTIONS+ARG GITHUB_SHA+ARG GITHUB_REF_NAME+ARG GITHUB_REPOSITORY+ARG GITHUB_SERVER_URL+ENV GITHUB_ACTIONS=$GITHUB_ACTIONS \+ GITHUB_SHA=$GITHUB_SHA \+ GITHUB_REF_NAME=$GITHUB_REF_NAME \+ GITHUB_REPOSITORY=$GITHUB_REPOSITORY \+ GITHUB_SERVER_URL=$GITHUB_SERVER_URLRUN --mount=type=secret,id=posthog_upload_sourcemaps_cli_api_key \if ( \[ -f /run/secrets/posthog_upload_sourcemaps_cli_api_key ] && \