| 1234567891011121314151617181920212223242526272829303132 |
- #!/usr/bin/env pwsh
- #
- # CI Check Script: Fail build if any application-prod*.yml contains test-mode: true
- # Usage: ./check-test-mode.ps1
- #
- $ErrorActionPreference = "Stop"
- # Find all application-prod*.yml files
- $prodYamlFiles = Get-ChildItem -Path "$PSScriptRoot/../cfc-backend/src/main/resources/" -Filter "application-prod*.yml" -Recurse
- if ($prodYamlFiles.Count -eq 0) {
- Write-Host "No application-prod*.yml files found. Skipping check."
- exit 0
- }
- $foundViolation = $false
- foreach ($file in $prodYamlFiles) {
- $content = Get-Content -Path $file.FullName -Raw
- if ($content -match "test-mode:\s*true") {
- Write-Error "ERROR: Found test-mode: true in production YAML file: $($file.FullName)"
- $foundViolation = $true
- }
- }
- if ($foundViolation) {
- Write-Error "Build failed: test-mode: true detected in production profile YAML files."
- exit 1
- } else {
- Write-Host "✅ All application-prod*.yml files are clean (no test-mode: true)."
- exit 0
- }
|