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.

chore(ci): publish OCI index metadata (#78507)

Stephen Schmidtb808101d96e1
diff --git a/.github/actions/docker-meta/action.yml b/.github/actions/docker-meta/action.yml
index d4a8a7df19bb..677baf6826af 100644
--- a/.github/actions/docker-meta/action.yml
+++ b/.github/actions/docker-meta/action.yml
@@ -46,6 +46,9 @@ outputs:
labels:
description: 'Docker metadata labels'
value: ${{ steps.meta.outputs.labels }}
+ annotations:
+ description: 'Docker metadata annotations'
+ value: ${{ steps.annotations.outputs.value }}
ecr-registry:
description: 'ECR registry URL'
value: ${{ steps.aws-ecr.outputs.registry }}
@@ -109,14 +112,60 @@ runs:
PUSH_TO_GHCR: ${{ inputs.push-to-ghcr }}
PUSH_TO_ECR: ${{ inputs.push-to-ecr }}
+ - name: Extract commit metadata
+ id: commit
+ shell: bash
+ env:
+ EVENT_AUTHOR: ${{ github.event.head_commit.author.username }}
+ EVENT_COMMITTER: ${{ github.event.head_commit.committer.username }}
+ LC_ALL: C.UTF-8
+ 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 "subject=${subject}"
+ echo "author=${author}"
+ echo "committer=${committer}"
+ echo "timestamp=${timestamp}"
+ } >> "$GITHUB_OUTPUT"
+
- name: Docker meta
id: meta
uses: docker/metadata-action@030e881283bb7a6894de51c315a6bfe6a94e05cf # v6.0.0
+ env:
+ DOCKER_METADATA_ANNOTATIONS_LEVELS: index
with:
images: ${{ steps.images.outputs.list }}
tags: |
type=ref,event=pr
type=ref,event=branch
- type=sha
+ type=sha,format=long
type=raw,value=${{ github.sha }}
type=raw,value=latest,enable={{is_default_branch}}
+
+ - name: Add commit annotations
+ id: annotations
+ shell: bash
+ env:
+ AUTHOR: ${{ steps.commit.outputs.author }}
+ COMMITTER: ${{ steps.commit.outputs.committer }}
+ MESSAGE: ${{ steps.commit.outputs.subject }}
+ METADATA_ANNOTATIONS: ${{ steps.meta.outputs.annotations }}
+ TIMESTAMP: ${{ steps.commit.outputs.timestamp }}
+ run: |
+ set -euo pipefail
+ {
+ 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' "$MESSAGE"
+ printf 'index:com.posthog.image.commit-timestamp=%s\n' "$TIMESTAMP"
+ echo "ANNOTATIONS_EOF"
+ } >> "$GITHUB_OUTPUT"
diff --git a/.github/workflows/container-images-cd.yml b/.github/workflows/container-images-cd.yml
index 09165388b145..f97f079207e1 100644
--- a/.github/workflows/container-images-cd.yml
+++ b/.github/workflows/container-images-cd.yml
@@ -75,8 +75,8 @@ jobs:
# Idempotency preflight. If this commit's image is already in ECR (a manual
# re-run, or an earlier attempt that pushed to ECR before failing on another
# registry) do NOT rebuild: a rebuild yields a new digest and would overwrite
- # the immutable sha-<short>/<full-sha> tags. We reconcile from the existing
- # digest instead (see "Reconcile tags from existing image" below). Uses
+ # the immutable full-SHA tags. We reconcile from the existing digest instead
+ # (see "Reconcile tags from existing image" below). Uses
# batch-get-image because the ECR publish role has ecr:BatchGetImage but not
# ecr:DescribeImages. A genuine miss exits 0 (a `None` result); a throttle,
# credential, or network error exits non-zero and must fail the step — we can't
@@ -115,6 +115,7 @@ jobs:
push: 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 }}
@@ -183,6 +184,7 @@ jobs:
push: 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 }}