diff --git a/CHANGELOG.md b/CHANGELOG.md index 38864b6..05d1f00 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,10 @@ Le projet suit le versionnement semantique `MAJEURE.MINEURE.CORRECTIF` avec un suffixe de preversion pendant le developpement. +## 0.1.0-dev.2 - 2026-08-21 + +- Affichage de la version GMAO et du commit déployé dans le setup et la navigation. + ## 0.1.0-dev.1 - 2026-08-14 - Separation des profils Docker de developpement et de production. diff --git a/Dockerfile b/Dockerfile index fbffbc6..673d191 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ RUN pip install --no-cache-dir --user -r /build/requirements.txt supervisor # Etape 2 : image finale legere FROM python:3.13-slim -ARG GMAO_VERSION=0.1.0-dev.1 +ARG GMAO_VERSION=0.1.0-dev.2 ARG GIT_VERSION=unknown ENV PYTHONDONTWRITEBYTECODE=1 \ @@ -31,6 +31,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \ PATH=/home/gmao/.local/bin:/usr/local/bin:$PATH \ TZ=Europe/Paris \ GMAO_VERSION=${GMAO_VERSION} \ + GIT_COMMIT=${GIT_VERSION} \ GMAO_GUNICORN_FLAGS=--preload LABEL org.opencontainers.image.title="GMAO College" \ diff --git a/VERSION b/VERSION index 2cb21bd..a46d660 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.1.0-dev.1 +0.1.0-dev.2 diff --git a/app_new/__init__.py b/app_new/__init__.py index 43cf9d7..f9044b6 100644 --- a/app_new/__init__.py +++ b/app_new/__init__.py @@ -66,8 +66,13 @@ def create_app(config_name='default'): # Affiché notamment dans le setup wizard afin d'identifier sans ambiguïté # le code réellement exécuté par un conteneur, même avant installation. from .core.build_info import get_build_commit + from .version import get_version app.config['GIT_COMMIT'] = get_build_commit() - app.context_processor(lambda: {'build_commit': app.config['GIT_COMMIT']}) + app.config['GMAO_VERSION'] = get_version() + app.context_processor(lambda: { + 'build_commit': app.config['GIT_COMMIT'], + 'gmao_version': app.config['GMAO_VERSION'], + }) # Initialisation des extensions db.init_app(app) diff --git a/app_new/core/build_info.py b/app_new/core/build_info.py index 8005dc2..ac15bf8 100644 --- a/app_new/core/build_info.py +++ b/app_new/core/build_info.py @@ -12,11 +12,21 @@ def get_build_commit(): les variables d'environnement sont donc prioritaires. Le fallback Git permet de conserver un affichage utile en développement. """ - for variable in ("GIT_COMMIT", "COMMIT_SHA", "SOURCE_VERSION"): + for variable in ("GIT_COMMIT", "GIT_VERSION", "COMMIT_SHA", "SOURCE_VERSION"): value = (os.environ.get(variable) or "").strip() if value: return value + # Les images Docker existantes écrivent déjà l'argument de build dans ce + # fichier, sans embarquer le dépôt Git. + version_file = Path('/app/.git-version') + try: + value = version_file.read_text(encoding='utf-8').strip() + except (OSError, UnicodeError): + value = '' + if value: + return value + repository = Path(__file__).resolve().parents[2] try: result = subprocess.run( diff --git a/app_new/templates/base.html b/app_new/templates/base.html index 297dc04..80a1fbe 100644 --- a/app_new/templates/base.html +++ b/app_new/templates/base.html @@ -108,6 +108,7 @@
GMAO Collège + v{{ gmao_version }}
diff --git a/app_new/templates/setup_wizard/index.html b/app_new/templates/setup_wizard/index.html index d373e82..e9f6cde 100644 --- a/app_new/templates/setup_wizard/index.html +++ b/app_new/templates/setup_wizard/index.html @@ -6,7 +6,7 @@

Configuration initiale GMAO

-
Commit déployé : {{ build_commit }}
+
Version v{{ gmao_version }} · Commit déployé : {{ build_commit }}
diff --git a/app_new/templates/setup_wizard/setup_complete.html b/app_new/templates/setup_wizard/setup_complete.html index 51edb31..d339fda 100644 --- a/app_new/templates/setup_wizard/setup_complete.html +++ b/app_new/templates/setup_wizard/setup_complete.html @@ -10,7 +10,7 @@

Configuration terminée

Le système GMAO a déjà été configuré.

-

Commit déployé : {{ build_commit }}

+

Version v{{ gmao_version }} · Commit déployé : {{ build_commit }}

Accueil diff --git a/docker-compose.override.yml b/docker-compose.override.yml index dae346f..0eb0334 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -1,7 +1,7 @@ services: gmao: environment: - GMAO_VERSION: ${GMAO_VERSION:-0.1.0-dev.1} + GMAO_VERSION: ${GMAO_VERSION:-0.1.0-dev.2} GMAO_GUNICORN_FLAGS: --reload --reload-engine poll FLASK_ENV: development # Ce profil est servi en HTTP sur le réseau de test ; un cookie Secure diff --git a/docker-compose.yml b/docker-compose.yml index fc66fec..bd1fc9c 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -25,12 +25,12 @@ services: memory: 128M gmao: - image: gmao-college:${GMAO_VERSION:-0.1.0-dev.1} + image: gmao-college:${GMAO_VERSION:-0.1.0-dev.2} build: context: . dockerfile: Dockerfile args: - GMAO_VERSION: ${GMAO_VERSION:-0.1.0-dev.1} + GMAO_VERSION: ${GMAO_VERSION:-0.1.0-dev.2} GIT_VERSION: ${GIT_VERSION:-unknown} container_name: gmao-flask restart: unless-stopped @@ -51,7 +51,7 @@ services: - TZ=Europe/Paris - DB_HOST=mariadb - DB_PORT=3306 - - GMAO_VERSION=${GMAO_VERSION:-0.1.0-dev.1} + - GMAO_VERSION=${GMAO_VERSION:-0.1.0-dev.2} - GMAO_GUNICORN_FLAGS=--preload - DOCKER_GMAO_WORKDIR=/app working_dir: /app diff --git a/tests/integration/test_auth_setup.py b/tests/integration/test_auth_setup.py index dc927b8..4f7c0a5 100644 --- a/tests/integration/test_auth_setup.py +++ b/tests/integration/test_auth_setup.py @@ -5,6 +5,7 @@ def test_build_commit_prefers_deployment_environment(monkeypatch): from app_new.core.build_info import get_build_commit monkeypatch.setenv('GIT_COMMIT', 'commit-deploye-test') + monkeypatch.setenv('GIT_VERSION', 'version-commit') monkeypatch.setenv('COMMIT_SHA', 'autre-commit') assert get_build_commit() == 'commit-deploye-test' diff --git a/tests/unit/test_version.py b/tests/unit/test_version.py index f612988..36f3845 100644 --- a/tests/unit/test_version.py +++ b/tests/unit/test_version.py @@ -3,7 +3,7 @@ from app_new.version import get_version def test_project_version_is_available(monkeypatch): monkeypatch.delenv('GMAO_VERSION', raising=False) - assert get_version() == '0.1.0-dev.1' + assert get_version() == '0.1.0-dev.2' def test_environment_version_takes_precedence(monkeypatch):