feat: expose running CalVer version via API #126

Closed
opened 2026-04-10 02:05:38 +00:00 by cal · 1 comment
Owner

Problem

There's no way to determine which CalVer version is running in production. The container pulls :latest (soon :production), and docker inspect only shows the tag name, not the CalVer version it was built from.

Proposed Approach

Embed the CalVer version at build time and expose it at runtime. Options (not mutually exclusive):

  1. Build arg → env var: Pass the version as a Docker build arg in CI, bake it into the image as an env var
  2. Version endpoint: Expose it via /api/v3/version or include it in the /health response
  3. Docker label: Add an org.opencontainers.image.version label to the image

The CI workflow already extracts the version in the Extract version from tag step — it just needs to be passed through to the build.

Why

We had to cross-reference container creation timestamps with git tag dates to guess the running version. This should be a single API call or docker inspect.

## Problem There's no way to determine which CalVer version is running in production. The container pulls `:latest` (soon `:production`), and `docker inspect` only shows the tag name, not the CalVer version it was built from. ## Proposed Approach Embed the CalVer version at build time and expose it at runtime. Options (not mutually exclusive): 1. **Build arg → env var**: Pass the version as a Docker build arg in CI, bake it into the image as an env var 2. **Version endpoint**: Expose it via `/api/v3/version` or include it in the `/health` response 3. **Docker label**: Add an `org.opencontainers.image.version` label to the image The CI workflow already extracts the version in the `Extract version from tag` step — it just needs to be passed through to the build. ## Why We had to cross-reference container creation timestamps with git tag dates to guess the running version. This should be a single API call or `docker inspect`.
Claude added the
ai-working
label 2026-04-10 02:31:15 +00:00
Claude added
ai-pr-opened
and removed
ai-working
labels 2026-04-10 02:33:15 +00:00
Collaborator

Opened PR #127: #127

All three approaches from the issue are implemented:

  1. Build arg → env var: ARG BUILD_VERSION=dev in Dockerfile baked into ENV APP_VERSION — CI passes the git tag value via build-args
  2. OCI label: LABEL org.opencontainers.image.version=$BUILD_VERSION — visible via docker inspect without running the container
  3. /health endpoint: GET /health returns {"status": "ok", "version": "2026.4.1"} — also upgrades the Dockerfile HEALTHCHECK from the SQL-hitting /api/v3/current to the lightweight /health
Opened PR #127: https://git.manticorum.com/cal/major-domo-database/pulls/127 All three approaches from the issue are implemented: 1. **Build arg → env var**: `ARG BUILD_VERSION=dev` in Dockerfile baked into `ENV APP_VERSION` — CI passes the git tag value via `build-args` 2. **OCI label**: `LABEL org.opencontainers.image.version=$BUILD_VERSION` — visible via `docker inspect` without running the container 3. **`/health` endpoint**: `GET /health` returns `{"status": "ok", "version": "2026.4.1"}` — also upgrades the Dockerfile HEALTHCHECK from the SQL-hitting `/api/v3/current` to the lightweight `/health`
cal closed this issue 2026-04-10 15:54:15 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: cal/major-domo-database#126
No description provided.