Use proper paths for tests
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	
This commit is contained in:
		
							
								
								
									
										55
									
								
								script/vault-stop.ps1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								script/vault-stop.ps1
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,55 @@
 | 
			
		||||
# Function to display logs
 | 
			
		||||
function Show-VaultLogs {
 | 
			
		||||
    Write-Output "=== VAULT SERVER STDOUT (last 50 lines) ==="
 | 
			
		||||
    Get-Content "vault-logs/stdout.log" -ErrorAction SilentlyContinue | Select-Object -Last 50
 | 
			
		||||
    Write-Output "=== VAULT SERVER STDERR (last 50 lines) ==="
 | 
			
		||||
    Get-Content "vault-logs/stderr.log" -ErrorAction SilentlyContinue | Select-Object -Last 50
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Read PID from file (Gitea alternative to env vars)
 | 
			
		||||
$vaultPid = $null
 | 
			
		||||
if (Test-Path "vault-pid.txt") {
 | 
			
		||||
    $vaultPid = Get-Content "vault-pid.txt" -Raw
 | 
			
		||||
    Write-Output "✅ Found Vault PID: $vaultPid"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Check if previous steps failed
 | 
			
		||||
$previousStepFailed = $false
 | 
			
		||||
if ("${{ steps.start-vault.outcome }}" -eq "failure") {
 | 
			
		||||
    $previousStepFailed = $true
 | 
			
		||||
    Write-Output "❌ Vault startup step failed"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Stop the Vault process if we have a PID
 | 
			
		||||
if ($vaultPid -and ($vaultPid -ne '')) {
 | 
			
		||||
if ($previousStepFailed) {
 | 
			
		||||
    Write-Output "❌ Previous step failed, showing Vault logs:"
 | 
			
		||||
    Show-VaultLogs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Stop the Vault process
 | 
			
		||||
try {
 | 
			
		||||
    Stop-Process -Id $vaultPid -Force -ErrorAction Stop
 | 
			
		||||
    Write-Output "✅ Stopped Vault process $vaultPid"
 | 
			
		||||
} catch {
 | 
			
		||||
    Write-Warning "❌ Failed to stop process $vaultPid: $($_.Exception.Message)"
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Clean up any remaining Vault processes
 | 
			
		||||
$vaultProcesses = Get-Process -Name "vault" -ErrorAction SilentlyContinue
 | 
			
		||||
if ($vaultProcesses) {
 | 
			
		||||
    Write-Output "✅ Found additional Vault processes, stopping them..."
 | 
			
		||||
    $vaultProcesses | Stop-Process -Force -ErrorAction SilentlyContinue
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Always show logs if we're in a failure state
 | 
			
		||||
if ($previousStepFailed -or "${{ job.status }}" -eq "failure") {
 | 
			
		||||
    Write-Output "❌ Job failed, showing final Vault logs:"
 | 
			
		||||
    Show-VaultLogs
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Cleanup PID file
 | 
			
		||||
if (Test-Path "vault-pid.txt") {
 | 
			
		||||
    Remove-Item "vault-pid.txt" -Force
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user