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.

feat(ci): publish OCI index annotations from the remaining image builds (#92691)

Stephen Schmidt26ed90ce5a97
diff --git a/.github/workflows/cd-agent-proxy-image.yml b/.github/workflows/cd-agent-proxy-image.yml
index 21c7e2ba4517..caa16a2d1fe8 100644
--- a/.github/workflows/cd-agent-proxy-image.yml
+++ b/.github/workflows/cd-agent-proxy-image.yml
@@ -60,6 +60,7 @@ jobs:
push: ${{ github.ref == 'refs/heads/master' }}
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 }}
diff --git a/.github/workflows/cd-integration-service-image.yml b/.github/workflows/cd-integration-service-image.yml
index d20a900e6bfa..4da17f59f1fd 100644
--- a/.github/workflows/cd-integration-service-image.yml
+++ b/.github/workflows/cd-integration-service-image.yml
@@ -60,6 +60,7 @@ jobs:
push: ${{ github.ref == 'refs/heads/master' }}
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 }}
diff --git a/.github/workflows/cd-llm-analytics-image.yml b/.github/workflows/cd-llm-analytics-image.yml
index 78ce5ae39a47..9a6bdcabcf81 100644
--- a/.github/workflows/cd-llm-analytics-image.yml
+++ b/.github/workflows/cd-llm-analytics-image.yml
@@ -91,6 +91,43 @@ jobs:
id: aws-ecr
uses: aws-actions/amazon-ecr-login@f2e9fc6c2b355c1890b65e6f6f0e2ac3e6e22f78 # v2.1.2
+ - name: Docker meta
+ id: docker-meta
+ continue-on-error: true
+ uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
+ env:
+ DOCKER_METADATA_ANNOTATIONS_LEVELS: index
+ with:
+ images: ${{ steps.aws-ecr.outputs.registry }}/${{ env.ECR_IMAGE }}
+
+ - name: Add commit annotations
+ id: image-annotations
+ continue-on-error: true
+ shell: bash
+ env:
+ EVENT_AUTHOR: ${{ github.event.head_commit.author.username }}
+ EVENT_COMMITTER: ${{ github.event.head_commit.committer.username }}
+ LC_ALL: C.UTF-8
+ METADATA_ANNOTATIONS: ${{ steps.docker-meta.outputs.annotations }}
+ run: |
+ set -euo pipefail
+ subject="$(git log -1 --format=%s)"
+ author="${EVENT_AUTHOR:-$(git log -1 --format=%an)}"
+ committer="${EVENT_COMMITTER:-$(git log -1 --format=%cn)}"
+ timestamp="$(TZ=UTC git show -s --date=format-local:%Y-%m-%dT%H:%M:%SZ --format=%cd HEAD)"
+ if [ "${#subject}" -gt 160 ]; then
+ subject="${subject:0:157}..."
+ fi
+ {
+ echo "value<<ANNOTATIONS_EOF"
+ printf '%s\n' "$METADATA_ANNOTATIONS"
+ printf 'index:com.posthog.image.author=%s\n' "$author"
+ printf 'index:com.posthog.image.committer=%s\n' "$committer"
+ printf 'index:com.posthog.image.message=%s\n' "$subject"
+ printf 'index:com.posthog.image.commit-timestamp=%s\n' "$timestamp"
+ echo "ANNOTATIONS_EOF"
+ } >> "$GITHUB_OUTPUT"
+
- name: Build and push container image
id: build
uses: depot/build-push-action@5f3b3c2e5a00f0093de47f657aeaefcedff27d18 # v1.17.0
@@ -100,6 +137,7 @@ jobs:
buildx-fallback: false
push: ${{ github.event_name == 'pull_request' || vars.CD_DEPLOY_ENABLED == 'true' }}
tags: ${{ github.ref == 'refs/heads/master' && format('{0}/{1}:master,{0}/{1}:{2}', steps.aws-ecr.outputs.registry, env.ECR_IMAGE, github.sha) || format('{0}/{1}:{2}', steps.aws-ecr.outputs.registry, env.ECR_IMAGE, github.sha) }}
+ annotations: ${{ steps.docker-meta.outcome == 'success' && steps.image-annotations.outcome == 'success' && steps.image-annotations.outputs.value || '' }}
platforms: linux/arm64,linux/amd64
build-args: COMMIT_HASH=${{ github.sha }}
@@ -140,3 +178,7 @@ jobs:
"labels": ${{ steps.labels.outputs.labels }},
"timestamp": "${{ github.event.head_commit.timestamp }}"
}
+
+ - name: Warn when image annotations are missing
+ if: ${{ always() && (steps.docker-meta.outcome != 'success' || steps.image-annotations.outcome != 'success' || steps.image-annotations.outputs.value == '') }}
+ run: echo "::warning::OCI image annotations are missing because annotation generation did not complete successfully."
diff --git a/.github/workflows/cd-mcp-image.yml b/.github/workflows/cd-mcp-image.yml
index 996de5af9409..8eaebf727f15 100644
--- a/.github/workflows/cd-mcp-image.yml
+++ b/.github/workflows/cd-mcp-image.yml
@@ -83,6 +83,7 @@ jobs:
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 }}
diff --git a/.github/workflows/ci-ml-mirror-image-scrub-container.yml b/.github/workflows/ci-ml-mirror-image-scrub-container.yml
index 879a23656255..f7980e57fbd7 100644
--- a/.github/workflows/ci-ml-mirror-image-scrub-container.yml
+++ b/.github/workflows/ci-ml-mirror-image-scrub-container.yml
@@ -157,6 +157,7 @@ jobs:
file: Dockerfile.ml-mirror-image-scrub
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
+ annotations: ${{ steps.docker-meta.outputs.annotations }}
# Both arches: the charts-side Karpenter NodePool defaults to arm64 (Graviton), and an
# amd64-only manifest fails there with "no match for platform in manifest".
platforms: linux/amd64,linux/arm64
diff --git a/.github/workflows/ci-nodejs-container.yml b/.github/workflows/ci-nodejs-container.yml
index cd2a98747899..fce457eb5115 100644
--- a/.github/workflows/ci-nodejs-container.yml
+++ b/.github/workflows/ci-nodejs-container.yml
@@ -148,6 +148,7 @@ jobs:
file: Dockerfile.node
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 }}
diff --git a/.github/workflows/ci-recording-rasterizer-container.yml b/.github/workflows/ci-recording-rasterizer-container.yml
index a72f6ba546c8..f938b7b7e3f5 100644
--- a/.github/workflows/ci-recording-rasterizer-container.yml
+++ b/.github/workflows/ci-recording-rasterizer-container.yml
@@ -153,6 +153,7 @@ jobs:
file: Dockerfile.recording-rasterizer
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
+ annotations: ${{ steps.docker-meta.outputs.annotations }}
platforms: linux/amd64
build-args: |
COMMIT_HASH=${{ github.sha }}
diff --git a/.github/workflows/livestream-docker-image.yml b/.github/workflows/livestream-docker-image.yml
index 0f3f98956c27..6994ccd6a2b9 100644
--- a/.github/workflows/livestream-docker-image.yml
+++ b/.github/workflows/livestream-docker-image.yml
@@ -89,6 +89,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
+ annotations: ${{ steps.docker-meta.outputs.annotations }}
project: '87b1ch2t7h'
deploy:
diff --git a/.github/workflows/llm-gateway-cd.yml b/.github/workflows/llm-gateway-cd.yml
index a895b597b637..ac45c70285e2 100644
--- a/.github/workflows/llm-gateway-cd.yml
+++ b/.github/workflows/llm-gateway-cd.yml
@@ -61,6 +61,7 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
+ annotations: ${{ steps.docker-meta.outputs.annotations }}
project: 90mkjhdrjz # llm-gateway depot project
deploy: