Keep Arrakis GUI and server pack pins in sync #28
3 changed files with 37 additions and 3 deletions
|
|
@ -33,6 +33,7 @@ jobs:
|
|||
python3 tools/plugin_pillager_abi.py JarvisConnector/build/libs/jarvistranslator.jar
|
||||
python3 tools/verify-arrakis-terrain.py DuneTerrain/build/libs/DuneRealms-Terrain.jar DuneTerrain/src/test/resources/retained-arrakis-terrain.json
|
||||
python3 tools/test_plugin_fleet_install.py -v
|
||||
python3 tools/test_plugin_pillager_profile.py PillagerProfileTests -v
|
||||
python3 tools/test_plugin_pack_properties.py -v
|
||||
mkdir crysknife-artifacts
|
||||
cp JarvisConnector/build/libs/jarvistranslator.jar DuneTerrain/build/libs/DuneRealms-Terrain.jar crysknife-artifacts/
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@ PRIVATE_PREREQUISITES = {
|
|||
'name': 'MCGUI', 'version': '0.8.6', 'main': 'ai.resourcepack.ui.MCGUIPlugin',
|
||||
'filename': 'MCGUI-0.8.6.jar'}
|
||||
}
|
||||
ARRAKIS_ROOT = Path('/opt/dunerealms/servers/arrakis')
|
||||
CRYSKNIFE_PRIOR_JARVIS_SHA256 = '663c28c5fb246b3d5c14b2faeaf0b6c000e38a53b3d45459221e4d3b85f242c3'
|
||||
|
||||
|
||||
def digest(path):
|
||||
|
|
@ -124,7 +126,7 @@ def plan(artifacts, inventory, expected_source):
|
|||
raise ValueError('GUI rollout must retain working Ess/JARVIS/Core/Terrain binaries')
|
||||
if crysknife and (
|
||||
sid != 'arrakis' or unit != 'dune-arrakis.service'
|
||||
or root != Path('/opt/dunerealms/servers/arrakis')
|
||||
or root != ARRAKIS_ROOT
|
||||
or wanted != {'jarvistranslator','duneterrain'} or selected_prerequisites
|
||||
):
|
||||
raise ValueError('Crysknife rollout is restricted to the Arrakis JARVIS and Terrain pair')
|
||||
|
|
@ -207,7 +209,7 @@ def plan(artifacts, inventory, expected_source):
|
|||
retained.append({'filename':path.name,'sha256':digest(path),'metadata':metadata(path)})
|
||||
if crysknife:
|
||||
incoming = {entry['name'].casefold(): entry for entry in chosen}
|
||||
pins = {'jarvistranslator': '663c28c5fb246b3d5c14b2faeaf0b6c000e38a53b3d45459221e4d3b85f242c3',
|
||||
pins = {'jarvistranslator': CRYSKNIFE_PRIOR_JARVIS_SHA256,
|
||||
'duneterrain': REVIEWED_TERRAIN_SHA256}
|
||||
for name, prior_pin in pins.items():
|
||||
installed = existing_paths.get(name)
|
||||
|
|
@ -223,13 +225,17 @@ def plan(artifacts, inventory, expected_source):
|
|||
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:
|
||||
if uses_menu or crysknife:
|
||||
if menu is None:
|
||||
raise ValueError('DuneMenus requires a verified published built menu overlay')
|
||||
for relative, content in config_payloads(menu).items():
|
||||
target = plugins / relative
|
||||
if target.is_symlink() or target.parent.is_symlink():
|
||||
raise ValueError('Menu configuration path must not be a symlink')
|
||||
if crysknife and relative == 'MCGUI/config.yml' and (
|
||||
not target.is_file() or target.read_bytes() != content.encode()
|
||||
):
|
||||
raise ValueError('Crysknife rollout must preserve the existing MCGUI engine configuration')
|
||||
previous_hash = None
|
||||
if target.exists():
|
||||
if not target.read_text().startswith('# Managed by DuneRealms plugin CI;'):
|
||||
|
|
|
|||
|
|
@ -11,6 +11,8 @@ from unittest.mock import patch
|
|||
import zipfile
|
||||
sys.path.insert(0,str(Path(__file__).resolve().parent))
|
||||
import plugin_pillager_abi as abi
|
||||
from plugin_menu_pack import config_payloads
|
||||
from plugin_pack_properties import fields, plan as plan_pack_properties
|
||||
from test_plugin_fleet_install import jar,Service,SOURCE
|
||||
spec=importlib.util.spec_from_file_location('pillager_installer',Path(__file__).with_name('install-plugin-fleet.py'))
|
||||
installer=importlib.util.module_from_spec(spec);spec.loader.exec_module(installer)
|
||||
|
|
@ -59,6 +61,31 @@ class PillagerProfileTests(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):installer.apply(plan,self.root/'backup',service)
|
||||
self.assertFalse(any(c[0]=='stop' for c in service.calls))
|
||||
|
||||
def test_crysknife_projects_matching_pack_pins_without_changing_mcgui_engine(self):
|
||||
pack={'unified':True,'sourceCommit':SOURCE,'sha1':'1'*40,'sha256':'2'*64,
|
||||
'packId':'c24c7cf5-a292-539d-971f-a96d8b838162'}
|
||||
for relative,content in config_payloads(dict(pack,sourceCommit='b'*40,sha1='3'*40)).items():
|
||||
target=self.plugins/relative
|
||||
target.parent.mkdir()
|
||||
target.write_bytes(content.encode())
|
||||
engine=self.plugins/'MCGUI/config.yml'
|
||||
engine_before=engine.read_bytes()
|
||||
self.inventory['mode']='arrakis-crysknife'
|
||||
self.inventory['servers'][0].update(serviceUnit='dune-arrakis.service',artifacts=['jarvistranslator.jar','Terrain.jar'])
|
||||
with patch.multiple(installer,ARRAKIS_ROOT=self.game.resolve(),
|
||||
CRYSKNIFE_PRIOR_JARVIS_SHA256=installer.digest(self.plugins/'jarvistranslator.jar'),
|
||||
load_menu=lambda *a:(None,pack),config_payloads=config_payloads), \
|
||||
patch.object(installer.pack_properties,'plan',side_effect=plan_pack_properties):
|
||||
deployment=self.plan()
|
||||
installer.apply(deployment,self.root/'crysknife-rollback',Service())
|
||||
properties=fields((self.game/'server.properties').read_bytes())
|
||||
gui=dict(line.split(': ',1) for line in (self.plugins/'DunerealmsGUI/menu-pack.yml').read_text().splitlines()
|
||||
if not line.startswith('#'))
|
||||
for prop,key in [('resource-pack','url'),('resource-pack-sha1','sha1'),('resource-pack-id','pack-id')]:
|
||||
self.assertEqual(properties[prop],json.loads(gui[key]))
|
||||
self.assertEqual(gui['delivery'],'server')
|
||||
self.assertEqual(engine.read_bytes(),engine_before)
|
||||
|
||||
|
||||
class PillagerAbiTests(unittest.TestCase):
|
||||
def test_compiled_jarvis_retains_both_actual_variants_and_missing_api_fails(self):
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff