conocimientocicd-architecttemplates/1557 B
coverage-gate.yml
Fichero que /hv:cicd-architect usa o materializa en el proyecto. Se muestra tal cual está en el plugin.
# steps/coverage-gate.yml - G7 (R18): gate de cobertura WARN-first con el script de Ovillo (sin herramientas externas).
# Materializado por /cicd-init junto a azure-pipelines.yml; el script vive en ops/cicd/scripts/coverage-gate.ps1
# (copiado desde skills/cicd-architect/templates/coverage-gate.ps1; el agente no tiene el plugin).
# Uso (stage Build, tras PublishCodeCoverageResults):
# - template: steps/coverage-gate.yml
# parameters: { thresholdLine: $(coverageLineThreshold), thresholdBranch: $(coverageBranchThreshold), mode: warn }
# HALLAZGO H: el temp del agente self-hosted persiste entre builds -> -Latest toma el XML mas reciente.
parameters:
- name: thresholdLine
type: string
default: '70'
- name: thresholdBranch
type: string
default: '60'
- name: mode
type: string
default: 'warn' # warn (exit 0 con aviso) | block (exit 3 si incumple)
- name: searchPath
type: string
default: '$(Agent.TempDirectory)'
steps:
- task: PowerShell@2
displayName: 'Coverage gate line>=${{ parameters.thresholdLine }}/branch>=${{ parameters.thresholdBranch }} (G7, ${{ parameters.mode }})'
condition: succeededOrFailed()
inputs:
targetType: filePath
filePath: '$(Build.SourcesDirectory)/ops/cicd/scripts/coverage-gate.ps1'
arguments: >-
-Path "${{ parameters.searchPath }}"
-ThresholdLine ${{ parameters.thresholdLine }}
-ThresholdBranch ${{ parameters.thresholdBranch }}
-Mode ${{ parameters.mode }}
-Latest
failOnStderr: false