From 0688f46d8bc081973c18e0ffd29a1c1dfbd3ba0f Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sat, 29 Jul 2023 08:32:10 +0200 Subject: [PATCH] new version script --- .github/workflows/build-docker-open-data.yml | 10 ---- .github/workflows/build-docker.yml | 10 ---- Dockerfile | 5 +- cookbook/templates/system.html | 59 +++++++----------- cookbook/urls.py | 4 +- cookbook/views/views.py | 30 ++-------- recipes/version.py | 2 - version.py | 63 ++++++++++++++++++++ version_info.py | 3 + 9 files changed, 98 insertions(+), 88 deletions(-) delete mode 100644 recipes/version.py create mode 100644 version.py create mode 100644 version_info.py diff --git a/.github/workflows/build-docker-open-data.yml b/.github/workflows/build-docker-open-data.yml index 1be0d539..881e7824 100644 --- a/.github/workflows/build-docker-open-data.yml +++ b/.github/workflows/build-docker-open-data.yml @@ -34,16 +34,6 @@ jobs: echo VERSION=develop >> $GITHUB_OUTPUT fi - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.2 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}-open-data' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # clone open data plugin - name: clone open data plugin repo uses: actions/checkout@master diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml index de94990a..aea8a526 100644 --- a/.github/workflows/build-docker.yml +++ b/.github/workflows/build-docker.yml @@ -34,16 +34,6 @@ jobs: echo VERSION=develop >> $GITHUB_OUTPUT fi - # Update Version number - - name: Update version file - uses: DamianReeves/write-file-action@v1.2 - with: - path: recipes/version.py - contents: | - VERSION_NUMBER = '${{ steps.get_version.outputs.VERSION }}' - BUILD_REF = '${{ github.sha }}' - write-mode: overwrite - # Build Vue frontend - uses: actions/setup-node@v3 with: diff --git a/Dockerfile b/Dockerfile index 49c2b68f..792f2674 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM python:3.10-alpine3.18 #Install all dependencies. -RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap git +RUN apk add --no-cache postgresql-libs postgresql-client gettext zlib libjpeg libwebp libxml2-dev libxslt-dev openldap #Print all logs without buffering it. ENV PYTHONUNBUFFERED 1 @@ -19,13 +19,14 @@ RUN \ if [ `apk --print-arch` = "armv7" ]; then \ printf "[global]\nextra-index-url=https://www.piwheels.org/simple\n" > /etc/pip.conf ; \ fi -RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev && \ +RUN apk add --no-cache --virtual .build-deps gcc musl-dev postgresql-dev zlib-dev jpeg-dev libwebp-dev openssl-dev libffi-dev cargo openldap-dev python3-dev git && \ echo -n "INPUT ( libldap.so )" > /usr/lib/libldap_r.so && \ python -m venv venv && \ /opt/recipes/venv/bin/python -m pip install --upgrade pip && \ venv/bin/pip install wheel==0.37.1 && \ venv/bin/pip install setuptools_rust==1.1.2 && \ venv/bin/pip install -r requirements.txt --no-cache-dir &&\ + /opt/recipes/venv/bin/python version.py && \ apk --purge del .build-deps #Copy project and execute it. diff --git a/cookbook/templates/system.html b/cookbook/templates/system.html index 1fd3cd50..44e0c6aa 100644 --- a/cookbook/templates/system.html +++ b/cookbook/templates/system.html @@ -18,32 +18,30 @@ {% endblocktrans %}

{% trans 'System Information' %}

- -
-
-
- {% for v in version_info %} -
-
- {% if v.website %} -
{{ v.name }}
- {% else %} -
{{ v.name }}
- {% endif %} + {% if version_if %} +
+
+
+ {% for v in version_info %} +
+
+
{{ v.name }} ({{ v.branch }}) {% if v.tag %}- {{ v.tag }}{% endif %}
+
+
{{ v.version }}
+ Website {% if v.commit_link %} - Commit + - Commit {% endif %}
-
{{ v.version }}
- -
- - {% endfor %} + {% endfor %} +
-
- - + {% else %} + {% blocktrans %} + You need to execute version.py in your update script to generate version information (done automatically in docker). + {% endblocktrans %} + {% endif %}

{% trans 'Media Serving' %} {% if gunicorn_media %} {% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}

@@ -56,10 +54,9 @@ {% else %} {% trans 'Everything is fine!' %} {% endif %} -
-
-

{% trans 'Secret Key' %} {% trans 'Secret Key' %} {% if secret_key %} {% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}

{% if secret_key %} @@ -72,10 +69,8 @@ {% else %} {% trans 'Everything is fine!' %} {% endif %} -
-
-

{% trans 'Debug Mode' %} {% trans 'Debug Mode' %} {% if debug %} {% trans 'Warning' %}{% else %}{% trans 'Ok' %}{% endif %}

{% if debug %} @@ -87,10 +82,8 @@ {% else %} {% trans 'Everything is fine!' %} {% endif %} -
-
-

{% trans 'Database' %} {% trans 'Database' %} {% if postgres %} {% trans 'Info' %}{% else %}{% trans 'Ok' %}{% endif %}

{% if postgres %} @@ -101,12 +94,6 @@ {% else %} {% trans 'Everything is fine!' %} {% endif %} -
-
-

Plugins

- {% for p in plugins %} - {{ p.name }} - {{ p.version }}
- {% endfor %}

Debug