feat: add self-enrolling Windows Agent package

This commit is contained in:
lussierj committed 2026-08-28 17:50:39 +00:00
1 parent b9b5e5e36f
commit abf5654a25
20 files changed
+1834 -42

No files matched your search

+77
View File
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "${repo_root}"
project_name="minerops-windows-package-test-$$"
compose=(
docker compose
--project-name "${project_name}"
--env-file .env.dev
-f compose.dev.yaml
)
cleanup() {
status=$?
"${compose[@]}" down --volumes --remove-orphans \
>/dev/null 2>&1 || true
exit "${status}"
}
trap cleanup EXIT
echo "=== BUILD BACKEND WITH CANONICAL AGENT SOURCE ==="
"${compose[@]}" build backend
echo
echo "=== BACKEND PACKAGE TESTS ==="
"${compose[@]}" run --rm --no-deps \
-v "${repo_root}/backend/tests:/app/tests:ro" \
backend python -m unittest -v \
tests.test_agent_windows_package
echo
echo "=== VERIFY CANONICAL SOURCE IS IN IMAGE ==="
"${compose[@]}" run --rm --no-deps \
backend sh -ec '
test -f /app/agents/windows/Enroll-MinerOpsAgent.ps1
test -f /app/agents/windows/install.ps1
test -f /app/agents/windows/MinerOpsAgentService.ps1
test -f /app/agents/windows/VERSION
'
echo
echo "=== OFFICIAL POWERSHELL VALIDATION ==="
docker run --rm \
-v "${repo_root}/agents/windows:/work:ro" \
mcr.microsoft.com/powershell:7.4-debian-12 \
pwsh -NoLogo -NoProfile -Command '
$ErrorActionPreference = "Stop"
foreach ($script in @(
"/work/Enroll-MinerOpsAgent.ps1",
"/work/install.ps1"
)) {
$tokens = $null
$errors = $null
[System.Management.Automation.Language.Parser]::ParseFile(
$script,
[ref]$tokens,
[ref]$errors
) | Out-Null
if ($errors.Count -gt 0) {
throw "$script parser errors: $($errors.Message -join "; ")"
}
Write-Host "Parsed $script"
}
& /work/tests/Test-MinerOpsEnrollment.ps1
& /work/tests/Test-MinerOpsInstaller.ps1
'
echo
echo "Windows Agent package foundation tests passed."