fix: share launch admin credential with automation

This commit is contained in:
2026-05-13 09:34:06 +08:00
parent 9f2e2ecb0f
commit bf2d8b5cfb
@@ -5,7 +5,8 @@ param(
[switch]$StopAfterPhase2,
[switch]$StopAfterPhase3,
[switch]$StopAfterPhase4,
[switch]$StopAfterPhase5
[switch]$StopAfterPhase5,
[string]$AdminPasswordFile = ""
)
$ErrorActionPreference = "Stop"
@@ -16,12 +17,29 @@ $artifactDir = Join-Path $repoRoot "project-docs\automation-artifacts\run-until-
$summaryJson = Join-Path $artifactDir "summary.json"
$summaryMd = Join-Path $artifactDir "summary.md"
$docsRoot = Join-Path $repoRoot "project-docs"
if ([string]::IsNullOrWhiteSpace($AdminPasswordFile)) {
$AdminPasswordFile = Join-Path $HOME ".ai-contract-platform\production-admin-password.txt"
}
if (-not [System.IO.Path]::IsPathRooted($AdminPasswordFile)) {
$AdminPasswordFile = Join-Path $repoRoot $AdminPasswordFile
}
New-Item -ItemType Directory -Force -Path $artifactDir | Out-Null
$docsIndexPath = Join-Path $docsRoot "README.md"
$configPath = Join-Path $repoRoot "backend\app\core\config.py"
$composePath = Join-Path $repoRoot "docker-compose.server.yml"
$adminPasswordSource = "environment"
if ([string]::IsNullOrWhiteSpace($env:AI_CONTRACT_ADMIN_PASSWORD)) {
$adminPasswordSource = "missing"
if (Test-Path -LiteralPath $AdminPasswordFile -PathType Leaf) {
$filePassword = (Get-Content -LiteralPath $AdminPasswordFile -Raw -Encoding UTF8).Trim()
if (-not [string]::IsNullOrWhiteSpace($filePassword)) {
$env:AI_CONTRACT_ADMIN_PASSWORD = $filePassword
$adminPasswordSource = "local credential file"
}
}
}
$results = New-Object System.Collections.Generic.List[object]
@@ -68,6 +86,7 @@ function Write-Summaries {
runTimestamp = $timestamp
artifactDir = $artifactDir
resultCount = $results.Count
adminPasswordSource = $adminPasswordSource
phasePlan = Get-PhasePlanSummary -PhaseDefinitions $PhaseDefinitions
results = $results
}
@@ -79,6 +98,7 @@ function Write-Summaries {
$lines += ""
$lines += "- artifactDir: $artifactDir"
$lines += "- generatedAt: $(Get-Date -Format s)"
$lines += "- adminPasswordSource: $adminPasswordSource"
$lines += ""
$lines += "## phase plan"
$lines += ""