mirror of
https://github.com/inventree/InvenTree.git
synced 2026-10-14 14:11:55 +00:00
reduce ci time (#12985)
* we are currently locking on olugin lease for 2 mins per ci setup; not good * fix syntax * move setting * fix assign syntax * reduce noice while setting up
This commit is contained in:
1 parent
0a0cccedd9
commit
3e367df724
5 files changed
+22
-4
No files matched your search
@@ -15,3 +15,5 @@ runs:
|
||||
invoke migrate
|
||||
invoke import-records -c -f data.json --strict
|
||||
invoke import-records -c -f data.json --strict
|
||||
env:
|
||||
SETUP_INITIALIZING: 1
|
||||
@@ -37,6 +37,7 @@ inputs:
|
||||
|
||||
runs:
|
||||
using: 'composite'
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
||||
@@ -97,15 +98,23 @@ runs:
|
||||
if: ${{ inputs.dev-install == 'true' || inputs.install == 'true' }}
|
||||
shell: bash
|
||||
run: invoke install --dev
|
||||
env:
|
||||
SETUP_INITIALIZING: 1
|
||||
- name: Run invoke install
|
||||
if: ${{ inputs.install == 'true' }}
|
||||
shell: bash
|
||||
run: invoke install
|
||||
env:
|
||||
SETUP_INITIALIZING: 1
|
||||
- name: Run invoke update
|
||||
if: ${{ inputs.update == 'true' }}
|
||||
shell: bash
|
||||
run: invoke update --skip-backup --skip-static --no-frontend
|
||||
env:
|
||||
SETUP_INITIALIZING: 1
|
||||
- name: Collect static files
|
||||
if: ${{ inputs.static == 'true' }}
|
||||
shell: bash
|
||||
run: invoke static --skip-plugins
|
||||
env:
|
||||
SETUP_INITIALIZING: 1
|
||||
@@ -235,6 +235,7 @@ PLUGIN_TESTING_SETUP = get_setting(
|
||||
PLUGIN_TESTING_EVENTS = False # Flag if events are tested right now
|
||||
PLUGIN_TESTING_EVENTS_ASYNC = False # Flag if events are tested asynchronously
|
||||
PLUGIN_TESTING_RELOAD = False # Flag if plugin reloading is in testing (check_reload)
|
||||
SETUP_INITIALIZING = os.environ.get('SETUP_INITIALIZING', '0') == '1'
|
||||
|
||||
# Plugin development settings
|
||||
PLUGIN_DEV_SLUG = get_setting('INVENTREE_PLUGIN_DEV_SLUG', 'plugin_dev.slug')
|
||||
|
||||
@@ -4,11 +4,11 @@ Used to serialize an potentially long-running operation,
|
||||
without holding a database transaction open for the duration.
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from datetime import datetime, timedelta
|
||||
from typing import Optional
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import transaction
|
||||
from django.db.utils import IntegrityError, OperationalError, ProgrammingError
|
||||
from django.utils import timezone
|
||||
@@ -82,7 +82,7 @@ def acquire_lease_blocking(
|
||||
"""
|
||||
deadline = time.monotonic() + timeout
|
||||
|
||||
if os.environ.get('SETUP_INITIALIZING', '0') == '1':
|
||||
if settings.SETUP_INITIALIZING:
|
||||
logger.debug("Skipping lease acquisition for '%s' during initialization", key)
|
||||
return True
|
||||
|
||||
|
||||
@@ -227,6 +227,10 @@ class PluginsRegistry:
|
||||
dict[str, PluginConfig]: Mapping of plugin slug to PluginConfig instance.
|
||||
None if the database is not ready to be queried.
|
||||
"""
|
||||
# skip if the setup is initializing
|
||||
if settings.SETUP_INITIALIZING:
|
||||
return None
|
||||
|
||||
# As we have already checked the registry hash, this is a valid cache key
|
||||
cache_key = f'plugin_configs:{self.registry_hash}'
|
||||
|
||||
@@ -518,8 +522,10 @@ class PluginsRegistry:
|
||||
self.update_plugin_hash()
|
||||
logger.info('Plugin Registry: Loaded %s plugins', len(self.plugins))
|
||||
|
||||
# Ensure that each loaded plugin has a valid configuration object in the database
|
||||
for plugin in self.plugins.values():
|
||||
# Ensure that each loaded plugin has a valid configuration object in the database; skip if setup is initializing
|
||||
for plugin in (
|
||||
self.plugins.values() if not settings.SETUP_INITIALIZING else []
|
||||
):
|
||||
if config := self.get_plugin_config(plugin.slug):
|
||||
# Ensure mandatory plugins are marked as active
|
||||
if config.is_mandatory() and not config.active:
|
||||
|
||||
Reference in new issue
Block a user