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
|
Le projet suit le versionnement semantique `MAJEURE.MINEURE.CORRECTIF` avec
|
||||||
un suffixe de preversion pendant le developpement.
|
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
|
## 0.1.0-dev.1 - 2026-08-14
|
||||||
|
|
||||||
- Separation des profils Docker de developpement et de production.
|
- 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
|
# Etape 2 : image finale legere
|
||||||
FROM python:3.13-slim
|
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
|
ARG GIT_VERSION=unknown
|
||||||
|
|
||||||
ENV PYTHONDONTWRITEBYTECODE=1 \
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
|
@ -31,6 +31,7 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
PATH=/home/gmao/.local/bin:/usr/local/bin:$PATH \
|
PATH=/home/gmao/.local/bin:/usr/local/bin:$PATH \
|
||||||
TZ=Europe/Paris \
|
TZ=Europe/Paris \
|
||||||
GMAO_VERSION=${GMAO_VERSION} \
|
GMAO_VERSION=${GMAO_VERSION} \
|
||||||
|
GIT_COMMIT=${GIT_VERSION} \
|
||||||
GMAO_GUNICORN_FLAGS=--preload
|
GMAO_GUNICORN_FLAGS=--preload
|
||||||
|
|
||||||
LABEL org.opencontainers.image.title="GMAO College" \
|
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é
|
# 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.
|
# le code réellement exécuté par un conteneur, même avant installation.
|
||||||
from .core.build_info import get_build_commit
|
from .core.build_info import get_build_commit
|
||||||
|
from .version import get_version
|
||||||
app.config['GIT_COMMIT'] = get_build_commit()
|
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
|
# Initialisation des extensions
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,21 @@ def get_build_commit():
|
||||||
les variables d'environnement sont donc prioritaires. Le fallback Git
|
les variables d'environnement sont donc prioritaires. Le fallback Git
|
||||||
permet de conserver un affichage utile en développement.
|
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()
|
value = (os.environ.get(variable) or "").strip()
|
||||||
if value:
|
if value:
|
||||||
return 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]
|
repository = Path(__file__).resolve().parents[2]
|
||||||
try:
|
try:
|
||||||
result = subprocess.run(
|
result = subprocess.run(
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<a class="navbar-brand fw-bold" href="{{ url_for('dashboard.index') }}">
|
<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>
|
<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>
|
</a>
|
||||||
|
|
||||||
<div class="d-flex align-items-center order-lg-last">
|
<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 shadow mx-auto" style="max-width: 1200px">
|
||||||
<div class="card-header bg-primary text-white">
|
<div class="card-header bg-primary text-white">
|
||||||
<h4 class="mb-0"><i class="bi bi-gear-fill"></i> Configuration initiale GMAO</h4>
|
<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>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex flex-wrap justify-content-between gap-2 mb-4" id="stepIndicators">
|
<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>
|
<i class="bi bi-check-circle-fill text-success" style="font-size: 4rem;"></i>
|
||||||
<h2 class="mt-4">Configuration terminée</h2>
|
<h2 class="mt-4">Configuration terminée</h2>
|
||||||
<p class="text-muted">Le système GMAO a déjà été configuré.</p>
|
<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">
|
<a href="{{ url_for('companies.index') }}" class="btn btn-primary mt-3">
|
||||||
<i class="bi bi-house"></i> Accueil
|
<i class="bi bi-house"></i> Accueil
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
services:
|
services:
|
||||||
gmao:
|
gmao:
|
||||||
environment:
|
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
|
GMAO_GUNICORN_FLAGS: --reload --reload-engine poll
|
||||||
FLASK_ENV: development
|
FLASK_ENV: development
|
||||||
# Ce profil est servi en HTTP sur le réseau de test ; un cookie Secure
|
# Ce profil est servi en HTTP sur le réseau de test ; un cookie Secure
|
||||||
|
|
|
||||||
|
|
@ -25,12 +25,12 @@ services:
|
||||||
memory: 128M
|
memory: 128M
|
||||||
|
|
||||||
gmao:
|
gmao:
|
||||||
image: gmao-college:${GMAO_VERSION:-0.1.0-dev.1}
|
image: gmao-college:${GMAO_VERSION:-0.1.0-dev.2}
|
||||||
build:
|
build:
|
||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
args:
|
args:
|
||||||
GMAO_VERSION: ${GMAO_VERSION:-0.1.0-dev.1}
|
GMAO_VERSION: ${GMAO_VERSION:-0.1.0-dev.2}
|
||||||
GIT_VERSION: ${GIT_VERSION:-unknown}
|
GIT_VERSION: ${GIT_VERSION:-unknown}
|
||||||
container_name: gmao-flask
|
container_name: gmao-flask
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
@ -51,7 +51,7 @@ services:
|
||||||
- TZ=Europe/Paris
|
- TZ=Europe/Paris
|
||||||
- DB_HOST=mariadb
|
- DB_HOST=mariadb
|
||||||
- DB_PORT=3306
|
- 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
|
- GMAO_GUNICORN_FLAGS=--preload
|
||||||
- DOCKER_GMAO_WORKDIR=/app
|
- DOCKER_GMAO_WORKDIR=/app
|
||||||
working_dir: /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
|
from app_new.core.build_info import get_build_commit
|
||||||
|
|
||||||
monkeypatch.setenv('GIT_COMMIT', 'commit-deploye-test')
|
monkeypatch.setenv('GIT_COMMIT', 'commit-deploye-test')
|
||||||
|
monkeypatch.setenv('GIT_VERSION', 'version-commit')
|
||||||
monkeypatch.setenv('COMMIT_SHA', 'autre-commit')
|
monkeypatch.setenv('COMMIT_SHA', 'autre-commit')
|
||||||
assert get_build_commit() == 'commit-deploye-test'
|
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):
|
def test_project_version_is_available(monkeypatch):
|
||||||
monkeypatch.delenv('GMAO_VERSION', raising=False)
|
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):
|
def test_environment_version_takes_precedence(monkeypatch):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue