texts fixes, search bar fixes, global menu fixes.
This commit is contained in:
@@ -4,24 +4,41 @@ param(
|
||||
[string]$ComposeFile = "docker-compose.stella-ops.yml",
|
||||
[int]$WaitTimeoutSeconds = 1200,
|
||||
[int]$RecoveryAttempts = 2,
|
||||
[int]$RecoveryWaitSeconds = 180
|
||||
[int]$RecoveryWaitSeconds = 180,
|
||||
[switch]$SkipHeaderSearchSmoke
|
||||
)
|
||||
|
||||
Set-StrictMode -Version Latest
|
||||
$ErrorActionPreference = "Stop"
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
|
||||
$configPath = switch ($Mode) {
|
||||
"microservice" { "./router-gateway-local.json" }
|
||||
"reverseproxy" { "./router-gateway-local.reverseproxy.json" }
|
||||
$composeDirectory = Split-Path -Parent $PSScriptRoot
|
||||
$resolvedComposeFile = if ([System.IO.Path]::IsPathRooted($ComposeFile)) {
|
||||
$ComposeFile
|
||||
} else {
|
||||
Join-Path -Path $composeDirectory -ChildPath $ComposeFile
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $resolvedComposeFile)) {
|
||||
throw "Compose file not found: $resolvedComposeFile"
|
||||
}
|
||||
|
||||
$configFileName = switch ($Mode) {
|
||||
"microservice" { "router-gateway-local.json" }
|
||||
"reverseproxy" { "router-gateway-local.reverseproxy.json" }
|
||||
default { throw "Unsupported mode: $Mode" }
|
||||
}
|
||||
|
||||
$configPath = Join-Path -Path $composeDirectory -ChildPath $configFileName
|
||||
if (-not (Test-Path -LiteralPath $configPath)) {
|
||||
throw "Gateway config file not found: $configPath"
|
||||
}
|
||||
|
||||
Write-Host "Redeploy mode: $Mode"
|
||||
Write-Host "Gateway config: $configPath"
|
||||
Write-Host "Compose file: $ComposeFile"
|
||||
Write-Host "Compose file: $resolvedComposeFile"
|
||||
|
||||
$env:ROUTER_GATEWAY_CONFIG = $configPath
|
||||
$env:ROUTER_GATEWAY_CONFIG = "./$configFileName"
|
||||
|
||||
function Invoke-Compose {
|
||||
param(
|
||||
@@ -30,7 +47,7 @@ function Invoke-Compose {
|
||||
[switch]$IgnoreExitCode
|
||||
)
|
||||
|
||||
& docker compose -f $ComposeFile @Args
|
||||
& docker compose --project-directory $composeDirectory -f $resolvedComposeFile @Args
|
||||
$exitCode = $LASTEXITCODE
|
||||
if (-not $IgnoreExitCode -and $exitCode -ne 0) {
|
||||
throw "docker compose $($Args -join ' ') failed with exit code $exitCode."
|
||||
@@ -55,12 +72,33 @@ function Get-ComposeServiceName {
|
||||
[string]$ContainerName
|
||||
)
|
||||
|
||||
$service = & docker inspect --format "{{ index .Config.Labels \"com.docker.compose.service\" }}" $ContainerName 2>$null
|
||||
if ($LASTEXITCODE -ne 0 -or [string]::IsNullOrWhiteSpace($service)) {
|
||||
$inspectJson = & docker inspect $ContainerName 2>$null
|
||||
if ($LASTEXITCODE -ne 0 -or $null -eq $inspectJson) {
|
||||
return $null
|
||||
}
|
||||
|
||||
return $service.Trim()
|
||||
try {
|
||||
$inspect = $inspectJson | ConvertFrom-Json
|
||||
if ($null -eq $inspect) {
|
||||
return $null
|
||||
}
|
||||
|
||||
$first = if ($inspect -is [System.Array]) { $inspect[0] } else { $inspect }
|
||||
$labels = $first.Config.Labels
|
||||
if ($null -eq $labels) {
|
||||
return $null
|
||||
}
|
||||
|
||||
$service = $labels."com.docker.compose.service"
|
||||
if ([string]::IsNullOrWhiteSpace($service)) {
|
||||
return $null
|
||||
}
|
||||
|
||||
return $service.Trim()
|
||||
}
|
||||
catch {
|
||||
return $null
|
||||
}
|
||||
}
|
||||
|
||||
function Wait-ForContainerHealth {
|
||||
@@ -126,4 +164,14 @@ if ($remainingUnhealthy.Count -gt 0) {
|
||||
throw "Redeploy completed with unresolved unhealthy containers: $($remainingUnhealthy -join ', ')"
|
||||
}
|
||||
|
||||
if (-not $SkipHeaderSearchSmoke) {
|
||||
$headerSearchSmokeScript = Join-Path -Path $PSScriptRoot -ChildPath "header-search-smoke.ps1"
|
||||
if (-not (Test-Path -LiteralPath $headerSearchSmokeScript)) {
|
||||
throw "Header search smoke script not found: $headerSearchSmokeScript"
|
||||
}
|
||||
|
||||
Write-Host "Running header search route smoke checks..."
|
||||
& $headerSearchSmokeScript
|
||||
}
|
||||
|
||||
Write-Host "Redeploy complete for mode '$Mode'."
|
||||
|
||||
Reference in New Issue
Block a user