v1.31.0
conocimientocicd-architecttemplates/1690 B

smoke-strict-dotnet.yml

Fichero que /hv:cicd-architect usa o materializa en el proyecto. Se muestra tal cual está en el plugin.

cicd-architectskill
templatescarpeta
1690 Btamaño
2026-10-02último cambio del pack
# =============================================================================
# steps/smoke-strict-dotnet.yml
# R11 estricto (.NET API): smoke contra https://localhost/<app>/health/live con
# bypass de cert SOLO localhost (R9, SNI mismatch). Si falla tras ~90s -> throw
# (dispara el rollback de steps/rollback-on-fail.yml, R15 capa 3).
# R2: TLS 1.2+. Requiere $(iisVirtualApp).
# =============================================================================
steps:
  - task: PowerShell@2
    displayName: 'Smoke estricto .NET (R11 + R9)'
    inputs:
      targetType: inline
      script: |
        try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 -bor [Net.SecurityProtocolType]::Tls13 } catch { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 }
        $app = "$(iisVirtualApp)"
        $url = "https://localhost/$app/health/live"
        $cb  = [System.Net.ServicePointManager]::ServerCertificateValidationCallback
        [System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }   # R9 SOLO localhost
        try {
          $ok = $false
          for ($i = 1; $i -le 9; $i++) {        # polling ~90s (9 x 10s)
            try {
              $r = Invoke-WebRequest -Uri $url -UseBasicParsing -TimeoutSec 10
              if ($r.StatusCode -eq 200) { $ok = $true; break }
            } catch { Start-Sleep -Seconds 10 }
          }
          if (-not $ok) { throw "Smoke FAIL: $url no devolvio 200 tras ~90s" }
          Write-Host "Smoke OK: $url"
        } finally {
          [System.Net.ServicePointManager]::ServerCertificateValidationCallback = $cb       # restaurar (R9)
        }

← Volver a la ficha de cicd-architect