Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ARG APP_VERSION

ENV PYTHONDONTWRITEBYTECODE=1 \
PYTHONUNBUFFERED=1 \
APP_VERSION=${APP_VERSION}
BERT_BUILD_VERSION=${APP_VERSION}

WORKDIR /app
COPY requirements.txt .
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ ADMIN_PASSWORD=replace-with-a-long-unique-password
APP_SECRET_KEY=replace-with-the-generated-secret
```

Do not set `APP_VERSION` in `.env`. Release versions are embedded into the
container image at build time; a runtime override can otherwise make the UI
report a stale version.
Comment on lines +100 to +102

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve a version source for local Compose builds

When a source-deployment user follows this new instruction and removes APP_VERSION, the documented docker compose up -d --build path still does not pass an APP_VERSION build argument (docker-compose.yml only specifies build: .). Consequently BERT_BUILD_VERSION is baked as empty and app/version.py falls back to the outdated DEFAULT_VERSION (17.2.2), so fresh source deployments continue reporting the wrong version and reuse the wrong UI cache key. Either inject the actual version for this build path or scope this instruction to prebuilt images.

Useful? React with 👍 / 👎.


Start Bert:

```bash
Expand Down
4 changes: 3 additions & 1 deletion app/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@


DEFAULT_VERSION = "17.2.2"
VERSION = (os.getenv("APP_VERSION") or DEFAULT_VERSION).removeprefix("v")
VERSION = (
os.getenv("BERT_BUILD_VERSION") or os.getenv("APP_VERSION") or DEFAULT_VERSION
).removeprefix("v")
11 changes: 10 additions & 1 deletion tests/test_release_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def test_release_workflow_uses_release_tag_as_application_version():
def test_container_exposes_release_version_to_application():
dockerfile = Path("Dockerfile").read_text(encoding="utf-8")
assert "ARG APP_VERSION" in dockerfile
assert "APP_VERSION=${APP_VERSION}" in dockerfile
assert "BERT_BUILD_VERSION=${APP_VERSION}" in dockerfile


def test_application_version_uses_release_build_version(monkeypatch):
Expand All @@ -36,9 +36,18 @@ def test_application_version_uses_release_build_version(monkeypatch):
assert runpy.run_path("app/version.py")["VERSION"] == "23.4.5"


def test_baked_release_version_wins_over_stale_runtime_override(monkeypatch):
import runpy

monkeypatch.setenv("BERT_BUILD_VERSION", "v24.0.0")
monkeypatch.setenv("APP_VERSION", "v19.1.3")
assert runpy.run_path("app/version.py")["VERSION"] == "24.0.0"


def test_application_version_keeps_source_fallback(monkeypatch):
import runpy

monkeypatch.delenv("BERT_BUILD_VERSION", raising=False)
monkeypatch.delenv("APP_VERSION", raising=False)
assert runpy.run_path("app/version.py")["VERSION"] == "17.2.2"

Expand Down
Loading