fix(manager): match Mission Core landing geometry
This commit is contained in:
@@ -11,21 +11,25 @@ const platformRoot = resolve(scriptDir, "../..");
|
||||
const devicePlaneRoot = platformRoot;
|
||||
const managerRoot = resolve(platformRoot, "apps/device-manager");
|
||||
const artifactDir = resolve(process.env.NODEDC_DEPLOY_ARTIFACT_DIR || resolve(scriptDir, "../deploy-artifacts"));
|
||||
const [patchId = "device-manager-release-v3-20260812-026", ...extra] = process.argv.slice(2);
|
||||
const [patchId = "device-manager-release-v5-20260822-034", ...extra] = process.argv.slice(2);
|
||||
if (extra.length || !/^[A-Za-z0-9._-]{1,96}$/.test(patchId)) throw new Error("usage: build-device-manager-control-plane-artifact.mjs [patch-id]");
|
||||
|
||||
const descriptorPath = patchId.startsWith("device-manager-release-v4-")
|
||||
? "deployment/device-manager-release-v4.json"
|
||||
: patchId.startsWith("device-manager-release-v3-")
|
||||
? "deployment/device-manager-release-v3.json"
|
||||
: "deployment/device-manager-release-v1.json";
|
||||
const descriptorPath = patchId.startsWith("device-manager-release-v5-")
|
||||
? "deployment/device-manager-release-v5.json"
|
||||
: patchId.startsWith("device-manager-release-v4-")
|
||||
? "deployment/device-manager-release-v4.json"
|
||||
: patchId.startsWith("device-manager-release-v3-")
|
||||
? "deployment/device-manager-release-v3.json"
|
||||
: "deployment/device-manager-release-v1.json";
|
||||
|
||||
const isV3 = descriptorPath.endsWith("release-v3.json");
|
||||
const isV4 = descriptorPath.endsWith("release-v4.json");
|
||||
const isManagerOnly = isV3 || isV4;
|
||||
const isV5 = descriptorPath.endsWith("release-v5.json");
|
||||
const isPersistent = isV4 || isV5;
|
||||
const isManagerOnly = isV3 || isPersistent;
|
||||
const composeSource = resolve(devicePlaneRoot, "docker-compose.device-manager.yml");
|
||||
const composeSourceSha256 = createHash("sha256").update(await readFile(composeSource)).digest("hex");
|
||||
if (!isV4 && composeSourceSha256 !== "4954120aaddc999798b64c304d8cf692b79714feb727d873117bd1f3434e865e") {
|
||||
if (!isPersistent && composeSourceSha256 !== "4954120aaddc999798b64c304d8cf692b79714feb727d873117bd1f3434e865e") {
|
||||
throw new Error("historical_device_manager_compose_has_advanced");
|
||||
}
|
||||
const entries = isManagerOnly ? [
|
||||
@@ -120,7 +124,7 @@ try {
|
||||
"NODEDC_LAUNCHER_INTERNAL_TOKEN_FILE: /run/nodedc-secrets/device-core-internal-token",
|
||||
"NODEDC_DEVICE_CORE_TOKEN_FILE: /run/nodedc-secrets/management-core-token",
|
||||
"name: nodedc-platform_edge",
|
||||
...(isV4 ? [
|
||||
...(isPersistent ? [
|
||||
"NODEDC_DEVICE_MANAGER_PRESENTATION_PATH: /var/lib/nodedc-device-manager/device-manager-presentation.json",
|
||||
"NODEDC_DEVICE_MANAGER_MEDIA_ROOT: /var/lib/nodedc-device-manager/media",
|
||||
"source: /volume1/docker/nodedc-device-plane/data/device-manager",
|
||||
@@ -152,15 +156,40 @@ try {
|
||||
|| !/^[A-Za-z0-9._-]{1,96}$/.test(predecessor.patchId || "")
|
||||
|| !/^[a-f0-9]{64}$/.test(predecessor.artifactSha256 || "")
|
||||
|| (descriptor.action === "activate") !== (predecessor.kind === "reconciliation")
|
||||
|| descriptor.healthGate !== (isV4
|
||||
|| descriptor.healthGate !== (isPersistent
|
||||
? "bounded-container-grace+core-contract+persistent-data"
|
||||
: "bounded-container-grace+core-contract")
|
||||
|| descriptor.rollback !== (isV4
|
||||
|| descriptor.rollback !== (isPersistent
|
||||
? "restore-preapply-snapshot-preserve-manager-data"
|
||||
: "restore-preapply-snapshot")
|
||||
);
|
||||
if (commonContractInvalid) throw new Error("device_manager_activation_successor_contract_mismatch");
|
||||
if (descriptorPath.endsWith("release-v4.json")) {
|
||||
if (descriptorPath.endsWith("release-v5.json")) {
|
||||
if (
|
||||
descriptor.schemaVersion !== "nodedc.device-plane.device-manager-release.v5"
|
||||
|| descriptor.predecessor?.kind !== "release"
|
||||
|| descriptor.predecessor?.patchId !== "device-manager-release-v4-20260822-033"
|
||||
|| descriptor.predecessor?.artifactSha256 !== "52ba322042f1e4f595bbfea99f8bb35630b15984e0da648dc55348bc9e5b2066"
|
||||
|| descriptor.commandTransport !== "typed-service-ping-v1"
|
||||
|| descriptor.commandCatalog !== "allowlisted-adapter-typed-commands-only"
|
||||
|| descriptor.credentialBoundary !== "transient-core-memory-then-single-pinned-mtls-command-envelope-to-edge-never-persisted-never-logged-never-returned"
|
||||
|| descriptor.controlCorePredecessor?.patchId !== "device-control-core-release-v2-20260821-030"
|
||||
|| descriptor.controlCorePredecessor?.artifactSha256 !== "8459521a662541a5a87cb0188991cdcfb51727427db8ec2a232ce4846bfc3454"
|
||||
|| descriptor.edgeChannelPredecessor?.patchId !== "device-edge-core-channel-upgrade-v4-20260812-023"
|
||||
|| descriptor.edgeChannelPredecessor?.artifactSha256 !== "c10d5b6b7d55ab239f85b6c8130e34ce9f84985e3b46e6e5534733156c7982fc"
|
||||
|| descriptor.presentationPersistence !== "runner-managed-host-data-bind"
|
||||
|| descriptor.presentationDataHostPath !== "/volume1/docker/nodedc-device-plane/data/device-manager"
|
||||
|| descriptor.presentationDataContainerPath !== "/var/lib/nodedc-device-manager"
|
||||
|| descriptor.presentationDataOwnership !== "uid-1000-gid-1000-mode-0750"
|
||||
|| descriptor.presentationDataLifecycle !== "preserve-across-manager-recreate-and-source-rollback"
|
||||
|| descriptor.presentationPath !== "/var/lib/nodedc-device-manager/device-manager-presentation.json"
|
||||
|| descriptor.mediaRoot !== "/var/lib/nodedc-device-manager/media"
|
||||
|| descriptor.defaultAccentHex !== "#f5f5f5"
|
||||
|| descriptor.overviewLayout !== "mission-core-landing-stage-v1"
|
||||
|| descriptor.rollback !== "restore-preapply-snapshot-preserve-manager-data"
|
||||
|| descriptor.gelios !== "untouched-legacy-only"
|
||||
) throw new Error("device_manager_v5_overview_layout_contract_mismatch");
|
||||
} else if (descriptorPath.endsWith("release-v4.json")) {
|
||||
if (
|
||||
descriptor.schemaVersion !== "nodedc.device-plane.device-manager-release.v4"
|
||||
|| descriptor.commandTransport !== "typed-service-ping-v1"
|
||||
|
||||
@@ -448,6 +448,61 @@ class DeviceManagerControlPlaneArtifactsTest(unittest.TestCase):
|
||||
)
|
||||
)
|
||||
|
||||
def test_device_manager_release_v5_matches_mission_core_landing_geometry(self):
|
||||
patch_id = "device-manager-release-v5-unit-001"
|
||||
manifest, entries, names, result = self.assert_deterministic_artifact(
|
||||
"build-device-manager-control-plane-artifact.mjs",
|
||||
patch_id,
|
||||
RUNNER.DEVICE_PLANE_MANAGER_RELEASE_V5_ENTRIES,
|
||||
)
|
||||
self.assertEqual(manifest["component"], "device-plane")
|
||||
self.assertEqual(result["services"], ["device-manager"])
|
||||
self.assertFalse(
|
||||
any(name.startswith("payload/services/device-control-core/") for name in names)
|
||||
)
|
||||
self.assertFalse(any(name.startswith("payload/packages/") for name in names))
|
||||
self.assertFalse(any(name.endswith((".test.mjs", ".map")) for name in names))
|
||||
template = json.loads(
|
||||
(
|
||||
DEVICE_CORE_ROOT
|
||||
/ "deployment/device-manager-release-v5.json"
|
||||
).read_text(encoding="utf-8")
|
||||
)
|
||||
descriptor = {**template, "releaseId": patch_id}
|
||||
self.assertIs(
|
||||
RUNNER.validate_device_plane_manager_release_descriptor(
|
||||
descriptor,
|
||||
schema_version=(
|
||||
"nodedc.device-plane.device-manager-release.v5"
|
||||
),
|
||||
boundaries=(
|
||||
RUNNER.expected_device_plane_manager_release_v5_boundaries()
|
||||
),
|
||||
expected_release_id=patch_id,
|
||||
),
|
||||
descriptor,
|
||||
)
|
||||
self.assertEqual(
|
||||
descriptor["overviewLayout"],
|
||||
"mission-core-landing-stage-v1",
|
||||
)
|
||||
self.assertEqual(
|
||||
descriptor["predecessor"],
|
||||
{
|
||||
"kind": "release",
|
||||
"patchId": "device-manager-release-v4-20260822-033",
|
||||
"artifactSha256": (
|
||||
"52ba322042f1e4f595bbfea99f8bb35630b15984e0da648dc55348bc9e5b2066"
|
||||
),
|
||||
},
|
||||
)
|
||||
self.assertTrue(
|
||||
RUNNER.is_device_plane_manager_release_v5_slice(
|
||||
"device-plane",
|
||||
entries,
|
||||
)
|
||||
)
|
||||
|
||||
def test_historical_manager_builder_fails_closed_after_v4_compose(self):
|
||||
if self.historical_manager_compose_is_current():
|
||||
self.skipTest("historical Manager Compose is still current")
|
||||
|
||||
Reference in New Issue
Block a user