Compare commits
3
Commits
main
...
93b91a4b1e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93b91a4b1e | ||
|
|
aba78dea98 | ||
|
|
feeb0766c0 |
@@ -2962,6 +2962,10 @@ GITEA_SALVAGE_UNSUPPORTED_SCHEMA_TABLES = tuple(
|
|||||||
)
|
)
|
||||||
|
|
||||||
COMPONENTS = {
|
COMPONENTS = {
|
||||||
|
"device-core-network-priority": {
|
||||||
|
"payload_root": DEVICE_PLANE_ROOT,
|
||||||
|
"artifact_only": True, "services": (),
|
||||||
|
},
|
||||||
"device-core-autodeploy": {
|
"device-core-autodeploy": {
|
||||||
"payload_root": Path("/volume1/docker/nodedc-device-autodeploy"),
|
"payload_root": Path("/volume1/docker/nodedc-device-autodeploy"),
|
||||||
"bootstrap_root": True, "artifact_only": True, "services": (),
|
"bootstrap_root": True, "artifact_only": True, "services": (),
|
||||||
@@ -4979,6 +4983,10 @@ def denied_payload_path(component, rel):
|
|||||||
|
|
||||||
def allowed_payload_path(component, rel):
|
def allowed_payload_path(component, rel):
|
||||||
validate_posix_path(rel)
|
validate_posix_path(rel)
|
||||||
|
if component == "device-core-network-priority":
|
||||||
|
if rel in ("deployment", *DEVICE_PRIORITY_ENTRIES):
|
||||||
|
return True
|
||||||
|
die("Device Core network priority accepts only its fixed two files")
|
||||||
if component == "device-core-autodeploy":
|
if component == "device-core-autodeploy":
|
||||||
if rel in ("deployment", DEVICE_AUTODEPLOY_ENTRY):
|
if rel in ("deployment", DEVICE_AUTODEPLOY_ENTRY):
|
||||||
return True
|
return True
|
||||||
@@ -11607,6 +11615,8 @@ def load_artifact(artifact, work_dir):
|
|||||||
die(f"files.txt entry missing in payload: {rel}")
|
die(f"files.txt entry missing in payload: {rel}")
|
||||||
|
|
||||||
validate_payload_tree(manifest["component"], payload_dir, entries)
|
validate_payload_tree(manifest["component"], payload_dir, entries)
|
||||||
|
if manifest["component"] == "device-core-network-priority":
|
||||||
|
validate_device_priority_payload(payload_dir, entries, manifest["id"])
|
||||||
if manifest["component"] == "device-core-autodeploy":
|
if manifest["component"] == "device-core-autodeploy":
|
||||||
validate_device_autodeploy_payload(payload_dir, entries, manifest["id"])
|
validate_device_autodeploy_payload(payload_dir, entries, manifest["id"])
|
||||||
if manifest["component"] == "device-core-release-drift-audit":
|
if manifest["component"] == "device-core-release-drift-audit":
|
||||||
@@ -22463,6 +22473,10 @@ def is_platform_provider_catalog_only(entries):
|
|||||||
|
|
||||||
|
|
||||||
def component_services(component, entries=None):
|
def component_services(component, entries=None):
|
||||||
|
if component == "device-core-network-priority":
|
||||||
|
if tuple(entries or ()) != DEVICE_PRIORITY_ENTRIES:
|
||||||
|
die("Device Core network priority requires exact entries")
|
||||||
|
return ()
|
||||||
if component == "device-core-autodeploy":
|
if component == "device-core-autodeploy":
|
||||||
if tuple(entries or ()) != (DEVICE_AUTODEPLOY_ENTRY,):
|
if tuple(entries or ()) != (DEVICE_AUTODEPLOY_ENTRY,):
|
||||||
die("Device Core autodeploy requires the exact descriptor entry")
|
die("Device Core autodeploy requires the exact descriptor entry")
|
||||||
@@ -22804,7 +22818,7 @@ def component_compose_files(
|
|||||||
expected_node_intelligence_gateway_sha256=None,
|
expected_node_intelligence_gateway_sha256=None,
|
||||||
):
|
):
|
||||||
if component == "device-core-release":
|
if component == "device-core-release":
|
||||||
return component_compose_files("device-plane")
|
return device_priority_compose_files(component_compose_files("device-plane"))
|
||||||
if component == "engine":
|
if component == "engine":
|
||||||
root = component_root(component)
|
root = component_root(component)
|
||||||
files = [root / "docker-compose.yml"]
|
files = [root / "docker-compose.yml"]
|
||||||
@@ -32332,6 +32346,185 @@ def rollback_gitea_ci(root, backup_dir, entries, current_stamp, runtime_started)
|
|||||||
|
|
||||||
# Recurring application releases: a separate domain from immutable historical
|
# Recurring application releases: a separate domain from immutable historical
|
||||||
# Device Plane transitions. No Compose, database, secret or controller payload.
|
# Device Plane transitions. No Compose, database, secret or controller payload.
|
||||||
|
DEVICE_PRIORITY_ID = "device-core-network-priority-v1-20260930-001"
|
||||||
|
DEVICE_PRIORITY_ENTRY = "deployment/device-core-network-priority-v1.json"
|
||||||
|
DEVICE_PRIORITY_COMPOSE = "docker-compose.device-release-network-priority.yml"
|
||||||
|
DEVICE_PRIORITY_ENTRIES = (DEVICE_PRIORITY_COMPOSE, DEVICE_PRIORITY_ENTRY)
|
||||||
|
DEVICE_PRIORITY_BASELINE = "device-core-release-v1-r12-b2660df9e26afe977bfa62efd35a8397eac4898b"
|
||||||
|
DEVICE_PRIORITY_BASELINE_SHA = "44c62036967c3ed26bd6c82f94e6f4103ccad06f45c383498210b43ad80c9d7c"
|
||||||
|
DEVICE_PRIORITY_NETWORKS = {
|
||||||
|
"device-control-core": ("device-plane-private", "device-plane-egress"),
|
||||||
|
"device-manager": ("device-plane-private", "platform-edge"),
|
||||||
|
}
|
||||||
|
DEVICE_PRIORITY_YAML = """services:
|
||||||
|
device-control-core:
|
||||||
|
networks:
|
||||||
|
device-plane-private:
|
||||||
|
priority: 100
|
||||||
|
device-plane-egress:
|
||||||
|
priority: 0
|
||||||
|
device-manager:
|
||||||
|
networks:
|
||||||
|
device-plane-private:
|
||||||
|
priority: 100
|
||||||
|
platform-edge:
|
||||||
|
priority: 0
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
def device_priority_descriptor():
|
||||||
|
return {"schemaVersion": "nodedc.device-core.network-priority.v1", "releaseId": DEVICE_PRIORITY_ID,
|
||||||
|
"baselineReleaseId": DEVICE_PRIORITY_BASELINE, "baselineSha256": DEVICE_PRIORITY_BASELINE_SHA,
|
||||||
|
"mode": "metadata-only-existing-primary-network", "primaryPriority": 100, "secondaryPriority": 0}
|
||||||
|
|
||||||
|
|
||||||
|
def validate_device_priority_payload(root, entries, identity):
|
||||||
|
if tuple(entries) != DEVICE_PRIORITY_ENTRIES or identity != DEVICE_PRIORITY_ID:
|
||||||
|
die("Device Core network priority identity/entries mismatch")
|
||||||
|
if read_strict_json(root / DEVICE_PRIORITY_ENTRY, "Device Core network priority") != device_priority_descriptor():
|
||||||
|
die("Device Core network priority descriptor mismatch")
|
||||||
|
path = root / DEVICE_PRIORITY_COMPOSE
|
||||||
|
if path.is_symlink() or not path.is_file() or path.read_bytes() != DEVICE_PRIORITY_YAML.encode():
|
||||||
|
die("Device Core network priority Compose mismatch")
|
||||||
|
|
||||||
|
|
||||||
|
def device_priority_no_failed_rollback():
|
||||||
|
for row in load_state(FAILED_STATE_FILE):
|
||||||
|
if (row.get("component") == "device-core-network-priority" and row.get("started_apply")
|
||||||
|
and row.get("rollback_status") != "ok:device-core-network-priority-metadata-only"):
|
||||||
|
die("Device Core network priority requires reconciliation of failed rollback")
|
||||||
|
|
||||||
|
|
||||||
|
def device_priority_compose_files(files):
|
||||||
|
device_priority_no_failed_rollback()
|
||||||
|
present = [(DEVICE_PLANE_ROOT / entry).exists() or (DEVICE_PLANE_ROOT / entry).is_symlink()
|
||||||
|
for entry in DEVICE_PRIORITY_ENTRIES]
|
||||||
|
if not any(present):
|
||||||
|
return files
|
||||||
|
if not all(present):
|
||||||
|
die("Device Core network priority activation is incomplete")
|
||||||
|
validate_device_priority_payload(DEVICE_PLANE_ROOT, DEVICE_PRIORITY_ENTRIES, DEVICE_PRIORITY_ID)
|
||||||
|
rows = [r for r in load_state(STATE_FILE) if r.get("id") == DEVICE_PRIORITY_ID]
|
||||||
|
if len(rows) != 1 or rows[0].get("component") != "device-core-network-priority":
|
||||||
|
die("Device Core network priority has no unique canonical receipt")
|
||||||
|
# A marker alone does not authorize the extra effective Compose file.
|
||||||
|
with tempfile.TemporaryDirectory(prefix="device-priority-proof-", dir=TMP_DIR) as tmp:
|
||||||
|
manifest, entries, payload = load_artifact(device_release_applied_archive(rows[0]), Path(tmp))
|
||||||
|
if manifest["id"] != DEVICE_PRIORITY_ID or manifest["component"] != "device-core-network-priority":
|
||||||
|
die("Device Core network priority receipt identity mismatch")
|
||||||
|
validate_device_priority_payload(payload, entries, manifest["id"])
|
||||||
|
return (*files, DEVICE_PLANE_ROOT / DEVICE_PRIORITY_COMPOSE)
|
||||||
|
|
||||||
|
|
||||||
|
def device_priority_baseline():
|
||||||
|
device_priority_no_failed_rollback()
|
||||||
|
for row in load_state(FAILED_STATE_FILE):
|
||||||
|
if (row.get("component") == "device-core-release" and row.get("started_apply")
|
||||||
|
and not str(row.get("rollback_status", "")).startswith("ok:")
|
||||||
|
and not device_release_r5_reconciled(row)):
|
||||||
|
die("Device Core network priority requires application reconciliation")
|
||||||
|
rows = [r for r in load_state(STATE_FILE) if r.get("component") == "device-core-release"]
|
||||||
|
if not rows or rows[-1].get("id") != DEVICE_PRIORITY_BASELINE or rows[-1].get("sha256") != DEVICE_PRIORITY_BASELINE_SHA:
|
||||||
|
die("Device Core network priority requires the exact accepted r12 baseline")
|
||||||
|
with tempfile.TemporaryDirectory(prefix="device-priority-baseline-", dir=TMP_DIR) as tmp:
|
||||||
|
manifest, entries, payload = load_artifact(device_release_applied_archive(rows[-1]), Path(tmp))
|
||||||
|
if manifest["component"] != "device-core-release" or manifest["id"] != DEVICE_PRIORITY_BASELINE:
|
||||||
|
die("Device Core network priority baseline identity mismatch")
|
||||||
|
validate_device_release_payload(payload, entries, manifest["id"])
|
||||||
|
expected = collect_exact_files(payload, entries, "Device Core network priority baseline")
|
||||||
|
if collect_exact_files(DEVICE_PLANE_ROOT, DEVICE_RELEASE_ENTRIES, "Device Core network priority live source") != expected:
|
||||||
|
die("Device Core network priority installed source drift")
|
||||||
|
return expected
|
||||||
|
|
||||||
|
|
||||||
|
def device_priority_config(override=None):
|
||||||
|
command = compose_base_cmd("device-plane")
|
||||||
|
if override is not None:
|
||||||
|
command = [*command, "-f", str(override)]
|
||||||
|
result = subprocess.run([*command, "config", "--format", "json"], cwd=str(DEVICE_PLANE_ROOT),
|
||||||
|
capture_output=True, text=True, timeout=45, check=False)
|
||||||
|
if result.returncode or len(result.stdout) > 8 * 1024 * 1024:
|
||||||
|
die("Device Core network priority effective config failed")
|
||||||
|
try:
|
||||||
|
value = json.loads(result.stdout)
|
||||||
|
except (ValueError, TypeError):
|
||||||
|
die("Device Core network priority effective config is invalid")
|
||||||
|
if not isinstance(value, dict) or not isinstance(value.get("services"), dict):
|
||||||
|
die("Device Core network priority effective config is incomplete")
|
||||||
|
return value # Private in-memory comparison only; never log config/Env.
|
||||||
|
|
||||||
|
|
||||||
|
def device_priority_config_proof(base, candidate):
|
||||||
|
expected = json.loads(json.dumps(base))
|
||||||
|
actual = json.loads(json.dumps(candidate))
|
||||||
|
for service, networks in DEVICE_PRIORITY_NETWORKS.items():
|
||||||
|
for config in (expected, actual):
|
||||||
|
edges = config.get("services", {}).get(service, {}).get("networks")
|
||||||
|
if not isinstance(edges, dict) or set(edges) != set(networks):
|
||||||
|
die("Device Core network priority changes attached networks")
|
||||||
|
for name in networks:
|
||||||
|
edge = edges[name]
|
||||||
|
if not isinstance(edge, dict) or type(edge.get("priority", 0)) is not int:
|
||||||
|
die("Device Core network priority endpoint is invalid")
|
||||||
|
# Compose 2.20 omits the zero default in config JSON.
|
||||||
|
if edge.get("priority") == 0:
|
||||||
|
edge.pop("priority")
|
||||||
|
edges = expected["services"][service]["networks"]
|
||||||
|
if any(edge.get("priority", 0) != 0 for edge in edges.values()):
|
||||||
|
die("Device Core network priority predecessor already specifies priorities")
|
||||||
|
edges[networks[0]]["priority"] = 100
|
||||||
|
if expected != actual:
|
||||||
|
die("Device Core network priority changes more than the two primary priorities")
|
||||||
|
return {"baseConfigSha256": device_release_drift_digest(base),
|
||||||
|
"candidateConfigSha256": device_release_drift_digest(candidate)}
|
||||||
|
|
||||||
|
|
||||||
|
def preflight_device_priority(payload, entries, identity):
|
||||||
|
validate_device_priority_payload(payload, entries, identity)
|
||||||
|
if any((DEVICE_PLANE_ROOT / rel).exists() or (DEVICE_PLANE_ROOT / rel).is_symlink() for rel in entries):
|
||||||
|
die("Device Core network priority is an initial-only transition")
|
||||||
|
installed = device_priority_baseline()
|
||||||
|
run_healthchecks("device-core-release", DEVICE_RELEASE_ENTRIES, DEVICE_RELEASE_SERVICES)
|
||||||
|
validate_device_manager_control_plane_runtime(require_edge_channel=True, core_network_mode="private-egress", require_persistent_data=True, read_only=True)
|
||||||
|
runtime = device_release_runtime_snapshot_v2()
|
||||||
|
digests = device_release_capture_field_digests(runtime)
|
||||||
|
primary = device_release_drift_digest("nodedc-device-plane-private")
|
||||||
|
if any(digests[s].get("HostConfig.NetworkMode") != primary for s in DEVICE_RELEASE_SERVICES):
|
||||||
|
die("Device Core network priority must preserve the existing private primary network")
|
||||||
|
networks = {"device-control-core": ["nodedc-device-plane-egress", "nodedc-device-plane-private"],
|
||||||
|
"device-manager": ["nodedc-device-plane-private", "nodedc-platform_edge"]}
|
||||||
|
if any(digests[s].get("networks") != device_release_drift_digest(names) for s, names in networks.items()):
|
||||||
|
die("Device Core network priority runtime network set mismatch")
|
||||||
|
proof = device_priority_config_proof(device_priority_config(), device_priority_config(payload / DEVICE_PRIORITY_COMPOSE))
|
||||||
|
version = subprocess.run([str(DOCKER), "compose", "version", "--short"], capture_output=True,
|
||||||
|
text=True, timeout=15, check=True).stdout.strip()
|
||||||
|
if not re.fullmatch(r"v?[0-9]+\.[0-9]+\.[0-9]+(?:[-+][A-Za-z0-9.-]+)?", version):
|
||||||
|
die("Device Core network priority Compose version is invalid")
|
||||||
|
return {**proof, "composeVersion": version, "runtime": runtime, "installedFiles": installed,
|
||||||
|
"compose": {str(p): sha256_file(p) for p in component_compose_files("device-plane")},
|
||||||
|
"otherComposeServices": device_release_other_compose_services()}
|
||||||
|
|
||||||
|
|
||||||
|
def accept_device_priority(before, rollback=False):
|
||||||
|
if rollback:
|
||||||
|
if any((DEVICE_PLANE_ROOT / rel).exists() or (DEVICE_PLANE_ROOT / rel).is_symlink() for rel in DEVICE_PRIORITY_ENTRIES):
|
||||||
|
die("Device Core network priority rollback left activation files")
|
||||||
|
else:
|
||||||
|
validate_device_priority_payload(DEVICE_PLANE_ROOT, DEVICE_PRIORITY_ENTRIES, DEVICE_PRIORITY_ID)
|
||||||
|
proof = device_priority_config_proof(device_priority_config(), device_priority_config(DEVICE_PLANE_ROOT / DEVICE_PRIORITY_COMPOSE))
|
||||||
|
if any(proof[k] != before[k] for k in proof):
|
||||||
|
die("Device Core network priority effective config changed after plan")
|
||||||
|
if device_release_drift_digest(device_priority_config()) != before["baseConfigSha256"]:
|
||||||
|
die("Device Core network priority changed base effective config")
|
||||||
|
if (device_release_runtime_snapshot_v2() != before["runtime"]
|
||||||
|
or device_release_other_compose_services() != before["otherComposeServices"]
|
||||||
|
or {str(p): sha256_file(p) for p in component_compose_files("device-plane")} != before["compose"]
|
||||||
|
or device_priority_baseline() != before["installedFiles"]):
|
||||||
|
die("Device Core network priority changed preserved source/runtime")
|
||||||
|
run_healthchecks("device-core-release", DEVICE_RELEASE_ENTRIES, DEVICE_RELEASE_SERVICES)
|
||||||
|
print("device_network_priority_accept=" + ("rollback" if rollback else "metadata-only") + ";services=none;runtime=preserved")
|
||||||
|
|
||||||
|
|
||||||
DEVICE_RELEASE_ENTRY = "deployment/device-core-release-v1.json"
|
DEVICE_RELEASE_ENTRY = "deployment/device-core-release-v1.json"
|
||||||
DEVICE_RELEASE_ENTRIES = (
|
DEVICE_RELEASE_ENTRIES = (
|
||||||
".dockerignore", "package.json", "package-lock.json",
|
".dockerignore", "package.json", "package-lock.json",
|
||||||
@@ -32992,7 +33185,7 @@ def preflight_device_release(payload, entries, patch_id):
|
|||||||
run_healthchecks("device-core-release", entries, DEVICE_RELEASE_SERVICES)
|
run_healthchecks("device-core-release", entries, DEVICE_RELEASE_SERVICES)
|
||||||
before = device_release_runtime_snapshot_v2()
|
before = device_release_runtime_snapshot_v2()
|
||||||
field_digests = device_release_capture_field_digests(before)
|
field_digests = device_release_capture_field_digests(before)
|
||||||
compose = {str(p): sha256_file(p) for p in component_compose_files("device-plane")}
|
compose = {str(p): sha256_file(p) for p in component_compose_files("device-core-release")}
|
||||||
return {"runtimeFingerprintVersion": 2, "descriptor": d, "predecessor": predecessor["releaseId"] if predecessor else "manager-v13/core-v4/edge-v4",
|
return {"runtimeFingerprintVersion": 2, "descriptor": d, "predecessor": predecessor["releaseId"] if predecessor else "manager-v13/core-v4/edge-v4",
|
||||||
"runtime": before, "runtimeFieldDigests": field_digests,
|
"runtime": before, "runtimeFieldDigests": field_digests,
|
||||||
"compose": compose, "otherComposeServices": device_release_other_compose_services(),
|
"compose": compose, "otherComposeServices": device_release_other_compose_services(),
|
||||||
@@ -33025,7 +33218,7 @@ def accept_device_release(before, *, rollback=False):
|
|||||||
die("Device Core release selected image mismatch: " + service)
|
die("Device Core release selected image mismatch: " + service)
|
||||||
if device_release_other_compose_services() != before["otherComposeServices"]:
|
if device_release_other_compose_services() != before["otherComposeServices"]:
|
||||||
die("Device Core release changed an unrelated Compose service")
|
die("Device Core release changed an unrelated Compose service")
|
||||||
if {str(p): sha256_file(p) for p in component_compose_files("device-plane")} != before["compose"]:
|
if {str(p): sha256_file(p) for p in component_compose_files("device-core-release")} != before["compose"]:
|
||||||
die("Device Core release changed Compose topology")
|
die("Device Core release changed Compose topology")
|
||||||
validate_device_manager_control_plane_runtime(require_edge_channel=True, core_network_mode="private-egress", require_persistent_data=True, read_only=True)
|
validate_device_manager_control_plane_runtime(require_edge_channel=True, core_network_mode="private-egress", require_persistent_data=True, read_only=True)
|
||||||
if rollback:
|
if rollback:
|
||||||
@@ -33104,6 +33297,12 @@ def plan_artifact(artifact):
|
|||||||
gitea_salvage_preflight = None
|
gitea_salvage_preflight = None
|
||||||
with tempfile.TemporaryDirectory(prefix="plan-", dir=TMP_DIR) as tmp:
|
with tempfile.TemporaryDirectory(prefix="plan-", dir=TMP_DIR) as tmp:
|
||||||
manifest, entries, payload_dir = load_artifact(artifact, Path(tmp))
|
manifest, entries, payload_dir = load_artifact(artifact, Path(tmp))
|
||||||
|
if manifest["component"] == "device-core-network-priority":
|
||||||
|
priority_before = preflight_device_priority(payload_dir, entries, manifest["id"])
|
||||||
|
print("device_network_priority_compose=" + priority_before["composeVersion"])
|
||||||
|
print("device_network_priority_delta=core-private:100,manager-private:100;secondary:0")
|
||||||
|
print("device_network_priority_source=accepted-r12;services=none;build=none;runtime-mutation=none")
|
||||||
|
print("device_network_priority_preserved=all-runtime,databases,volumes,ports,secrets;rollback=two-new-files-only")
|
||||||
if manifest["component"] == "device-core-autodeploy":
|
if manifest["component"] == "device-core-autodeploy":
|
||||||
auto_before = preflight_device_autodeploy(payload_dir, entries, manifest["id"])
|
auto_before = preflight_device_autodeploy(payload_dir, entries, manifest["id"])
|
||||||
print("device_autodeploy_scheduler=native-systemd;binary=" + auto_before["systemctl"])
|
print("device_autodeploy_scheduler=native-systemd;binary=" + auto_before["systemctl"])
|
||||||
@@ -39289,6 +39488,10 @@ process.stdout.write('engine-l2-closed-loop:0.7.0:cas+safe-profile+external-plan
|
|||||||
|
|
||||||
|
|
||||||
def run_healthchecks(component, entries=None, services=None):
|
def run_healthchecks(component, entries=None, services=None):
|
||||||
|
if component == "device-core-network-priority":
|
||||||
|
if tuple(entries or ()) != DEVICE_PRIORITY_ENTRIES or tuple(services or ()) != ():
|
||||||
|
die("Device Core network priority health scope mismatch")
|
||||||
|
return # Exact before/after acceptance belongs to accept_device_priority.
|
||||||
if component == "device-core-release-reconciliation":
|
if component == "device-core-release-reconciliation":
|
||||||
if tuple(services or ()) != ():
|
if tuple(services or ()) != ():
|
||||||
die("Device Core reconciliation must not select services")
|
die("Device Core reconciliation must not select services")
|
||||||
@@ -40418,6 +40621,7 @@ def apply_artifact(artifact):
|
|||||||
device_release_before = None
|
device_release_before = None
|
||||||
gitea_actions_before = None
|
gitea_actions_before = None
|
||||||
device_autodeploy_before = None
|
device_autodeploy_before = None
|
||||||
|
device_priority_before = None
|
||||||
current_stamp = stamp()
|
current_stamp = stamp()
|
||||||
|
|
||||||
with DeployLock():
|
with DeployLock():
|
||||||
@@ -40462,6 +40666,8 @@ def apply_artifact(artifact):
|
|||||||
compose_root = component_compose_root(component)
|
compose_root = component_compose_root(component)
|
||||||
bootstrap_root = bool(COMPONENTS[component].get("bootstrap_root"))
|
bootstrap_root = bool(COMPONENTS[component].get("bootstrap_root"))
|
||||||
services = component_services(component, entries)
|
services = component_services(component, entries)
|
||||||
|
if component == "device-core-network-priority":
|
||||||
|
device_priority_before = preflight_device_priority(payload_dir, entries, patch_id)
|
||||||
if component == "mission-core-map-access":
|
if component == "mission-core-map-access":
|
||||||
preflight_map_access(payload_dir, entries)
|
preflight_map_access(payload_dir, entries)
|
||||||
if component == "gitea-ci":
|
if component == "gitea-ci":
|
||||||
@@ -40999,6 +41205,10 @@ def apply_artifact(artifact):
|
|||||||
|
|
||||||
include_nginx_html = component == "engine" and component_publish_dist(component, entries)
|
include_nginx_html = component == "engine" and component_publish_dist(component, entries)
|
||||||
create_backup(root, backup_dir, entries, include_nginx_html)
|
create_backup(root, backup_dir, entries, include_nginx_html)
|
||||||
|
if component == "device-core-network-priority":
|
||||||
|
proof = backup_dir / "device-network-priority-before.json"
|
||||||
|
proof.write_text(json.dumps(device_priority_before, sort_keys=True) + "\n", encoding="utf-8")
|
||||||
|
proof.chmod(0o600)
|
||||||
if component == "device-core-autodeploy":
|
if component == "device-core-autodeploy":
|
||||||
proof = backup_dir / "autodeploy-before.json"
|
proof = backup_dir / "autodeploy-before.json"
|
||||||
proof.write_text(json.dumps(device_autodeploy_before, sort_keys=True) + "\n", encoding="utf-8")
|
proof.write_text(json.dumps(device_autodeploy_before, sort_keys=True) + "\n", encoding="utf-8")
|
||||||
@@ -41101,6 +41311,8 @@ def apply_artifact(artifact):
|
|||||||
elif component == "device-core-autodeploy":
|
elif component == "device-core-autodeploy":
|
||||||
runtime_started = True
|
runtime_started = True
|
||||||
apply_device_autodeploy(device_autodeploy_before)
|
apply_device_autodeploy(device_autodeploy_before)
|
||||||
|
elif component == "device-core-network-priority":
|
||||||
|
pass # Metadata only: never build, pull, restart or recreate.
|
||||||
elif component == "gitea-actions-config":
|
elif component == "gitea-actions-config":
|
||||||
runtime_started = True
|
runtime_started = True
|
||||||
apply_gitea_actions(gitea_actions_before, backup_dir)
|
apply_gitea_actions(gitea_actions_before, backup_dir)
|
||||||
@@ -41140,6 +41352,8 @@ def apply_artifact(artifact):
|
|||||||
):
|
):
|
||||||
die("Engine L2 closed-loop app generation was not recreated")
|
die("Engine L2 closed-loop app generation was not recreated")
|
||||||
run_healthchecks(component, entries, services)
|
run_healthchecks(component, entries, services)
|
||||||
|
if component == "device-core-network-priority":
|
||||||
|
accept_device_priority(device_priority_before)
|
||||||
if component == "device-core-autodeploy":
|
if component == "device-core-autodeploy":
|
||||||
accept_device_autodeploy(device_autodeploy_before)
|
accept_device_autodeploy(device_autodeploy_before)
|
||||||
if component == "device-core-release":
|
if component == "device-core-release":
|
||||||
@@ -41218,7 +41432,14 @@ def apply_artifact(artifact):
|
|||||||
and backup_dir is not None
|
and backup_dir is not None
|
||||||
and root is not None
|
and root is not None
|
||||||
):
|
):
|
||||||
if component == "device-core-autodeploy":
|
if component == "device-core-network-priority":
|
||||||
|
try:
|
||||||
|
restore_platform_overlay(root, backup_dir, entries, current_stamp)
|
||||||
|
accept_device_priority(device_priority_before, rollback=True)
|
||||||
|
rollback_status = "ok:device-core-network-priority-metadata-only"
|
||||||
|
except Exception as rollback_exc:
|
||||||
|
rollback_status = "failed:" + type(rollback_exc).__name__
|
||||||
|
elif component == "device-core-autodeploy":
|
||||||
try:
|
try:
|
||||||
rollback_device_autodeploy(root, backup_dir, entries, current_stamp, device_autodeploy_before)
|
rollback_device_autodeploy(root, backup_dir, entries, current_stamp, device_autodeploy_before)
|
||||||
rollback_status = "ok:device-core-autodeploy-bootstrap"
|
rollback_status = "ok:device-core-autodeploy-bootstrap"
|
||||||
|
|||||||
@@ -0,0 +1,320 @@
|
|||||||
|
"""Exact metadata transition, effective-config proof and unchanged runtime guards."""
|
||||||
|
import copy
|
||||||
|
from contextlib import ExitStack, redirect_stderr, redirect_stdout
|
||||||
|
import importlib.util
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import tempfile
|
||||||
|
import unittest
|
||||||
|
from unittest import mock
|
||||||
|
|
||||||
|
from test_device_core_release import R, runtime, fixture, archive
|
||||||
|
|
||||||
|
SOURCE = Path(__file__).resolve().parents[1] / 'device-core-deploy'
|
||||||
|
spec = importlib.util.spec_from_file_location('priority_builder', SOURCE / 'build_network_priority.py')
|
||||||
|
BUILDER = importlib.util.module_from_spec(spec)
|
||||||
|
spec.loader.exec_module(BUILDER)
|
||||||
|
|
||||||
|
|
||||||
|
def effective():
|
||||||
|
return {'name': 'nodedc-device-plane', 'services': {
|
||||||
|
'device-control-core': {'image': 'nodedc/device-control-core:local', 'networks': {
|
||||||
|
'device-plane-private': {}, 'device-plane-egress': {}}},
|
||||||
|
'device-manager': {'image': 'nodedc/device-manager:local', 'environment': {'TOKEN': 'synthetic-secret'},
|
||||||
|
'networks': {'device-plane-private': {}, 'platform-edge': {}}},
|
||||||
|
'device-postgres': {'image': 'postgres:17', 'networks': {'device-plane-private': {}}}},
|
||||||
|
'networks': {'device-plane-private': {'internal': True}, 'device-plane-egress': {},
|
||||||
|
'platform-edge': {'external': True}}}
|
||||||
|
|
||||||
|
|
||||||
|
def prioritized():
|
||||||
|
value = effective()
|
||||||
|
for service in ('device-control-core', 'device-manager'):
|
||||||
|
value['services'][service]['networks']['device-plane-private']['priority'] = 100
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
|
class PriorityTests(unittest.TestCase):
|
||||||
|
def setUp(self):
|
||||||
|
self.tmp = tempfile.TemporaryDirectory()
|
||||||
|
self.addCleanup(self.tmp.cleanup)
|
||||||
|
self.root = Path(self.tmp.name)
|
||||||
|
self.live = self.root / 'live'
|
||||||
|
self.live.mkdir()
|
||||||
|
identity, data = BUILDER.bundle()
|
||||||
|
self.artifact = self.root / ('nodedc-' + identity + '.tgz')
|
||||||
|
self.artifact.write_bytes(data)
|
||||||
|
work = self.root / 'unpack'
|
||||||
|
work.mkdir()
|
||||||
|
self.manifest, self.entries, self.payload = R.load_artifact(self.artifact, work)
|
||||||
|
|
||||||
|
def install_files(self):
|
||||||
|
for entry in self.entries:
|
||||||
|
path = self.live / entry
|
||||||
|
path.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
path.write_bytes((self.payload / entry).read_bytes())
|
||||||
|
|
||||||
|
def test_deterministic_data_bundle_has_no_runtime_action(self):
|
||||||
|
self.assertEqual(BUILDER.bundle()[1], self.artifact.read_bytes())
|
||||||
|
self.assertEqual(self.manifest['component'], 'device-core-network-priority')
|
||||||
|
self.assertEqual(tuple(self.entries), R.DEVICE_PRIORITY_ENTRIES)
|
||||||
|
self.assertEqual((self.payload / self.entries[0]).read_bytes(), R.DEVICE_PRIORITY_YAML.encode())
|
||||||
|
self.assertEqual(R.component_services(self.manifest['component'], self.entries), ())
|
||||||
|
self.assertEqual(R.component_builds(self.manifest['component'], self.entries), ())
|
||||||
|
self.assertTrue(R.component_artifact_only(self.manifest['component']))
|
||||||
|
|
||||||
|
def test_path_and_service_scope_cannot_grow(self):
|
||||||
|
for entry in ('docker-compose.device-plane.yml', 'services/device-manager/a.py',
|
||||||
|
'deployment/other.json', 'secrets/token', 'data/db', '../escape'):
|
||||||
|
with self.subTest(entry=entry), self.assertRaises(R.DeployError):
|
||||||
|
R.allowed_payload_path('device-core-network-priority', entry)
|
||||||
|
for entries in ([], self.entries[:1], [*self.entries, 'services/device-postgres']):
|
||||||
|
with self.subTest(entries=entries), self.assertRaises(R.DeployError):
|
||||||
|
R.component_services('device-core-network-priority', entries)
|
||||||
|
|
||||||
|
def test_payload_rejects_identity_descriptor_and_yaml_changes(self):
|
||||||
|
with self.assertRaises(R.DeployError):
|
||||||
|
R.validate_device_priority_payload(self.payload, self.entries, 'arbitrary-id')
|
||||||
|
descriptor = self.payload / R.DEVICE_PRIORITY_ENTRY
|
||||||
|
original = descriptor.read_bytes()
|
||||||
|
changed = json.loads(original)
|
||||||
|
changed['primaryPriority'] = 200
|
||||||
|
descriptor.write_text(json.dumps(changed))
|
||||||
|
with self.assertRaises(R.DeployError):
|
||||||
|
R.validate_device_priority_payload(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
descriptor.write_bytes(original)
|
||||||
|
path = self.payload / R.DEVICE_PRIORITY_COMPOSE
|
||||||
|
path.write_text(path.read_text().replace('priority: 100', 'priority: 0'))
|
||||||
|
with self.assertRaises(R.DeployError):
|
||||||
|
R.validate_device_priority_payload(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
|
||||||
|
def test_effective_config_proves_only_two_priority_changes_without_leaking_values(self):
|
||||||
|
base = effective()
|
||||||
|
candidate = prioritized()
|
||||||
|
saved = copy.deepcopy((base, candidate))
|
||||||
|
proof = R.device_priority_config_proof(base, candidate)
|
||||||
|
self.assertEqual((base, candidate), saved)
|
||||||
|
self.assertNotIn('synthetic-secret', json.dumps(proof))
|
||||||
|
self.assertEqual(len(proof['baseConfigSha256']), 64)
|
||||||
|
candidate['services']['device-manager']['networks']['platform-edge']['priority'] = 0
|
||||||
|
R.device_priority_config_proof(base, candidate)
|
||||||
|
|
||||||
|
def test_network_and_nonnetwork_changes_remain_rejected(self):
|
||||||
|
mutations = (
|
||||||
|
lambda c: c['services']['device-manager'].update(ports=['8080:80']),
|
||||||
|
lambda c: c['services']['device-manager']['environment'].update(TOKEN='different'),
|
||||||
|
lambda c: c['networks']['device-plane-private'].update(internal=False),
|
||||||
|
lambda c: c['services']['device-postgres'].update(image='other'),
|
||||||
|
lambda c: c['services']['device-manager']['networks'].update(other={}),
|
||||||
|
lambda c: c['services']['device-manager']['networks']['platform-edge'].update(priority=100),
|
||||||
|
lambda c: c['services']['device-manager']['networks']['device-plane-private'].update(priority=True),
|
||||||
|
lambda c: c['services']['device-manager']['networks']['device-plane-private'].update(aliases=['foreign']),
|
||||||
|
)
|
||||||
|
for mutate in mutations:
|
||||||
|
c = prioritized()
|
||||||
|
mutate(c)
|
||||||
|
with self.subTest(candidate=c), self.assertRaises(R.DeployError):
|
||||||
|
R.device_priority_config_proof(effective(), c)
|
||||||
|
with self.assertRaises(R.DeployError):
|
||||||
|
R.device_priority_config_proof(prioritized(), prioritized())
|
||||||
|
|
||||||
|
def test_config_reader_never_returns_command_stderr(self):
|
||||||
|
result = mock.Mock(returncode=1, stdout='', stderr='SECRET=do-not-log')
|
||||||
|
with mock.patch.object(R, 'compose_base_cmd', return_value=['docker', 'compose']), \
|
||||||
|
mock.patch.object(R.subprocess, 'run', return_value=result), \
|
||||||
|
self.assertRaises(R.DeployError) as caught:
|
||||||
|
R.device_priority_config(self.payload / R.DEVICE_PRIORITY_COMPOSE)
|
||||||
|
self.assertNotIn('SECRET', str(caught.exception))
|
||||||
|
|
||||||
|
def test_activation_needs_both_files_and_unique_matching_archive_receipt(self):
|
||||||
|
with mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live), mock.patch.object(R, 'TMP_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'APPLIED_DIR', self.root), mock.patch.object(R, 'load_state', return_value=[]):
|
||||||
|
self.assertEqual(R.device_priority_compose_files(('base.yml',)), ('base.yml',))
|
||||||
|
self.install_files()
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'unique canonical receipt'):
|
||||||
|
R.device_priority_compose_files(('base.yml',))
|
||||||
|
row = {'id': R.DEVICE_PRIORITY_ID, 'component': 'device-core-network-priority', 'status': 'ok',
|
||||||
|
'sha256': R.sha256_file(self.artifact), 'artifact': self.artifact.name}
|
||||||
|
with mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live), mock.patch.object(R, 'TMP_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'APPLIED_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'load_state', side_effect=lambda p: [row] if p == R.STATE_FILE else []):
|
||||||
|
self.assertEqual(R.device_priority_compose_files(('base.yml',)),
|
||||||
|
('base.yml', self.live / R.DEVICE_PRIORITY_COMPOSE))
|
||||||
|
(self.live / R.DEVICE_PRIORITY_ENTRY).unlink()
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'incomplete'):
|
||||||
|
R.device_priority_compose_files(('base.yml',))
|
||||||
|
|
||||||
|
def test_uncertain_priority_rollback_blocks_later_release_even_without_marker(self):
|
||||||
|
row = {'component': 'device-core-network-priority', 'started_apply': True, 'rollback_status': 'failed:DeployError'}
|
||||||
|
with mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live), \
|
||||||
|
mock.patch.object(R, 'load_state', return_value=[row]), \
|
||||||
|
self.assertRaisesRegex(R.DeployError, 'reconciliation'):
|
||||||
|
R.device_priority_compose_files(('base.yml',))
|
||||||
|
|
||||||
|
def test_activation_rejects_duplicate_or_failed_receipt_and_altered_archive(self):
|
||||||
|
self.install_files()
|
||||||
|
row = {'id': R.DEVICE_PRIORITY_ID, 'component': 'device-core-network-priority', 'status': 'ok',
|
||||||
|
'sha256': R.sha256_file(self.artifact), 'artifact': self.artifact.name}
|
||||||
|
for rows in ([row, row], [{**row, 'status': 'failed'}], [{**row, 'sha256': '0' * 64}]):
|
||||||
|
with self.subTest(rows=rows), mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live), \
|
||||||
|
mock.patch.object(R, 'TMP_DIR', self.root), mock.patch.object(R, 'APPLIED_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'load_state', side_effect=lambda p: rows if p == R.STATE_FILE else []), \
|
||||||
|
self.assertRaises(R.DeployError):
|
||||||
|
R.device_priority_compose_files(('base.yml',))
|
||||||
|
|
||||||
|
def test_normal_release_executor_uses_accepted_override_without_expanding_scope(self):
|
||||||
|
self.install_files()
|
||||||
|
row = {'id': R.DEVICE_PRIORITY_ID, 'component': 'device-core-network-priority', 'status': 'ok',
|
||||||
|
'sha256': R.sha256_file(self.artifact), 'artifact': self.artifact.name}
|
||||||
|
original = R.component_compose_files
|
||||||
|
def files(component, **kwargs):
|
||||||
|
if component == 'device-plane':
|
||||||
|
return (self.live / 'base.yml',)
|
||||||
|
return original(component, **kwargs)
|
||||||
|
with mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live), mock.patch.object(R, 'TMP_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'APPLIED_DIR', self.root), mock.patch.object(R, 'component_compose_files', side_effect=files), \
|
||||||
|
mock.patch.object(R, 'load_state', side_effect=lambda p: [row] if p == R.STATE_FILE else []), \
|
||||||
|
mock.patch.object(R.subprocess, 'run') as command:
|
||||||
|
R.run_device_release_compose(R.DEVICE_RELEASE_SERVICES, R.DEVICE_RELEASE_ENTRIES)
|
||||||
|
calls = command.call_args_list
|
||||||
|
self.assertEqual(len(calls), 2)
|
||||||
|
up = calls[0].args[0]
|
||||||
|
index = up.index('up')
|
||||||
|
self.assertEqual(up[index:], ['up', '-d', '--force-recreate', '--pull', 'never', '--no-build', '--no-deps',
|
||||||
|
*R.DEVICE_RELEASE_SERVICES])
|
||||||
|
self.assertEqual(up[index - 2:index], ['-f', str(self.live / R.DEVICE_PRIORITY_COMPOSE)])
|
||||||
|
self.assertEqual(calls[1].args[0], [*up[:index], 'ps'])
|
||||||
|
|
||||||
|
def test_baseline_proves_archive_receipt_and_live_tree(self):
|
||||||
|
d = fixture(self.live, number=12, sha='b2660df9e26afe977bfa62efd35a8397eac4898b')
|
||||||
|
a = self.root / 'baseline.tgz'
|
||||||
|
archive(self.live, a, d)
|
||||||
|
sha = R.sha256_file(a)
|
||||||
|
row = {'id': R.DEVICE_PRIORITY_BASELINE, 'component': 'device-core-release',
|
||||||
|
'status': 'ok', 'sha256': sha, 'artifact': a.name}
|
||||||
|
with mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live), mock.patch.object(R, 'TMP_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'DEVICE_PRIORITY_BASELINE_SHA', sha), mock.patch.object(R, 'APPLIED_DIR', self.root), \
|
||||||
|
mock.patch.object(R, 'load_state', side_effect=lambda p: [row] if p == R.STATE_FILE else []):
|
||||||
|
expected = R.device_priority_baseline()
|
||||||
|
self.assertIn(R.DEVICE_RELEASE_ENTRY, expected)
|
||||||
|
(self.live / 'services/device-manager/server/app.mjs').write_text('changed')
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'source drift'):
|
||||||
|
R.device_priority_baseline()
|
||||||
|
|
||||||
|
def prepare_preflight(self, stack):
|
||||||
|
stack.enter_context(mock.patch.object(R, 'DEVICE_PLANE_ROOT', self.live))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'device_priority_baseline', return_value={'app': 'hash'}))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'run_healthchecks'))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'validate_device_manager_control_plane_runtime'))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'device_release_runtime_snapshot_v2', return_value=runtime()))
|
||||||
|
digests = {s: {'HostConfig.NetworkMode': R.device_release_drift_digest('nodedc-device-plane-private')}
|
||||||
|
for s in R.DEVICE_RELEASE_SERVICES}
|
||||||
|
digests['device-control-core']['networks'] = R.device_release_drift_digest(['nodedc-device-plane-egress', 'nodedc-device-plane-private'])
|
||||||
|
digests['device-manager']['networks'] = R.device_release_drift_digest(['nodedc-device-plane-private', 'nodedc-platform_edge'])
|
||||||
|
fields = stack.enter_context(mock.patch.object(R, 'device_release_capture_field_digests', return_value=digests))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'device_priority_config', side_effect=lambda override=None: prioritized() if override else effective()))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'component_compose_files', return_value=()))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'device_release_other_compose_services', return_value={}))
|
||||||
|
stack.enter_context(mock.patch.object(R.subprocess, 'run', return_value=mock.Mock(stdout='2.20.3\n')))
|
||||||
|
return fields
|
||||||
|
|
||||||
|
def test_preflight_refuses_primary_switch_and_already_installed_transition(self):
|
||||||
|
with ExitStack() as stack:
|
||||||
|
fields = self.prepare_preflight(stack)
|
||||||
|
before = R.preflight_device_priority(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
self.assertEqual(before['composeVersion'], '2.20.3')
|
||||||
|
fields.return_value['device-manager']['HostConfig.NetworkMode'] = R.device_release_drift_digest('nodedc-platform_edge')
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'existing private primary'):
|
||||||
|
R.preflight_device_priority(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
self.install_files()
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'initial-only'):
|
||||||
|
R.preflight_device_priority(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
|
||||||
|
def test_acceptance_requires_unchanged_runtime_and_exact_candidate(self):
|
||||||
|
with ExitStack() as stack:
|
||||||
|
self.prepare_preflight(stack)
|
||||||
|
before = R.preflight_device_priority(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
self.install_files()
|
||||||
|
with redirect_stdout(io.StringIO()):
|
||||||
|
R.accept_device_priority(before)
|
||||||
|
changed = runtime()
|
||||||
|
changed['device-manager']['containerId'] = 'changed'
|
||||||
|
with mock.patch.object(R, 'device_release_runtime_snapshot_v2', return_value=changed), \
|
||||||
|
self.assertRaisesRegex(R.DeployError, 'preserved source/runtime'):
|
||||||
|
R.accept_device_priority(before)
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'left activation files'):
|
||||||
|
R.accept_device_priority(before, rollback=True)
|
||||||
|
for entry in self.entries:
|
||||||
|
(self.live / entry).unlink()
|
||||||
|
with redirect_stdout(io.StringIO()):
|
||||||
|
R.accept_device_priority(before, rollback=True)
|
||||||
|
|
||||||
|
def test_preflight_refuses_an_extra_attached_network(self):
|
||||||
|
with ExitStack() as stack:
|
||||||
|
fields = self.prepare_preflight(stack)
|
||||||
|
fields.return_value['device-manager']['networks'] = R.device_release_drift_digest(
|
||||||
|
['nodedc-device-plane-private', 'nodedc-platform_edge', 'foreign'])
|
||||||
|
with self.assertRaisesRegex(R.DeployError, 'network set mismatch'):
|
||||||
|
R.preflight_device_priority(self.payload, self.entries, R.DEVICE_PRIORITY_ID)
|
||||||
|
|
||||||
|
def execute(self, fail=False, rollback_fail=False):
|
||||||
|
config = {**R.COMPONENTS['device-core-network-priority'], 'payload_root': self.live}
|
||||||
|
for name in ('inbox', 'applied', 'failed', 'backups', 'state', 'tmp'):
|
||||||
|
(self.root / name).mkdir()
|
||||||
|
events = []
|
||||||
|
before = {'runtime': runtime(), 'baseConfigSha256': 'a' * 64}
|
||||||
|
with ExitStack() as stack:
|
||||||
|
for name, value in [('INBOX', self.root / 'inbox'), ('APPLIED_DIR', self.root / 'applied'),
|
||||||
|
('FAILED_DIR', self.root / 'failed'), ('BACKUPS_DIR', self.root / 'backups'),
|
||||||
|
('STATE_DIR', self.root / 'state'), ('TMP_DIR', self.root / 'tmp'),
|
||||||
|
('STATE_FILE', self.root / 'state/applied.jsonl'), ('FAILED_STATE_FILE', self.root / 'state/failed.jsonl'),
|
||||||
|
('LOCK_DIR', self.root / 'lock'), ('DEVICE_PLANE_ROOT', self.live)]:
|
||||||
|
stack.enter_context(mock.patch.object(R, name, value))
|
||||||
|
stack.enter_context(mock.patch.dict(R.COMPONENTS, {'device-core-network-priority': config}))
|
||||||
|
for name in ('require_root', 'ensure_layout', 'validate_artifact_location'):
|
||||||
|
stack.enter_context(mock.patch.object(R, name))
|
||||||
|
stack.enter_context(mock.patch.object(R, 'preflight_device_priority', return_value=before))
|
||||||
|
commands = stack.enter_context(mock.patch.object(R.subprocess, 'run', side_effect=AssertionError('no external runtime commands')))
|
||||||
|
build = stack.enter_context(mock.patch.object(R, 'run_build', side_effect=AssertionError('no build')))
|
||||||
|
def accept(value, rollback=False):
|
||||||
|
events.append('rollback' if rollback else 'accept')
|
||||||
|
self.assertEqual(value, before)
|
||||||
|
for entry in self.entries:
|
||||||
|
self.assertEqual((self.live / entry).exists(), not rollback)
|
||||||
|
if (fail and not rollback) or (rollback_fail and rollback):
|
||||||
|
raise R.DeployError('injected acceptance failure')
|
||||||
|
stack.enter_context(mock.patch.object(R, 'accept_device_priority', side_effect=accept))
|
||||||
|
stack.enter_context(redirect_stdout(io.StringIO()))
|
||||||
|
stack.enter_context(redirect_stderr(io.StringIO()))
|
||||||
|
if fail:
|
||||||
|
with self.assertRaises(R.DeployError):
|
||||||
|
R.apply_artifact(self.artifact)
|
||||||
|
else:
|
||||||
|
R.apply_artifact(self.artifact)
|
||||||
|
commands.assert_not_called()
|
||||||
|
build.assert_not_called()
|
||||||
|
applied, failed = R.load_state(R.STATE_FILE), R.load_state(R.FAILED_STATE_FILE)
|
||||||
|
return events, applied, failed
|
||||||
|
|
||||||
|
def test_real_apply_dispatch_is_metadata_only_and_journals_after_acceptance(self):
|
||||||
|
events, applied, failed = self.execute()
|
||||||
|
self.assertEqual(events, ['accept'])
|
||||||
|
self.assertEqual(len(applied), 1)
|
||||||
|
self.assertFalse(failed)
|
||||||
|
self.assertFalse(self.artifact.exists())
|
||||||
|
|
||||||
|
def test_real_apply_dispatch_rolls_back_only_new_files(self):
|
||||||
|
events, applied, failed = self.execute(fail=True)
|
||||||
|
self.assertEqual(events, ['accept', 'rollback'])
|
||||||
|
self.assertFalse(applied)
|
||||||
|
self.assertEqual(failed[0]['rollback_status'], 'ok:device-core-network-priority-metadata-only')
|
||||||
|
|
||||||
|
def test_real_apply_dispatch_retains_failed_rollback(self):
|
||||||
|
_, applied, failed = self.execute(fail=True, rollback_fail=True)
|
||||||
|
self.assertFalse(applied)
|
||||||
|
self.assertEqual(failed[0]['rollback_status'], 'failed:DeployError')
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main()
|
||||||
@@ -1,15 +1,20 @@
|
|||||||
# Device Core automatic deployment acceptance
|
# Device Core automatic deployment acceptance
|
||||||
|
|
||||||
Date: 2026-09-29. First automatic release accepted; the second was rejected by runtime
|
Evidence dates: 2026-09-29/30. Automatic releases r11 and r12 were accepted in
|
||||||
acceptance and successfully rolled back. Ordered-release acceptance remains open. This report concerns Device Core only. B2 multi-client contours are
|
sequence without manual NAS commands. Earlier r9 was rejected by runtime
|
||||||
|
acceptance and successfully rolled back; its exact cause remains unresolved.
|
||||||
|
This report concerns Device Core only. B2 multi-client contours are
|
||||||
a separate implementation in `NODEDC_MISSION_CORE_ARNAVI-VPS`.
|
a separate implementation in `NODEDC_MISSION_CORE_ARNAVI-VPS`.
|
||||||
|
|
||||||
## Installed authority
|
## Installed authority
|
||||||
|
|
||||||
Platform source: `f7416bc59a19a9ac53c4f4591eaf50a7f4a41641`.
|
Current installed Platform source: `d1c5401f52f32cdc4bc4c6db5df8f8d5d6fc7045`.
|
||||||
Root runner SHA-256:
|
Root runner SHA-256:
|
||||||
`c1301d1072f3d5d39ba422a09847a05a5aad8a753c816d7fb6916d1f1cadd9c6`.
|
`3eefc75591bb08339d79c6a484912d7d6a8881fe8729e966b6f0bf32da21da80`.
|
||||||
The operator's promotion returned `verify-install-ok`, Python3.8.15.
|
The operator's promotion on 2026-09-30 returned `verify-install-ok`, Python3.8.15.
|
||||||
|
Bootstrap and runs8/9 used preceding runner012, SHA
|
||||||
|
`c1301d1072f3d5d39ba422a09847a05a5aad8a753c816d7fb6916d1f1cadd9c6`,
|
||||||
|
from Platform `f7416bc59a19a9ac53c4f4591eaf50a7f4a41641`.
|
||||||
|
|
||||||
Controller artifact:
|
Controller artifact:
|
||||||
`nodedc-device-core-autodeploy-v1-20260929-001.tgz`, SHA-256
|
`nodedc-device-core-autodeploy-v1-20260929-001.tgz`, SHA-256
|
||||||
@@ -102,4 +107,87 @@ Validation:75 Device Core release/bootstrap/recovery tests;75 registry tests
|
|||||||
(1 historical skip);170 Device Core artifact tests (17 historical skips);
|
(1 historical skip);170 Device Core artifact tests (17 historical skips);
|
||||||
Python3.8 syntax and diff checks. Runner candidate SHA-256:
|
Python3.8 syntax and diff checks. Runner candidate SHA-256:
|
||||||
`3eefc75591bb08339d79c6a484912d7d6a8881fe8729e966b6f0bf32da21da80`.
|
`3eefc75591bb08339d79c6a484912d7d6a8881fe8729e966b6f0bf32da21da80`.
|
||||||
It is prepared, not installed. No new release has been submitted after run9.
|
Its installation is now confirmed by the operator's exact verify-install receipt.
|
||||||
|
|
||||||
|
## Remaining acceptance and handoff
|
||||||
|
|
||||||
|
- [x] Controller bootstrap accepted by the canonical installer.
|
||||||
|
- [x] Run8 passed CI and automatically reached an accepted production release.
|
||||||
|
- [x] An observed Gitea interruption recovered without operator intervention.
|
||||||
|
- [x] Run9 failed runtime acceptance and automatically restored accepted run8.
|
||||||
|
- [x] Candidate013 retains redacted field-level evidence and passed its source tests.
|
||||||
|
- [x] Install candidate013 through the separate root runner promotion gate.
|
||||||
|
- [ ] Obtain exact evidence for the Manager mismatch and qualify its correction.
|
||||||
|
- [x] Accept two ordered automatic application releases with the installed diagnostics (r11, r12).
|
||||||
|
|
||||||
|
Candidate013 source is Platform
|
||||||
|
`d1c5401f52f32cdc4bc4c6db5df8f8d5d6fc7045`, with staged candidate name
|
||||||
|
`nodedc-deploy.device-core-runtime-evidence-20260929-013`. Its byte count is
|
||||||
|
1785138 and its digest is recorded above. It preserves the installed runner's
|
||||||
|
acceptance and rollback rules; it is instrumentation, not a proven incident fix.
|
||||||
|
The next Device Core release was submitted only after this promotion was
|
||||||
|
confirmed. Neither the successful bootstrap/run8 nor terminal failed run9 is replayed.
|
||||||
|
|
||||||
|
At the 2026-09-30 documentation pass, the Mac's `/Volumes/docker` share was
|
||||||
|
disconnected. Historical receipts and artifact hashes remain available locally;
|
||||||
|
this report does not claim a new live NAS inspection at that time. Reconnect the
|
||||||
|
share, check for newer terminal receipts and verify the staged candidate before
|
||||||
|
giving the operator the prepared Synology promotion command. The share was then
|
||||||
|
reconnected: fresh lifecycle inspection confirmed the same387applied/79failed
|
||||||
|
receipts, run8/run9 archive hashes and backups, no warnings, and the staged
|
||||||
|
candidate digest. The operator subsequently completed promotion013.
|
||||||
|
|
||||||
|
Worker006 is not part of Device Core CI/CD. Its Windows installation and any
|
||||||
|
unverified Linux guest are irrelevant to this acceptance. A later isolated B2
|
||||||
|
fleet test is separate work and does not block finishing Synology deployment.
|
||||||
|
|
||||||
|
## Qualification continuation on 2026-09-30
|
||||||
|
|
||||||
|
Run10, source `893cb6490c1d37df1f9bca19d5c058c304091b87`, pinned the installed
|
||||||
|
Platform source. It failed in design-install at05:22:29Z with npm ECONNRESET,
|
||||||
|
before any deploy artifact was produced. Production remained on accepted run8.
|
||||||
|
This transport failure is distinct from the unexplained run9 Manager mismatch.
|
||||||
|
|
||||||
|
Source `70065fb74c449c16094dd4bc05356a8174ec4524` adds at most three frozen
|
||||||
|
dependency-install attempts for explicit ECONNRESET/ETIMEDOUT/EAI_AGAIN only.
|
||||||
|
Integrity/auth/lockfile/unclassified/mixed errors and build/test failures still
|
||||||
|
fail immediately.25local CI tests cover recovery, exhaustion, no false report,
|
||||||
|
and rejection of non-network failures.
|
||||||
|
|
||||||
|
Run11 passed265application/25CI/170artifact tests (17historical skips) and was
|
||||||
|
automatically accepted at2026-09-30T05:36:45Z, canonical applied ledger388.
|
||||||
|
Artifact SHA-256 is
|
||||||
|
`a1c9d201b2f129413b041fb56f2d35f0a05d3936f7ea46116b32929eab343418`;
|
||||||
|
backup is
|
||||||
|
`device-core-release-device-core-release-v1-r11-70065fb74c449c16094dd4bc05356a8174ec4524-20260930-083337`.
|
||||||
|
CI receipt, applied archive hash and backup were independently verified;
|
||||||
|
lifecycle is terminal_success with no warnings or failed receipt. Only
|
||||||
|
manifest/release metadata differ from r8's application payload. The new before
|
||||||
|
snapshot retained per-field hashes and Manager NetworkMode
|
||||||
|
`nodedc-device-plane-private`. The mismatch did not recur in this attempt.
|
||||||
|
Public health returned200 and the authenticated UI retained DC SUDO, DCTOUCH and
|
||||||
|
Robot2B — Moscow Trike Delivery. No user data was changed during the UI check.
|
||||||
|
|
||||||
|
Run12/source `b2660df9e26afe977bfa62efd35a8397eac4898b` is the subsequent
|
||||||
|
documentation push. Its dependency install really
|
||||||
|
encountered ECONNRESET at05:39:41Z, then retried after five seconds and recovered
|
||||||
|
without operator action; qualification proceeded to265application/25CI tests,
|
||||||
|
UI build and artifact contracts. This independently verifies the live transport
|
||||||
|
recovery path added after run10. It does not establish the cause of run9.
|
||||||
|
|
||||||
|
Run12 passed the same265application/25CI/170artifact checks and was automatically
|
||||||
|
accepted at2026-09-30T05:49:19Z, canonical ledger389. Artifact SHA-256:
|
||||||
|
`44c62036967c3ed26bd6c82f94e6f4103ccad06f45c383498210b43ad80c9d7c`.
|
||||||
|
Backup:
|
||||||
|
`device-core-release-device-core-release-v1-r12-b2660df9e26afe977bfa62efd35a8397eac4898b-20260930-084605`.
|
||||||
|
Its before snapshot identifies r11 as the predecessor. CI receipt, archive hash,
|
||||||
|
backup and unique journal row agree; lifecycle is terminal_success, with no
|
||||||
|
failed receipt or warnings. Public health returned200 with ok/authRequired/
|
||||||
|
deviceCoreConfigured true after the update. Neither r11 nor r12 needs any
|
||||||
|
operator replay. Current production source at this checkpoint is b2660df.
|
||||||
|
|
||||||
|
These two successful updates establish the automatic delivery path and observed
|
||||||
|
transport recovery. They do not prove the old intermittent Manager mismatch
|
||||||
|
fixed. Guards and rollback remain enabled; the installed diagnostics retain the
|
||||||
|
actual differing fields if it recurs. No topology/normalization workaround was
|
||||||
|
introduced based on the unproven NetworkMode hypothesis.
|
||||||
|
|||||||
@@ -0,0 +1,138 @@
|
|||||||
|
# Stable primary network for recurring Device Core releases
|
||||||
|
|
||||||
|
Status: source-qualified on 2026-09-30; root promotion, NAS metadata acceptance
|
||||||
|
and two subsequent automatic releases remain pending. Production remains r12.
|
||||||
|
DCPLATFORM-21 owns this exact registry addition; DCPLATFORM-37 tracks acceptance.
|
||||||
|
|
||||||
|
## Reproduced defect and evidence limits
|
||||||
|
|
||||||
|
Docker Compose 2.20.3 chooses `HostConfig.NetworkMode` from the first result of
|
||||||
|
`NetworksByPriority`. Its compose-go 1.18.1 dependency builds that result from a
|
||||||
|
Go map and sorts only by priority. Equal priorities have no deterministic tie
|
||||||
|
breaker. Reordering YAML keys is therefore insufficient.
|
||||||
|
|
||||||
|
Primary sources:
|
||||||
|
- [Compose 2.20.3 create.go](https://github.com/docker/compose/blob/v2.20.3/pkg/compose/create.go)
|
||||||
|
- [Compose dependency pin](https://github.com/docker/compose/blob/v2.20.3/go.mod)
|
||||||
|
- [compose-go network ordering](https://github.com/compose-spec/compose-go/blob/v1.18.1/types/types.go)
|
||||||
|
|
||||||
|
The official Darwin ARM64 Compose 2.20.3 binary was independently checksum
|
||||||
|
verified as `51cd66bf94923ec8668f1a78c8740abb6cfbe1189da5720a8051a97be527372b`.
|
||||||
|
Tests used local Docker Desktop Engine29.1.3 through API1.44, an existing pinned
|
||||||
|
Node image and isolated synthetic services. They used no NAS access, ports,
|
||||||
|
host mounts, credentials or production data. All test containers/networks were
|
||||||
|
removed by their exact project after each test; cleanup inventories are empty.
|
||||||
|
|
||||||
|
| Check | Result |
|
||||||
|
| --- | --- |
|
||||||
|
| Equal priorities, 32 fresh creates | Private primary28; secondary primary4 |
|
||||||
|
| Explicit private100 / secondary0, 32 fresh creates | Private primary32 |
|
||||||
|
| Exact candidate override, 16 Core+Manager recreations | All32 containers kept private primary and both attached networks |
|
||||||
|
| Original private-primary baseline to exact override, 8 Core+Manager recreations | All16 containers retained every canonical v2 configuration field digest |
|
||||||
|
|
||||||
|
Local reports and executable reproductions are retained under
|
||||||
|
`outputs/device-core-stability-20260930/compose-reproducer/` in the NODEDC
|
||||||
|
workspace: `result.json`, `rollout-result.json`, `fingerprint-result.json` and
|
||||||
|
their corresponding Python scripts. These are test evidence, never NAS payload.
|
||||||
|
|
||||||
|
The NAS foundation identifies the Compose2.20 family; its exact installed patch
|
||||||
|
version is reported by the new canonical preflight. The local Engine is newer
|
||||||
|
than NAS Docker24.0.2, so these checks do not replace NAS acceptance.
|
||||||
|
|
||||||
|
The old r9 receipt retained only an aggregate Manager configuration hash, and
|
||||||
|
rollback removed the rejected container. This reproduces a real defect capable
|
||||||
|
of causing that class of rejection; it does not prove which field differed in r9.
|
||||||
|
The existing r9 failure record remains unresolved historical evidence, not a
|
||||||
|
reason to replay r9 or waive configuration acceptance.
|
||||||
|
|
||||||
|
## Exact registered transition
|
||||||
|
|
||||||
|
Component: `device-core-network-priority`, type `app-overlay`, fixed identity
|
||||||
|
`device-core-network-priority-v1-20260930-001`. Both live and Compose roots are
|
||||||
|
`/volume1/docker/nodedc-device-plane`. The package permits exactly:
|
||||||
|
|
||||||
|
1. `docker-compose.device-release-network-priority.yml`
|
||||||
|
2. `deployment/device-core-network-priority-v1.json`
|
||||||
|
|
||||||
|
The existing base Compose files are unchanged. The new override specifies
|
||||||
|
private-network priority100 and secondary-network priority0 for Core and Manager.
|
||||||
|
It does not add/remove a network, change network properties, control the default
|
||||||
|
gateway or change endpoint settings. In particular, `priority` is not a
|
||||||
|
`gw_priority` substitute. The first installed primary must already be
|
||||||
|
`nodedc-device-plane-private` for both services.
|
||||||
|
|
||||||
|
This initial installation writes metadata only: no build, pull, restart,
|
||||||
|
recreation, database change, network creation or secret repair; services are
|
||||||
|
empty. No new ports, listeners or runtime dependencies are introduced.
|
||||||
|
|
||||||
|
Required predecessor is the exact accepted r12 source
|
||||||
|
`b2660df9e26afe977bfa62efd35a8397eac4898b`, release identity
|
||||||
|
`device-core-release-v1-r12-b2660df9e26afe977bfa62efd35a8397eac4898b`, archive SHA
|
||||||
|
`44c62036967c3ed26bd6c82f94e6f4103ccad06f45c383498210b43ad80c9d7c`.
|
||||||
|
Preflight proves journal/archive identity and every installed release file,
|
||||||
|
rejects unresolved rollback failures, requires both new paths absent, checks
|
||||||
|
health and existing secret/mount/network boundaries, then captures all five
|
||||||
|
Device Plane services and other persistent Compose services.
|
||||||
|
|
||||||
|
Canonical `docker compose config --format json` is read before and with the
|
||||||
|
candidate override. An in-memory comparison proves that ONLY the two primary
|
||||||
|
priority values change. Environment values and complete config never enter
|
||||||
|
logs or receipts. Only config hashes, version, file hashes and runtime evidence
|
||||||
|
are saved in `device-network-priority-before.json` with mode0600.
|
||||||
|
|
||||||
|
Apply verifies the copied files, effective configuration, original Compose/source,
|
||||||
|
health and exactly unchanged container identities/images/configuration for all
|
||||||
|
five services and other Compose projects. It emits `deploy-ok` only after those
|
||||||
|
checks. Failure removes/restores only the two new metadata paths, verifies the
|
||||||
|
original config and runtime again, and records the rollback result. An uncertain
|
||||||
|
rollback blocks further application releases even when marker files are absent.
|
||||||
|
|
||||||
|
## Future normal releases and rollback
|
||||||
|
|
||||||
|
Only the recurring `device-core-release` domain appends this override to its
|
||||||
|
effective Compose files. Activation requires both exact files plus a unique
|
||||||
|
successful canonical receipt and its checked immutable archive; copying a marker
|
||||||
|
does not activate it. Generic/Engine executors and historical Device Plane
|
||||||
|
transitions are unchanged.
|
||||||
|
|
||||||
|
Normal release acceptance now hashes the complete effective Compose set,
|
||||||
|
including the accepted override. Build policy, service selection and
|
||||||
|
`--no-deps --no-build --pull never` remain unchanged. Normal activation and
|
||||||
|
automatic rollback call the same domain executor, so both receive the override.
|
||||||
|
Rollback still restores exact prior image IDs without rebuilding.
|
||||||
|
|
||||||
|
The runtime fingerprint stays v2: only complete uniquely addressed mount objects
|
||||||
|
are order-normalized. `HostConfig.NetworkMode`, all its other fields, environment,
|
||||||
|
mount options and attached network names remain strict. There is no retry-until-
|
||||||
|
accepted loop and no acceptance of a switched primary network.
|
||||||
|
|
||||||
|
## Reproducible qualification and operator sequence
|
||||||
|
|
||||||
|
Source checks:
|
||||||
|
```sh
|
||||||
|
python3 -m unittest discover -s infra/deploy-runner -p 'test_device_core_*.py'
|
||||||
|
python3 -m unittest discover -s infra/device-core-deploy -p 'test_*.py'
|
||||||
|
```
|
||||||
|
Also run the Platform/Device Plane registry suites and the Device Core
|
||||||
|
repository's artifact/real HTTP-health tests against this candidate runner.
|
||||||
|
Seventeen focused network-priority tests cover exact payload, deterministic
|
||||||
|
packaging, configuration-diff boundaries, initial predecessor, secret redaction,
|
||||||
|
receipt/archive activation, actual release command construction, no-runtime
|
||||||
|
metadata application and rollback failure. Python3.8 syntax is required.
|
||||||
|
|
||||||
|
Promote the reviewed root runner through the separate atomic SHA-pinned gate,
|
||||||
|
then require its `verify-install`. Build with the committed canonical builder:
|
||||||
|
```sh
|
||||||
|
python3 infra/device-core-deploy/build_network_priority.py --output-dir /tmp/device-network-priority
|
||||||
|
```
|
||||||
|
Audit and stage the resulting immutable TGZ through SMB, inspect lifecycle,
|
||||||
|
then review a fresh NAS `plan`. Only the matching new plan authorizes the
|
||||||
|
already-requested `apply`. No raw Docker/diagnostic shell acceptance follows
|
||||||
|
`deploy-ok`: the runner owns that gate.
|
||||||
|
|
||||||
|
After metadata acceptance, update Device Core's Platform source pin to the
|
||||||
|
published reviewed commit. Submit two ordered normal main updates and verify
|
||||||
|
their CI qualification, automatic applied receipts, archives/backups, runtime
|
||||||
|
evidence and separate authenticated UI/public-health checks. Until then this
|
||||||
|
correction is source-qualified, not accepted in production. Do not advance
|
||||||
|
Device Core main before the fixed r12 metadata transition has been accepted.
|
||||||
@@ -1,11 +1,16 @@
|
|||||||
# Device Core recurring deployment
|
# Device Core recurring deployment
|
||||||
|
|
||||||
Status: 2026-09-29. The build runner is installed and push-to-main qualification
|
Status: 2026-09-30. Push-to-main qualification and automatic installation work on
|
||||||
works. Release r7 (`edf69068ec64e3d105d5324d39b8eaeface21215`) is accepted
|
Synology. The outbound controller bootstrap is recorded in ledger386.
|
||||||
in canonical ledger 385. The outbound production controller was activated by
|
Runs11 and12 were accepted automatically in sequence (ledgers388/389), with
|
||||||
`device-core-autodeploy-v1-20260929-001` in ledger 386 at18:35:52Z on2026-09-29.
|
source `b2660df9e26afe977bfa62efd35a8397eac4898b` now accepted. A real npm
|
||||||
Run8 deployed automatically; run9 failed Manager runtime configuration acceptance
|
ECONNRESET during run12 recovered through the bounded CI install retry.
|
||||||
and rolled back successfully. Full ordered-release acceptance remains open.
|
Earlier run9 failed Manager runtime configuration acceptance and rolled back;
|
||||||
|
its exact cause remains unresolved. Installed runner013 retains per-field
|
||||||
|
diagnostics without weakening acceptance. See [the evidence report](ACCEPTANCE_20260929.md).
|
||||||
|
An independently reproduced equal-priority Compose network-selection defect now
|
||||||
|
has a tested correction; its NAS promotion and live acceptance are still pending.
|
||||||
|
See [the exact network-priority transition](NETWORK_PRIORITY_20260930.md).
|
||||||
DCPLATFORM-21 owns the deployment contract; DCPLATFORM-37 tracks acceptance.
|
DCPLATFORM-21 owns the deployment contract; DCPLATFORM-37 tracks acceptance.
|
||||||
|
|
||||||
## Release domain
|
## Release domain
|
||||||
@@ -109,12 +114,14 @@ canon. Device Core uses its own exact Core+Manager Compose entry with unchanged
|
|||||||
|
|
||||||
- Runner012 was promoted and verified as
|
- Runner012 was promoted and verified as
|
||||||
`c1301d1072f3d5d39ba422a09847a05a5aad8a753c816d7fb6916d1f1cadd9c6`.
|
`c1301d1072f3d5d39ba422a09847a05a5aad8a753c816d7fb6916d1f1cadd9c6`.
|
||||||
|
- Runner013 subsequently passed operator verify-install as
|
||||||
|
`3eefc75591bb08339d79c6a484912d7d6a8881fe8729e966b6f0bf32da21da80`.
|
||||||
- The data-only bootstrap built by `build_autodeploy.py` passed fresh plan/apply;
|
- The data-only bootstrap built by `build_autodeploy.py` passed fresh plan/apply;
|
||||||
artifact SHA is `fe9298baa5f41a35c2705ee9946b730ff2de7d5b5c9b2b8eb1b4cca0bc8ed12b`.
|
artifact SHA is `fe9298baa5f41a35c2705ee9946b730ff2de7d5b5c9b2b8eb1b4cca0bc8ed12b`.
|
||||||
- NAS imported its root-private credential and removed enrollment staging. The
|
- NAS imported its root-private credential and removed enrollment staging. The
|
||||||
temporary Mac credential was removed after acceptance. Neither a Mac nor SMB
|
temporary Mac credential was removed after acceptance. Neither a Mac nor SMB
|
||||||
needs to remain connected for recurring delivery.
|
needs to remain connected for recurring delivery.
|
||||||
- Ordered automatic releases are being verified against their CI receipts,
|
- Ordered automatic releases r11/r12 were verified against their CI receipts,
|
||||||
archive digests, unique canonical journal rows and backups. Failed-check and
|
archive digests, unique canonical journal rows and backups. Failed-check and
|
||||||
crash/reconciliation tests are source qualification, not a claim that the NAS
|
crash/reconciliation tests are source qualification, not a claim that the NAS
|
||||||
was deliberately crashed during production acceptance.
|
was deliberately crashed during production acceptance.
|
||||||
@@ -129,15 +136,14 @@ successfully to run8. Its failed archive must not be replayed. The initial
|
|||||||
snapshots retained only an aggregate configuration hash, so the specific field
|
snapshots retained only an aggregate configuration hash, so the specific field
|
||||||
was not available after rollback removed the failed container.
|
was not available after rollback removed the failed container.
|
||||||
|
|
||||||
The next runner candidate adds diagnostic field hashes to new before snapshots.
|
Installed runner013 adds diagnostic field hashes to new before snapshots.
|
||||||
It binds each observation to the checked container/image/configuration identity.
|
It binds each observation to the checked container/image/configuration identity.
|
||||||
On a mismatch, the canonical failed receipt retains changed field names and
|
On a mismatch, the canonical failed receipt retains changed field names and
|
||||||
their hashes before the failed generation is removed. Raw environment values,
|
their hashes before the failed generation is removed. Raw environment values,
|
||||||
inspect payloads and external exception text are not included. The v2 comparison,
|
inspect payloads and external exception text are not included. The v2 comparison,
|
||||||
network/mount semantics, selected services and rollback checks are unchanged.
|
network/mount semantics, selected services and rollback checks are unchanged.
|
||||||
Old snapshots still use their original aggregate hash. This instrumentation is
|
Old snapshots still use their original aggregate hash. This instrumentation is
|
||||||
not a fix for an as-yet-unidentified configuration difference and is not installed
|
not by itself a fix for an as-yet-unidentified configuration difference.
|
||||||
until the separate root promotion succeeds.
|
|
||||||
|
|
||||||
See [live acceptance and the run9 incident](ACCEPTANCE_20260929.md).
|
See [live acceptance and the run9 incident](ACCEPTANCE_20260929.md).
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Build the exact data-only Device Core primary-network contract."""
|
||||||
|
import argparse
|
||||||
|
import gzip
|
||||||
|
import hashlib
|
||||||
|
import io
|
||||||
|
import json
|
||||||
|
from pathlib import Path
|
||||||
|
import tarfile
|
||||||
|
|
||||||
|
ROOT = Path(__file__).resolve().parent
|
||||||
|
ENTRIES = ('docker-compose.device-release-network-priority.yml',
|
||||||
|
'deployment/device-core-network-priority-v1.json')
|
||||||
|
|
||||||
|
|
||||||
|
def bundle():
|
||||||
|
descriptor = (ROOT / 'network-priority-v1.json').read_bytes()
|
||||||
|
identity = json.loads(descriptor)['releaseId']
|
||||||
|
members = {
|
||||||
|
'manifest.env': ('id=' + identity + '\ncomponent=device-core-network-priority\ntype=app-overlay\n').encode(),
|
||||||
|
'files.txt': ('\n'.join(ENTRIES) + '\n').encode(),
|
||||||
|
'payload/' + ENTRIES[0]: (ROOT / 'docker-compose.network-priority.yml').read_bytes(),
|
||||||
|
'payload/' + ENTRIES[1]: descriptor,
|
||||||
|
}
|
||||||
|
output = io.BytesIO()
|
||||||
|
with gzip.GzipFile(fileobj=output, mode='wb', mtime=0, filename='') as compressed:
|
||||||
|
with tarfile.open(fileobj=compressed, mode='w') as archive:
|
||||||
|
for name, data in sorted(members.items()):
|
||||||
|
info = tarfile.TarInfo(name)
|
||||||
|
info.mode = 0o644
|
||||||
|
info.size = len(data)
|
||||||
|
archive.addfile(info, io.BytesIO(data))
|
||||||
|
return identity, output.getvalue()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument('--output-dir', required=True, type=Path)
|
||||||
|
args = parser.parse_args()
|
||||||
|
args.output_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
identity, data = bundle()
|
||||||
|
path = args.output_dir / ('nodedc-' + identity + '.tgz')
|
||||||
|
with path.open('xb') as stream:
|
||||||
|
stream.write(data)
|
||||||
|
print(json.dumps({'artifact': str(path), 'sha256': hashlib.sha256(data).hexdigest(), 'id': identity}))
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
device-control-core:
|
||||||
|
networks:
|
||||||
|
device-plane-private:
|
||||||
|
priority: 100
|
||||||
|
device-plane-egress:
|
||||||
|
priority: 0
|
||||||
|
device-manager:
|
||||||
|
networks:
|
||||||
|
device-plane-private:
|
||||||
|
priority: 100
|
||||||
|
platform-edge:
|
||||||
|
priority: 0
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
{"schemaVersion":"nodedc.device-core.network-priority.v1","releaseId":"device-core-network-priority-v1-20260930-001","baselineReleaseId":"device-core-release-v1-r12-b2660df9e26afe977bfa62efd35a8397eac4898b","baselineSha256":"44c62036967c3ed26bd6c82f94e6f4103ccad06f45c383498210b43ad80c9d7c","mode":"metadata-only-existing-primary-network","primaryPriority":100,"secondaryPriority":0}
|
||||||
Reference in New Issue
Block a user