Skip to content

The open-source app everyone uses to manage agents at work

ci: label Docker images with their bundled schema migration set (#9908)

Devin Foleyfa4f900d1a0c
diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml
index 7d340f352e..ae41e26851 100644
--- a/.github/workflows/docker.yml
+++ b/.github/workflows/docker.yml
@@ -32,6 +32,20 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
+ # Deployment tooling reads these labels from the registry to verify an
+ # image's schema expectations against a migrator before deploying it,
+ # without pulling the image. The server refuses to start when the
+ # database is missing bundled migrations, so orchestrators need a cheap
+ # way to check image/migrator compatibility up front.
+ - name: Compute schema migration labels
+ id: schema
+ run: |
+ set -euo pipefail
+ last=$(ls packages/db/src/migrations/*.sql | sed 's|.*/||' | LC_ALL=C sort | tail -1)
+ count=$(ls packages/db/src/migrations/*.sql | wc -l | tr -d ' ')
+ echo "last=${last}" >> "$GITHUB_OUTPUT"
+ echo "count=${count}" >> "$GITHUB_OUTPUT"
+
- name: Docker meta
id: meta
uses: docker/metadata-action@v6
@@ -42,6 +56,9 @@ jobs:
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
+ labels: |
+ io.github.paperclipai.schema.last-migration=${{ steps.schema.outputs.last }}
+ io.github.paperclipai.schema.migration-count=${{ steps.schema.outputs.count }}
- name: Build and push
uses: docker/build-push-action@v7