Provision accounts from authenticated first Lobby joins
This commit is contained in:
parent
98376da8b5
commit
cd4d04b7f8
5 changed files with 78 additions and 5 deletions
43
.forgejo/workflows/lobby-account.yml
Normal file
43
.forgejo/workflows/lobby-account.yml
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
name: Lobby Account Provisioning Build
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: ['feat/lobby-first-join-account-*']
|
||||
|
||||
jobs:
|
||||
lobby-account:
|
||||
runs-on: dune-ci
|
||||
steps:
|
||||
- name: Check out exact revision
|
||||
shell: bash
|
||||
env:
|
||||
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
git init .
|
||||
git -c http.extraheader="AUTHORIZATION: basic $(printf 'x-access-token:%s' "$REPO_TOKEN" | base64 -w0)" fetch --depth=1 https://www.dunerealms.com/git/unimatrix/plugins.git "$GITHUB_SHA"
|
||||
git checkout --detach FETCH_HEAD
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: temurin
|
||||
java-version: '21'
|
||||
- uses: gradle/actions/setup-gradle@v4
|
||||
with:
|
||||
gradle-version: '9.2.1'
|
||||
- name: Build and verify the standalone Lobby module
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
gradle --no-daemon -p DuneLobbyAccount test jar
|
||||
python3 tools/test_plugin_fleet_install.py -v
|
||||
mkdir lobby-account-artifacts
|
||||
cp DuneLobbyAccount/build/libs/DuneLobbyAccount.jar lobby-account-artifacts/
|
||||
printf '%s\n' "$(git rev-parse HEAD)" > lobby-account-artifacts/SOURCE_COMMIT
|
||||
python3 tools/write-plugin-manifest.py lobby-account-artifacts "$GITHUB_SHA"
|
||||
cp tools/{install-plugin-fleet,plugin_menu_pack,plugin_backend_abi,plugin_fleet_rollback,plugin_pack_properties,plugin_pillager_abi}.py lobby-account-artifacts/
|
||||
(cd lobby-account-artifacts && sha256sum -- *.jar *.json *.py SOURCE_COMMIT > SHA256SUMS)
|
||||
- uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DuneRealms-Lobby-Account
|
||||
path: lobby-account-artifacts/
|
||||
if-no-files-found: error
|
||||
|
|
@ -28,7 +28,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
modules=(DuneEss DuneLobby DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector DuneMenus)
|
||||
modules=(DuneEss DuneLobby DuneLobbyAccount DuneNPC DuneRealms-minecraft-only DuneRealmsGUI DuneTerrain JarvisConnector DuneMenus)
|
||||
mkdir -p plugin-artifacts
|
||||
for module in "${modules[@]}"; do
|
||||
gradle --no-daemon -p "$module" test jar
|
||||
|
|
|
|||
|
|
@ -75,10 +75,11 @@ 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','lobby-food'}:
|
||||
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','lobby-account'}:
|
||||
raise ValueError('An explicit supported rollout mode is required')
|
||||
compact_menus=mode=='compact-menus'
|
||||
lobby_food=mode=='lobby-food'
|
||||
lobby_account=mode=='lobby-account'
|
||||
jerboa=mode=='arrakis-jerboa'
|
||||
raw_spice=mode=='arrakis-raw-spice'
|
||||
pillager=mode=='pillager-preserve-economy'
|
||||
|
|
@ -97,6 +98,10 @@ def plan(artifacts, inventory, expected_source):
|
|||
allowed_names={'DuneMenus'}
|
||||
if inventory.get('menuPack') is not None:
|
||||
raise ValueError('Compact menus require retaining the current resource pack')
|
||||
if lobby_account:
|
||||
allowed_names={'DuneLobbyAccount'}
|
||||
if inventory.get('menuPack') is not None or inventory.get('privatePrerequisites'):
|
||||
raise ValueError('Lobby account rollout must retain the current resource pack and runtimes')
|
||||
if jerboa:
|
||||
allowed_names={'DuneTerrain'}
|
||||
if raw_spice or lobby_food:
|
||||
|
|
@ -169,7 +174,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 or lobby_food) and wanted - {'dunemenus','dunerealmsgui','dunenpc','dunelobby','mcgui'}:
|
||||
if not (pillager or crysknife or navigator or dunechest or raw_spice or jerboa or lobby_food or lobby_account) 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
|
||||
|
|
@ -185,6 +190,9 @@ def plan(artifacts, inventory, expected_source):
|
|||
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 lobby_account and (sid != 'lobby' or root != Path('/opt/dunerealms/lobby') or unit != 'dune-lobby.service'
|
||||
or wanted != {'dunelobbyaccount'} or selected_prerequisites):
|
||||
raise ValueError('Account provisioning may only install the standalone plugin on Lobby')
|
||||
if crysknife and (
|
||||
sid != 'arrakis' or unit != 'dune-arrakis.service'
|
||||
or root != ARRAKIS_ROOT
|
||||
|
|
@ -379,6 +387,17 @@ 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_account:
|
||||
credential = Path('/etc/dunerealms/lobby-account.token')
|
||||
if (credential.is_symlink() or not credential.is_file() or
|
||||
metadata(credential)['mode'] != 0o600 or credential.stat().st_uid != plugins.stat().st_uid):
|
||||
raise ValueError('Expected the private service-owned Lobby account token')
|
||||
installed = existing_paths.get('dunelobbyaccount')
|
||||
if installed is not None and digest(installed) != chosen[0]['sha256']:
|
||||
raise ValueError('Unexpected prior Lobby account plugin')
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ def validate(text):
|
|||
raise ValueError('Missing exact-source build: ' + command)
|
||||
modules = re.search(r'^\s*modules=\(([^)]+)\)', text, re.M)
|
||||
if not modules or set(modules[1].split()) != {
|
||||
'DuneEss', 'DuneLobby', 'DuneNPC', 'DuneRealms-minecraft-only',
|
||||
'DuneEss', 'DuneLobby', 'DuneLobbyAccount', 'DuneNPC', 'DuneRealms-minecraft-only',
|
||||
'DuneRealmsGUI', 'DuneTerrain', 'JarvisConnector', 'DuneMenus',
|
||||
}:
|
||||
raise ValueError('All eight source modules must retain tests and compilation')
|
||||
raise ValueError('All nine source modules must retain tests and compilation')
|
||||
for script in CHECKS:
|
||||
if 'python3 tools/' + script + ' -v' not in text:
|
||||
raise ValueError('Missing release regression check: ' + script)
|
||||
|
|
|
|||
|
|
@ -89,6 +89,17 @@ class FleetInstallerTests(unittest.TestCase):
|
|||
with self.assertRaises(ValueError):
|
||||
self.deployment()
|
||||
|
||||
def test_account_artifact_cannot_install_on_a_planet(self):
|
||||
candidate = self.artifacts / 'DuneLobbyAccount.jar'
|
||||
jar(candidate, 'DuneLobbyAccount')
|
||||
entry = dict(installer.identity(candidate), filename=candidate.name, sha256=installer.digest(candidate))
|
||||
(self.artifacts / 'release-manifest.json').write_text(json.dumps({'sourceCommit': SOURCE, 'plugins': [entry]}))
|
||||
server = self.inventory['servers'][0]
|
||||
server.update(id='arrakis', serviceUnit='dune-arrakis.service', artifacts=[candidate.name])
|
||||
self.inventory['mode'] = 'lobby-account'
|
||||
with self.assertRaisesRegex(ValueError, 'standalone plugin on Lobby'):
|
||||
self.deployment()
|
||||
|
||||
def test_replaces_by_identity_and_preserves_backend_and_third_party(self):
|
||||
preserved = {n: (self.plugins / n).read_bytes() for n in ('DuneNPC.jar', 'MCGUI.jar')}
|
||||
service = Service()
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff