conocimientocicd-architecttemplates/1673 B
smoke-besteffort.yml
Fichero que /hv:cicd-architect usa o materializa en el proyecto. Se muestra tal cual está en el plugin.
# steps/smoke-besteffort.yml
# R11: smoke best-effort (la app MVC5/WebApi2 no tiene endpoints /health/*; ademas el agente DEPLOY
# sufre hairpin NAT + 403.4 SSL Required + SNI mismatch contra su propia URL publica).
# NUNCA hace throw: el deploy real ya esta verificado por el task MSDeploy. Solo informa/diagnostica.
# Acepta 200/301/302/401/403 como "app viva" (la app redirige a login Azure AD).
parameters:
- name: appUrl
type: string
steps:
- task: PowerShell@2
displayName: 'Smoke best-effort (R11)'
inputs:
targetType: inline
script: |
try {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13
} catch {
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
}
$url = '${{ parameters.appUrl }}'
try {
$r = Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 15 -MaximumRedirection 0 -ErrorAction Stop
Write-Host "OK: $url respondio $($r.StatusCode)"
} catch {
$sc = $null
if ($_.Exception.Response) { $sc = [int]$_.Exception.Response.StatusCode }
if ($sc -in 301,302,401,403) {
Write-Host "OK (best-effort): $url respondio $sc (app viva; redireccion a login o recurso protegido)."
} else {
Write-Warning "Smoke best-effort FAIL: $url -> $($_.Exception.Message)"
Write-Host "DIAGNOSTICO: hairpin NAT + 403.4 SSL Required + SNI mismatch impiden el smoke desde el agente."
Write-Host "Verificar manualmente desde un navegador externo: $url"
}
}