Show app version in UI with Forgejo update check #28

Merged
rbrooks merged 1 commit from feat/app-version into main 2026-06-24 01:40:11 +00:00
Owner

Implements #27.

What

  • Version sourceapp/services/app_version.py::get_version() reads WEATHERBOT_VERSION, stamped into the image at build time from the release tag (Dockerfile APP_VERSION build arg); falls back to dev. app/main.py now feeds FastAPI's version= and a Jinja app_version global from it (replacing the hard-coded "1.0.0").
  • Update checkget_update_status() compares the running version to the latest Forgejo release (/api/v1/repos/rbrooks/WeatherBot/releases/latest). Cached 1h (5m on error), non-blocking, fail-soft.
  • UI — footer shows the version on every page plus a non-blocking "update available → vX.Y.Z" badge (via GET /api/version); the diagnostics page gains a Version panel with current/latest/status.
  • BuildAPP_VERSION build arg → WEATHERBOT_VERSION env in the Dockerfile and docker-compose.yml; added a .dockerignore (keeps .git/.env/tests/caches out of the image and shrinks the context).
  • Configforgejo_base_url, update_check_repo, update_check_enabled.

Validation (dev server)

  • tests/test_app_version.py: 10 passed (version parse/compare, update-status caching, error handling, disabled mode, /api/version endpoint).
  • Full suite: 317 passed.

Notes / decisions

  • Comparison is semver-newer and ignores prereleases (Forgejo's releases/latest already excludes drafts/prereleases).
  • The footer version reads dev unless the build passes APP_VERSION — the CD work (#12) will set it from the tag; for manual builds use APP_VERSION=$(git describe --tags) docker compose build app.

Closes #27

Implements #27. ## What - **Version source** — `app/services/app_version.py::get_version()` reads `WEATHERBOT_VERSION`, stamped into the image at build time from the release tag (Dockerfile `APP_VERSION` build arg); falls back to `dev`. `app/main.py` now feeds FastAPI's `version=` and a Jinja `app_version` global from it (replacing the hard-coded `"1.0.0"`). - **Update check** — `get_update_status()` compares the running version to the latest Forgejo release (`/api/v1/repos/rbrooks/WeatherBot/releases/latest`). Cached 1h (5m on error), non-blocking, fail-soft. - **UI** — footer shows the version on every page plus a non-blocking "update available → vX.Y.Z" badge (via `GET /api/version`); the diagnostics page gains a Version panel with current/latest/status. - **Build** — `APP_VERSION` build arg → `WEATHERBOT_VERSION` env in the Dockerfile and `docker-compose.yml`; added a `.dockerignore` (keeps `.git`/`.env`/tests/caches out of the image and shrinks the context). - **Config** — `forgejo_base_url`, `update_check_repo`, `update_check_enabled`. ## Validation (dev server) - `tests/test_app_version.py`: **10 passed** (version parse/compare, update-status caching, error handling, disabled mode, `/api/version` endpoint). - Full suite: **317 passed**. ## Notes / decisions - Comparison is semver-newer and ignores prereleases (Forgejo's `releases/latest` already excludes drafts/prereleases). - The footer version reads `dev` unless the build passes `APP_VERSION` — the CD work (#12) will set it from the tag; for manual builds use `APP_VERSION=$(git describe --tags) docker compose build app`. Closes #27
Show app version in UI with Forgejo update check
All checks were successful
CI / test (pull_request) Successful in 3m8s
d9d370f796
Implements #27.

- app/services/app_version.py: get_version() reads the build-time-stamped
  WEATHERBOT_VERSION (else "dev"); get_update_status() compares against the
  latest Forgejo release (cached 1h / 5m on error, fail-soft).
- app/api/version.py: GET /api/version (logged-in users).
- main.py: FastAPI version + Jinja globals (app_version, app_releases_url);
  diagnostics route passes update_status.
- templates: footer shows version + a non-blocking "update available" badge;
  diagnostics has a Version panel.
- config: forgejo_base_url, update_check_repo, update_check_enabled.
- Dockerfile/compose: APP_VERSION build arg -> WEATHERBOT_VERSION env.
- .dockerignore: shrink build context (also keeps .git/.env out of the image).
- tests/test_app_version.py: version parse/compare, update-status caching,
  error handling, disabled mode, and the endpoint.

Closes #27

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
rbrooks deleted branch feat/app-version 2026-06-24 01:40:11 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
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
rbrooks/WeatherBot!28
No description provided.