From 533556b7e487ea4baa523400d94b446a82155a19 Mon Sep 17 00:00:00 2001 From: Matthias Mair Date: Thu, 19 Jun 2025 04:21:46 +0200 Subject: [PATCH] fix: package - various changes (#9802) * fail on install * move site setting up to ensure site is set early * fix version file path * ensure subdirs are created too * ensure downloaded files are also collected into static * update order * bump qc workers * update version --- .github/workflows/qc_checks.yaml | 22 ++++++++++----------- contrib/packager.io/functions.sh | 2 +- contrib/packager.io/postinstall.sh | 2 +- src/backend/InvenTree/InvenTree/settings.py | 2 +- src/backend/InvenTree/InvenTree/version.py | 2 +- tasks.py | 3 ++- 6 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/qc_checks.yaml b/.github/workflows/qc_checks.yaml index 7d7aaa34c9..e17c5fee72 100644 --- a/.github/workflows/qc_checks.yaml +++ b/.github/workflows/qc_checks.yaml @@ -65,7 +65,7 @@ jobs: javascript: name: Style - Classic UI [JS] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: ["pre-commit"] @@ -87,7 +87,7 @@ jobs: pre-commit: name: Style [pre-commit] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: paths-filter if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.frontend == 'true' || needs.paths-filter.outputs.force == 'true' @@ -107,7 +107,7 @@ jobs: mkdocs: name: Style [Documentation] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: paths-filter @@ -133,7 +133,7 @@ jobs: schema: name: Tests - API Schema Documentation - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: paths-filter if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true' env: @@ -204,7 +204,7 @@ jobs: schema-push: name: Push new schema - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: [paths-filter, schema] if: needs.schema.result == 'success' && github.ref == 'refs/heads/master' && needs.paths-filter.outputs.api == 'true' && github.repository_owner == 'inventree' env: @@ -232,7 +232,7 @@ jobs: python: name: Tests - inventree-python - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: ["pre-commit", "paths-filter"] if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true' @@ -274,7 +274,7 @@ jobs: coverage: name: Tests - DB [SQLite] + Coverage ${{ matrix.python_version }} - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: ["pre-commit", "paths-filter"] if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true' @@ -317,7 +317,7 @@ jobs: postgres: name: Tests - DB [PostgreSQL] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: ["pre-commit", "paths-filter"] if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true' @@ -361,7 +361,7 @@ jobs: mysql: name: Tests - DB [MySQL] - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 needs: ["pre-commit", "paths-filter"] if: needs.paths-filter.outputs.server == 'true' || needs.paths-filter.outputs.force == 'true' @@ -505,7 +505,7 @@ jobs: platform_ui: name: Tests - Platform UI - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 needs: ["pre-commit", "paths-filter"] if: needs.paths-filter.outputs.frontend == 'true' || needs.paths-filter.outputs.force == 'true' @@ -561,7 +561,7 @@ jobs: platform_ui_build: name: Build - UI Platform - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 timeout-minutes: 60 steps: diff --git a/contrib/packager.io/functions.sh b/contrib/packager.io/functions.sh index a08a9f0999..9d9130e69d 100755 --- a/contrib/packager.io/functions.sh +++ b/contrib/packager.io/functions.sh @@ -300,7 +300,7 @@ function update_or_install() { # Run update as app user echo "# POI12| Updating InvenTree" sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && pip install wheel" - sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "cd ${APP_HOME} && invoke update | sed -e 's/^/# POI12| u | /;'" + sudo -u ${APP_USER} --preserve-env=$SETUP_ENVS bash -c "set -e && cd ${APP_HOME} && invoke update | sed -e 's/^/# POI12| u | /;'" # Make sure permissions are correct again echo "# POI12| Set permissions for data dir and media: ${DATA_DIR}" diff --git a/contrib/packager.io/postinstall.sh b/contrib/packager.io/postinstall.sh index 4e5734fb5a..11f23f072f 100755 --- a/contrib/packager.io/postinstall.sh +++ b/contrib/packager.io/postinstall.sh @@ -53,12 +53,12 @@ create_admin # run updates stop_inventree +set_site update_or_install # Write config file if [ "${SETUP_CONF_LOADED}" = "true" ]; then set_env fi -set_site start_inventree # show info diff --git a/src/backend/InvenTree/InvenTree/settings.py b/src/backend/InvenTree/InvenTree/settings.py index ced4eb3e14..a8f6a7db20 100644 --- a/src/backend/InvenTree/InvenTree/settings.py +++ b/src/backend/InvenTree/InvenTree/settings.py @@ -71,7 +71,7 @@ BASE_DIR = config.get_base_dir() CONFIG = config.load_config_data(set_cache=True) # Load VERSION data if it exists -version_file = BASE_DIR.parent.joinpath('VERSION') +version_file = BASE_DIR.parent.parent.parent.joinpath('VERSION') if version_file.exists(): print('load version from file') load_dotenv(version_file) diff --git a/src/backend/InvenTree/InvenTree/version.py b/src/backend/InvenTree/InvenTree/version.py index a1d782ca0c..1368eb6aeb 100644 --- a/src/backend/InvenTree/InvenTree/version.py +++ b/src/backend/InvenTree/InvenTree/version.py @@ -18,7 +18,7 @@ from django.conf import settings from .api_version import INVENTREE_API_TEXT, INVENTREE_API_VERSION # InvenTree software version -INVENTREE_SW_VERSION = '0.17.13' +INVENTREE_SW_VERSION = '0.17.14' logger = logging.getLogger('inventree') diff --git a/tasks.py b/tasks.py index 2def7d3665..df323d0820 100644 --- a/tasks.py +++ b/tasks.py @@ -1360,7 +1360,7 @@ def frontend_download( # if clean, delete static/web directory if clean: shutil.rmtree(dest_path, ignore_errors=True) - dest_path.mkdir() + dest_path.mkdir(parents=True, exist_ok=True) info(f'Cleaned directory: {dest_path}') # unzip build to static folder @@ -1385,6 +1385,7 @@ def frontend_download( info(f'Downloaded frontend build to temporary file: {dst.name}') handle_extract(dst.name) + static(c) def check_already_current(tag=None, sha=None): """Check if the currently available frontend is already the requested one."""