: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
feat(hogql): publish language service image (#97365)
Paweł Szczurd1f704cd282b
diff --git a/.github/workflows/cd-hogql-lang-service-image.yml b/.github/workflows/cd-hogql-lang-service-image.ymlnew file mode 100644index 000000000000..41f5ba1871ef--- /dev/null+++ b/.github/workflows/cd-hogql-lang-service-image.yml@@ -0,0 +1,123 @@+name: HogQL Language Service Container Image CD++on:+ push:+ branches:+ - master+ paths:+ - 'services/hogql-language-service/**'+ - '.github/workflows/cd-hogql-lang-service-image.yml'+ workflow_dispatch:++concurrency:+ group: ${{ github.workflow }}-${{ github.sha }}+ cancel-in-progress: false++jobs:+ build:+ name: Build and push container image+ if: |+ github.repository_owner == 'PostHog' &&+ (+ github.event_name == 'push' ||+ (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/master')+ )+ runs-on: depot-ubuntu-24.04+ timeout-minutes: 30+ permissions:+ contents: read+ packages: write+ id-token: write++ outputs:+ sha: ${{ steps.push.outputs.digest }}++ steps:+ - name: Check out+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2+ with:+ sparse-checkout: |+ services/hogql-language-service/+ .github/actions/docker-meta/+ sparse-checkout-cone-mode: false++ - name: Docker meta and registry login+ id: docker-meta+ uses: ./.github/actions/docker-meta+ with:+ image-name: hogql-lang-service+ aws-role-to-assume: ${{ vars.AWS_ECR_POSTHOG_MASTER_PUBLISH_IAM_ROLE }}+ github-token: ${{ secrets.GITHUB_TOKEN }}+ dockerhub-username: ${{ secrets.DOCKERHUB_USER }}+ dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}+ push-to-ghcr: 'false'+ push-to-dockerhub: 'false'++ - name: Set up Depot CLI+ uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1++ - name: Build and push container image+ id: push+ uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0+ with:+ project: c1f2m5s6zd+ context: ./services/hogql-language-service+ file: ./services/hogql-language-service/Dockerfile+ buildx-fallback: false+ push: ${{ github.ref == 'refs/heads/master' && vars.CD_DEPLOY_ENABLED == 'true' }}+ tags: ${{ steps.docker-meta.outputs.tags }}+ labels: ${{ steps.docker-meta.outputs.labels }}+ annotations: ${{ steps.docker-meta.outputs.annotations }}+ platforms: linux/arm64,linux/amd64+ build-args: COMMIT_HASH=${{ github.sha }}++ deploy:+ name: Trigger HogQL language service deployment+ runs-on: ubuntu-24.04+ timeout-minutes: 5+ needs: build+ if: github.event_name == 'push' && github.repository_owner == 'PostHog' && vars.CD_DEPLOY_ENABLED == 'true' && github.ref == 'refs/heads/master'+ permissions: {}++ steps:+ - name: Get deployer token+ id: deployer+ uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1+ with:+ client-id: ${{ secrets.GH_APP_CHARTS_DEPLOYER_APP_ID }}+ private-key: ${{ secrets.GH_APP_CHARTS_DEPLOYER_PRIVATE_KEY }}+ owner: PostHog+ repositories: charts++ - name: Get PR labels+ id: labels+ uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1+ with:+ script: |+ const { data: pulls } = await github.rest.repos.listPullRequestsAssociatedWithCommit({+ owner: context.repo.owner,+ repo: context.repo.repo,+ commit_sha: context.sha,+ });+ const labels = pulls.flatMap(pr => pr.labels.map(l => l.name));+ return JSON.stringify([...new Set(labels)]);++ - name: Trigger HogQL language service deployment+ uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1+ with:+ token: ${{ steps.deployer.outputs.token }}+ repository: PostHog/charts+ event-type: commit_state_update+ client-payload: |+ {+ "values": {+ "image": {+ "sha": "${{ needs.build.outputs.sha }}"+ }+ },+ "release": "hogql-lang-service",+ "commit": ${{ toJson(github.event.head_commit) }},+ "repository": ${{ toJson(github.repository) }},+ "labels": ${{ steps.labels.outputs.result }},+ "timestamp": "${{ github.event.head_commit.timestamp }}"+ }diff --git a/hogli.yaml b/hogli.yamlindex 477386f69b93..210ff4ab82c5 100644--- a/hogli.yaml+++ b/hogli.yaml@@ -394,6 +394,9 @@ start:services:- redishidden: true+ start:hogql-lang-service:+ cmd: env GOTOOLCHAIN=auto HOGQL_LANGUAGE_SERVICE_ALLOW_INSECURE=1 MAX_CATALOGS=2 CATALOG_CACHE_MAX_BYTES=268435456 go -C services/hogql-language-service run ./cmd/server+ description: Run the HogQL language service locally with a two-catalog cachestart:celery:bin_script: start-celerydescription: Start Celery worker or beat scheduler with auto-reloaddiff --git a/services/hogql-language-service/README.md b/services/hogql-language-service/README.mdindex 4847d25b187a..39d4c6e09198 100644--- a/services/hogql-language-service/README.md+++ b/services/hogql-language-service/README.md@@ -4,10 +4,10 @@ This prototype keeps multiple immutable, permission-filtered catalogs in memoryIt uses `github.com/orian/clickhouse-sql-parser` to recover table and alias context from the query. Django remains theauthority for deciding which schema and properties belong in each catalog.-For local development, start the service on its loopback listener:+For local development, start the service on its loopback listener with Hogli:```bash-HOGQL_LANGUAGE_SERVICE_ALLOW_INSECURE=1 .codex/with-flox go -C services/hogql-language-service run ./cmd/server+hogli start:hogql-lang-service```Publish a permission-filtered catalog through the multitenant endpoint below before making language requests. The Go@@ -128,7 +128,7 @@ Build the image from the service directory:```bashdocker build \--build-arg COMMIT_HASH="$(git rev-parse HEAD)" \- --tag hogql-language-service:local \+ --tag hogql-lang-service:local \services/hogql-language-service```@@ -139,9 +139,14 @@ requires `HOGQL_LANGUAGE_SERVICE_SIGNING_KEYS`:docker run --rm \--publish 127.0.0.1:8091:8091 \--env HOGQL_LANGUAGE_SERVICE_SIGNING_KEYS=local-development-key \- hogql-language-service:local+ --env MAX_CATALOGS=2 \+ --env CATALOG_CACHE_MAX_BYTES=268435456 \+ hogql-lang-service:local```The production binary is compiled with Go 1.27.1 and `go build -trimpath`. The runtime image contains only the staticservice binary, the commit identifier, and CA certificates. BuildKit's `TARGETOS` and `TARGETARCH` arguments allownative `linux/amd64` and `linux/arm64` builds.++Merges that change this service build and publish the `hogql-lang-service` image once, then send its digest to the+matching Charts release. Pull requests rely on the service tests and repository Dockerfile lint checks.