Deploy Lobby listener patches through the guarded fleet installer
This commit is contained in:
parent
2ac393e3a0
commit
480dc03268
3 changed files with 41 additions and 6 deletions
|
|
@ -29,11 +29,12 @@ jobs:
|
|||
run: |
|
||||
set -euo pipefail
|
||||
gradle --no-daemon -p JarvisConnector test jar
|
||||
python3 tools/test_plugin_fleet_install.py -v
|
||||
mkdir lobby-food-artifacts
|
||||
python3 tools/plugin_lobby_food.py JarvisConnector/build/libs/jarvistranslator.jar lobby-food-artifacts/lobby-food-classes.zip
|
||||
cp tools/plugin_lobby_food.py lobby-food-artifacts/
|
||||
cp tools/{plugin_lobby_food,install-plugin-fleet,write-plugin-manifest,plugin_menu_pack,plugin_backend_abi,plugin_fleet_rollback,plugin_pack_properties,plugin_pillager_abi}.py lobby-food-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > lobby-food-artifacts/SOURCE_COMMIT
|
||||
(cd lobby-food-artifacts && sha256sum -- lobby-food-classes.zip plugin_lobby_food.py SOURCE_COMMIT > SHA256SUMS)
|
||||
(cd lobby-food-artifacts && sha256sum -- lobby-food-classes.zip *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Lobby-Food-Startup
|
||||
|
|
|
|||
|
|
@ -75,9 +75,10 @@ def verify_dunechest_fleet_target(sid, root, unit, incoming, installed):
|
|||
|
||||
def plan(artifacts, inventory, expected_source):
|
||||
mode=inventory.get('mode')
|
||||
if mode not in {'gui-preserve-backends','pillager-preserve-economy','arrakis-crysknife','navigator','planet-dunechest','fleet-dunechest','arrakis-raw-spice','arrakis-jerboa','compact-menus'}:
|
||||
if mode not in {'gui-preserve-backends','pillager-preserve-economy','arrakis-crysknife','navigator','planet-dunechest','fleet-dunechest','arrakis-raw-spice','arrakis-jerboa','compact-menus','lobby-food'}:
|
||||
raise ValueError('An explicit supported rollout mode is required')
|
||||
compact_menus=mode=='compact-menus'
|
||||
lobby_food=mode=='lobby-food'
|
||||
jerboa=mode=='arrakis-jerboa'
|
||||
raw_spice=mode=='arrakis-raw-spice'
|
||||
pillager=mode=='pillager-preserve-economy'
|
||||
|
|
@ -98,10 +99,10 @@ def plan(artifacts, inventory, expected_source):
|
|||
raise ValueError('Compact menus require retaining the current resource pack')
|
||||
if jerboa:
|
||||
allowed_names={'DuneTerrain'}
|
||||
if raw_spice:
|
||||
if raw_spice or lobby_food:
|
||||
allowed_names={'JarvisTranslator'}
|
||||
if inventory.get('menuPack') is not None:
|
||||
raise ValueError('Raw spice rollout must retain current resource pack configuration')
|
||||
raise ValueError('Scoped JARVIS rollout must retain current resource pack configuration')
|
||||
files, names = {}, set()
|
||||
for entry in manifest['plugins']:
|
||||
name = entry['filename']
|
||||
|
|
@ -168,7 +169,7 @@ def plan(artifacts, inventory, expected_source):
|
|||
uses_menu=not compact_menus and ('dunemenus' in wanted or bool(menu and menu.get('unified') and not (crysknife or dunechest or jerboa)))
|
||||
if menu and menu.get('unified') and not (crysknife or dunechest or jerboa) and 'dunerealmsgui' not in wanted:
|
||||
raise ValueError('Unified pack rollout must select its matching DunerealmsGUI adapter')
|
||||
if not (pillager or crysknife or navigator or dunechest or raw_spice or jerboa) and wanted - {'dunemenus','dunerealmsgui','dunenpc','dunelobby','mcgui'}:
|
||||
if not (pillager or crysknife or navigator or dunechest or raw_spice or jerboa or lobby_food) and wanted - {'dunemenus','dunerealmsgui','dunenpc','dunelobby','mcgui'}:
|
||||
raise ValueError('GUI rollout must retain working Ess/JARVIS/Core/Terrain binaries')
|
||||
if compact_menus:
|
||||
expected_root = Path('/opt/dunerealms/lobby') if sid == 'lobby' else Path('/opt/dunerealms/servers') / sid
|
||||
|
|
@ -181,6 +182,9 @@ def plan(artifacts, inventory, expected_source):
|
|||
if raw_spice and (sid != 'arrakis' or root != ARRAKIS_ROOT or unit != 'dune-arrakis.service'
|
||||
or wanted != {'jarvistranslator'} or selected_prerequisites):
|
||||
raise ValueError('Raw spice rollout may only replace JARVIS on Arrakis')
|
||||
if lobby_food and (sid != 'lobby' or root != Path('/opt/dunerealms/lobby') or unit != 'dune-lobby.service'
|
||||
or wanted != {'jarvistranslator'} or selected_prerequisites):
|
||||
raise ValueError('Lobby food rollout may only replace JARVIS on Lobby')
|
||||
if crysknife and (
|
||||
sid != 'arrakis' or unit != 'dune-arrakis.service'
|
||||
or root != ARRAKIS_ROOT
|
||||
|
|
@ -366,6 +370,15 @@ def plan(artifacts, inventory, expected_source):
|
|||
replaced = {entry['filename'] for entry in previous}
|
||||
retained = [{'filename': path.name, 'sha256': digest(path), 'metadata': metadata(path)}
|
||||
for path in sorted(plugins.glob('*.jar')) if path.name not in replaced]
|
||||
if lobby_food:
|
||||
from plugin_lobby_food import verify_candidate
|
||||
installed = existing_paths.get('jarvistranslator')
|
||||
if installed is None:
|
||||
raise ValueError('Lobby food rollout requires the retained Lobby JARVIS')
|
||||
verify_candidate(installed, chosen[0]['source'], artifacts, expected_source)
|
||||
replaced = {entry['filename'] for entry in previous}
|
||||
retained = [{'filename': path.name, 'sha256': digest(path), 'metadata': metadata(path)}
|
||||
for path in sorted(plugins.glob('*.jar')) if path.name not in replaced]
|
||||
configurations = []
|
||||
if uses_menu or crysknife or dunechest or jerboa:
|
||||
if menu is None:
|
||||
|
|
|
|||
|
|
@ -40,6 +40,27 @@ def assemble(baseline, patch, output):
|
|||
candidate.writestr(entry, data)
|
||||
|
||||
|
||||
def verify_candidate(baseline, candidate, artifact, source):
|
||||
expected_names = {'lobby-food-classes.zip', 'plugin_lobby_food.py', 'SOURCE_COMMIT',
|
||||
'install-plugin-fleet.py', 'write-plugin-manifest.py', 'plugin_menu_pack.py',
|
||||
'plugin_backend_abi.py', 'plugin_fleet_rollback.py', 'plugin_pack_properties.py',
|
||||
'plugin_pillager_abi.py'}
|
||||
sums = dict(line.split(' ', 1)[::-1] for line in (artifact / 'SHA256SUMS').read_text().splitlines())
|
||||
if sums.keys() != expected_names or any(
|
||||
hashlib.sha256((artifact / name).read_bytes()).hexdigest() != sha for name, sha in sums.items()
|
||||
) or (artifact / 'SOURCE_COMMIT').read_text().strip() != source:
|
||||
raise ValueError('Lobby listener patch does not match the selected source and checksums')
|
||||
if hashlib.sha256(baseline.read_bytes()).hexdigest() != BASELINE:
|
||||
raise ValueError('Expected the exact retained Lobby JARVIS baseline')
|
||||
with ZipFile(baseline) as original, ZipFile(candidate) as incoming, ZipFile(artifact / 'lobby-food-classes.zip') as updates:
|
||||
if unique_names(updates) != set(CLASSES) or unique_names(incoming) != unique_names(original):
|
||||
raise ValueError('Unexpected Lobby JARVIS archive contents')
|
||||
for name in incoming.namelist():
|
||||
expected = updates.read(name) if name in CLASSES else original.read(name)
|
||||
if incoming.read(name) != expected:
|
||||
raise ValueError(f'Unexpected Lobby JARVIS entry: {name}')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('input', type=Path)
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff