Afficher et incrementer la version GMAO
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
Some checks are pending
CI - Tests et Syntax / lint-and-test (push) Waiting to run
This commit is contained in:
parent
518d31c891
commit
8588ba795f
12 changed files with 33 additions and 11 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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" \
|
||||
|
|
|
|||
2
VERSION
2
VERSION
|
|
@ -1 +1 @@
|
|||
0.1.0-dev.1
|
||||
0.1.0-dev.2
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@
|
|||
<div class="container-fluid">
|
||||
<a class="navbar-brand fw-bold" href="{{ url_for('dashboard.index') }}">
|
||||
<i class="bi bi-tools"></i> <span class="d-none d-sm-inline">GMAO Collège</span>
|
||||
<small class="ms-1 opacity-75" title="Version de l'application">v{{ gmao_version }}</small>
|
||||
</a>
|
||||
|
||||
<div class="d-flex align-items-center order-lg-last">
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
<div class="card shadow mx-auto" style="max-width: 1200px">
|
||||
<div class="card-header bg-primary text-white">
|
||||
<h4 class="mb-0"><i class="bi bi-gear-fill"></i> Configuration initiale GMAO</h4>
|
||||
<div class="small mt-1 opacity-75">Commit déployé : <code class="text-white">{{ build_commit }}</code></div>
|
||||
<div class="small mt-1 opacity-75">Version <code class="text-white">v{{ gmao_version }}</code> · Commit déployé : <code class="text-white">{{ build_commit }}</code></div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="d-flex flex-wrap justify-content-between gap-2 mb-4" id="stepIndicators">
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<i class="bi bi-check-circle-fill text-success" style="font-size: 4rem;"></i>
|
||||
<h2 class="mt-4">Configuration terminée</h2>
|
||||
<p class="text-muted">Le système GMAO a déjà été configuré.</p>
|
||||
<p class="small text-muted mb-0">Commit déployé : <code>{{ build_commit }}</code></p>
|
||||
<p class="small text-muted mb-0">Version <code>v{{ gmao_version }}</code> · Commit déployé : <code>{{ build_commit }}</code></p>
|
||||
<a href="{{ url_for('companies.index') }}" class="btn btn-primary mt-3">
|
||||
<i class="bi bi-house"></i> Accueil
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Reference in a new issue