MicrosoftPremier / VstsExtensions

Documentation and issue tracking for Microsoft Premier Services Visual Studio Team Services Extensions
MIT License
59 stars 14 forks source link

YAML always seems to use coverageFailOption: 'build' instead of 'fixed' #134

Closed dloukola closed 3 years ago

dloukola commented 3 years ago

I'm using this following yaml and I can't seem to get it to fail the build with a fixed percentage, it always does it by previous build. Therefore if I had 100% coverage and the next build is 95% coverage, it fails, even though my coverage threshold is 80%.

My goal here is to fail the build if coverage is < 80% and if the build state transitions from 90% to 85%, this should not fail the build.

Any ideas?

dloukola commented 3 years ago

There's definitely some sort of bug here with some combination of flags, but I got it working for my needs.

ReneSchumacher commented 3 years ago

Hi @dloukola,

I'm glad you found a solution for the issue. I still would like to see, what kind of parameter combination might have resulted in that behavior.

Is that yaml you included in your first message really the one you used in your pipeline? In essence, you only need to specify checkCoverage: true, coverageFailOption: fixed, coverageType: lines, and coverageThreshold: 80 in your case. All other options are ignored, when you configure a fixed threshold.

Could you perhaps share the final yaml that resolved the issue?

Thanks, René

dloukola commented 3 years ago

I went to grab you the code and found that my coverageFailOption was always set to build :( I must have been on the incorrect branch when I was editing. Thanks for replying. FYI: the extension throws a warning if you don't specify a value for coverageVariance even though I have no interest in using it at this time. My final yaml is:


- task: BuildQualityChecks@8
  displayName: 'Check build quality'
  inputs:
    checkCoverage: true
    coverageFailOption: fixed
    coverageType: lines
    coverageThreshold: '80'
    coverageVariance: '0'
ReneSchumacher commented 3 years ago

Thanks for the feedback! We'll remove the unnecessary warning when coverageVariance is not specified. You can basically ignore it as the task automatically assumes a variance of zero.