MicrosoftPremier / VstsExtensions

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

BuildQualityChecks@9 doesn't offer parameter addattachment so always produces a warning #222

Closed abatishchev closed 5 months ago

abatishchev commented 9 months ago

ёDescribe the context

Describe the problem and expected behavior

Task BuildQualityChecks@9 doesn't offer a parameter addattachment (like others in the suite) so is attempt to attach one regardless what produces a warning:

##[warning]##vso[task.addattachment] is not allowed in this step due to policy restrictions. 

Task logs Run your pipeline with the following variables:

Regular logs;

Starting: Check build quality (windows_build_container)
==============================================================================
Task         : Build Quality Checks
Description  : Breaks a build based on quality metrics like number of warnings or code coverage.
Version      : 9.0.1
Author       : Microsoft
Help         : [[Docs]](https://github.com/MicrosoftPremier/VstsExtensions/blob/master/BuildQualityChecks/en-US/overview.md)
==============================================================================
Using IdentifierJobResolver
Validating build warnings policy...
Running task warnings analysis...
Counting warnings from tasks:
  - Run tests (windows_build_container)
Waiting for log information of task 'Run tests (windows_build_container)'...
Waiting for log information of task 'Run tests (windows_build_container)'...
     Running generic task log analysis...
     Total warnings: 1, Selected warnings: 1
Overall total warnings: 1
Overall selected warnings: 1
No baseline build for current branch found. Looking for builds on pull request target branch.
[WARNING] The baseline build could not be found. All policies based on the previous build will pass.
##[warning]The baseline build could not be found. All policies based on the previous build will pass.
[SUCCESS] Warnings policy passed with 1 warning(s).
Statistics generation took 0.078ms
##[warning]##vso[task.addattachment] is not allowed in this step due to policy restrictions. Please reference documentation (http://go.microsoft.com/fwlink/?LinkId=817296)
Finishing: Check build quality (windows_build_container)

Verbose logs:

ReneSchumacher commented 8 months ago

Hi @abatishchev,

I believe the issue is caused by an internal policy here at Microsoft I didn't even know existed. Since we haven't (yet) created a UI extension to show a custom result tab in the pipeline summary view, we use the task.uploadSummary logging command (see here) to publish a Markdown file. This runs a special task.addAttachment logging command, which is then blocked by our policy.

I could add a parameter to prevent the call of task.addAttachment, but that would remove the policy result from the UI. Thus, it can only be an intermediate workaround. I don't know how quickly I can add the custom result tab. Would that be okay for your team?

abatishchev commented 7 months ago

hi @ReneSchumacher, my apologies! I somehow missed an email notification about your response. Came back today to check on the status of the issue and just saw it.

I could add a parameter to prevent the call of task.addAttachment

I think it'd be fine, especially if something temporal. I personally don't need the UI/report right now, using the task to ensure that a new build produces no net new warnings.

slreznit commented 7 months ago

Have same exact issue, I want to use this BuildQualityChecks task and fix the warning

abatishchev commented 5 months ago

@ReneSchumacher gentle ping.

ReneSchumacher commented 5 months ago

@abatishchev Sorry for the delay, it's been a busy end of year and then vacation time. I have added a new parameter addAttachment to the task with the default value true. You can set it to false to disable attachment publishing. As mentioned, this does disable the UI result of the task as well as warning statistics (they are only visible in the UI). It does not affect the task result itself, though.

I'm waiting for a colleague to review my PR. Once that is done, the new version goes out to the marketplace.

ReneSchumacher commented 5 months ago

PR is completed and release is underway. I'm closing the issue now. Feel free to comment or open a new one if the solution does not fix your issue.