feat(windows): add recoverable existing-agent credential upgrade

This commit is contained in:
lussierj committed 2026-10-14 13:50:19 +00:00
1 parent 3cfb0d1abe
commit 97a0139e3d
25 files changed
+11122 -108

No files matched your search

+20 -3
View File
@@ -14,6 +14,7 @@ WINDOWS_PACKAGE_ROOT = "MinerOpsAgent-Windows"
WINDOWS_PACKAGE_FILES = (
"Enroll-MinerOpsAgent.ps1",
"Upgrade-MinerOpsAgentCredential.ps1",
"install.ps1",
"uninstall.ps1",
"MinerOpsAgentService.ps1",
@@ -80,6 +81,7 @@ def build_windows_agent_package(
*,
enrollment_token: str,
hub_url: str,
workflow: str = "new_agent",
source_root: Path | None = None,
) -> bytes:
token = enrollment_token.strip()
@@ -91,6 +93,12 @@ def build_windows_agent_package(
normalized_hub_url = normalize_hub_url(hub_url)
if workflow not in {
"new_agent",
"existing_agent_credential_transition",
}:
raise AgentWindowsPackageError("Unsupported Windows Agent workflow")
root = (
Path(source_root)
if source_root is not None
@@ -117,18 +125,27 @@ def build_windows_agent_package(
enrollment = {
"hub_url": normalized_hub_url,
"token": token,
"workflow": workflow,
}
instructions = """MinerOps Windows Agent
if workflow == "new_agent":
command = ".\\Enroll-MinerOpsAgent.ps1"
description = "enrollment"
else:
command = ".\\Upgrade-MinerOpsAgentCredential.ps1"
description = "existing-Agent credential transition"
instructions = f"""MinerOps Windows Agent
1. Extract this ZIP on the target Windows machine.
2. Open Windows PowerShell as Administrator.
3. Change to the extracted MinerOpsAgent-Windows folder.
4. Run:
.\\Enroll-MinerOpsAgent.ps1
{command}
The enrollment credential is short-lived and single-use.
This package is for the {description} workflow. The credential is short-lived
and single-use. Do not use the other bootstrap script with this package.
Do not post enrollment.json in chat, tickets, screenshots, or logs.
Delete the ZIP and extracted setup folder after successful installation.
"""