: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(tasks): resolve latest hogland CLI release, use the deployer app (#90207)
Tom Owers1da7701c2539
diff --git a/.github/workflows/cd-tasks-golden-snapshot.yml b/.github/workflows/cd-tasks-golden-snapshot.ymlindex 2a9da4e23e6a..09fe377ef4e0 100644--- a/.github/workflows/cd-tasks-golden-snapshot.yml+++ b/.github/workflows/cd-tasks-golden-snapshot.yml@@ -335,40 +335,51 @@ jobs:id: hogland-tokenuses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1with:- app-id: ${{ secrets.GH_APP_HOGLAND_CLI_APP_ID }}- private-key: ${{ secrets.GH_APP_HOGLAND_CLI_PRIVATE_KEY }}+ app-id: ${{ secrets.GH_APP_HOGLAND_DEPLOYER_APP_ID }}+ private-key: ${{ secrets.GH_APP_HOGLAND_DEPLOYER_PRIVATE_KEY }}owner: PostHogrepositories: hogland-- # Build the CLI from a released, immutable tag, never a moving branch- # like main — a rebuilt CLI must be reproducible across bakes. Require- # at least v1.5.0-cli: every flag and JSON field the bake/smoke scripts- # use (notably --kind) exists from that tag; older tags predate them.- - name: Require a pinned hogland CLI tag+ # Read-only: the deployer App may hold write on hogland, but+ # this job only reads it — checks out the CLI source to build,+ # and the quiet-window guard lists hogland Actions runs.+ permission-contents: read+ permission-actions: read++ # Build the CLI from the newest released vX.Y.Z-cli tag: immutable+ # and reviewed, never a moving branch like main (which would run+ # unreviewed CLI code in this credentialed job). Resolved at runtime,+ # so there is no HOGLAND_CLI_REF var to bump on each CLI release — the+ # CLI only orchestrates the bake (create/snapshot/alias) and does not+ # change the golden's contents. Still guard the minimum the scripts need.+ - name: Resolve latest hogland CLI releaseif: env.skip != 'true'+ id: cli-refenv:- CLI_REF: ${{ vars.HOGLAND_CLI_REF }}+ GH_TOKEN: ${{ steps.hogland-token.outputs.token }}run: |set -euo pipefailMIN_CLI_VERSION=1.5.0- if [[ ! "$CLI_REF" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-cli$ ]]; then- echo "::error::HOGLAND_CLI_REF must be a released vX.Y.Z-cli tag (got '${CLI_REF:-<unset>}'); a moving branch like main is not allowed"+ ref=$(gh api --paginate repos/PostHog/hogland/releases --jq '.[].tag_name' \+ | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+-cli$' | sort -V | tail -1)+ if [[ -z "$ref" ]]; then+ echo "::error::no vX.Y.Z-cli release found on PostHog/hogland"exit 1fi- cli_version="${CLI_REF#v}"- cli_version="${cli_version%-cli}"+ cli_version="${ref#v}"; cli_version="${cli_version%-cli}"lowest=$(printf '%s\n%s\n' "$MIN_CLI_VERSION" "$cli_version" | sort -V | head -1)if [[ "$cli_version" != "$MIN_CLI_VERSION" && "$lowest" != "$MIN_CLI_VERSION" ]]; then- echo "::error::HOGLAND_CLI_REF ${CLI_REF} is below the minimum v${MIN_CLI_VERSION}-cli; the bake relies on flags/fields introduced there"+ echo "::error::latest hogland CLI release ${ref} is below the minimum v${MIN_CLI_VERSION}-cli"exit 1fi+ echo "ref=${ref}" >> "$GITHUB_OUTPUT"+ echo "::notice::building hogland CLI from ${ref}"- name: Check out hogland CLI sourceif: env.skip != 'true'uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2with:repository: PostHog/hogland- ref: ${{ vars.HOGLAND_CLI_REF }}+ ref: ${{ steps.cli-ref.outputs.ref }}token: ${{ steps.hogland-token.outputs.token }}path: hogland-srcdiff --git a/products/tasks/backend/sandbox/images/hogland/GOLDEN_CI_RUNBOOK.md b/products/tasks/backend/sandbox/images/hogland/GOLDEN_CI_RUNBOOK.mdindex 046058f18184..3477fffd2d5b 100644--- a/products/tasks/backend/sandbox/images/hogland/GOLDEN_CI_RUNBOOK.md+++ b/products/tasks/backend/sandbox/images/hogland/GOLDEN_CI_RUNBOOK.md@@ -125,9 +125,9 @@ For **each** cluster the workflow targets (dev, then prod-us):- `HOG_TASKS_GOLDEN_PROD_ENABLED=true` — second arm for prod-targetingclusters. The prod-us leg stays a no-op until this is set, so it does notfail nightly before its own principal + TrustMapping exist.- - `HOGLAND_CLI_REF` (**required**) — the `PostHog/hogland` ref to build the CLI- from. Must be a released `v*-cli` tag; the workflow fails if it is unset or- not a `*-cli` tag (a moving branch like `main` is not reproducible).+ - No `HOGLAND_CLI_REF` needed — the workflow resolves the newest released+ `vX.Y.Z-cli` tag from `PostHog/hogland` at runtime (immutable and reviewed,+ never `main`), guarding a `v1.5.0-cli` minimum.- The quiet-window guard's rollout workflow is **per cluster**, hardcoded in thebake matrix (dev: `deploy.yml`, prod-us: `promote-to-prod.yml`) — not a sharedvar, because the two clusters roll out through different workflows. The guard@@ -138,9 +138,12 @@ For **each** cluster the workflow targets (dev, then prod-us):cluster means adding its rollout workflow file to the matrix.- `TS_HOGLAND_CI_CLIENT_ID`, `TS_HOGLAND_CI_AUDIENCE` — shared with`hogbox-preview-env.yml`; already present if preview is provisioned.-- **Secrets** — a GitHub App with read access to `PostHog/hogland` (for the CLI- checkout), exposed as `GH_APP_HOGLAND_CLI_APP_ID` +- `GH_APP_HOGLAND_CLI_PRIVATE_KEY`. See `/managing-github-actions-secrets`.+- **Secrets** — the workflow checks out `PostHog/hogland` to build the CLI with+ the existing `GH_APP_HOGLAND_DEPLOYER` GitHub App (org secrets+ `GH_APP_HOGLAND_DEPLOYER_APP_ID` + `GH_APP_HOGLAND_DEPLOYER_PRIVATE_KEY`),+ minted read-only: `contents: read` for the checkout, `actions: read` so the+ quiet-window guard can list hogland rollout runs. The App must be installed on+ `PostHog/hogland` with both.## Running it