MicrosoftPremier / VstsExtensions

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

Any chance to use Build Quality Check with a docker log? #234

Closed StefanVonFunk closed 3 months ago

StefanVonFunk commented 3 months ago

Hi all,

I added the Build Quality Check to my pipeline and it ran through all my tasks. Unfortunately it decided that no task contains a warning at all, allthough we had 4 warnings in the log file:

The log file of the task "solution-build": 2024-02-27T12:25:31.6225594Z #23 136.5 Build succeeded. 2024-02-27T12:25:31.6225922Z #23 136.5 2024-02-27T12:25:31.6226402Z #23 136.5 /project/src/Business/Assembler/DeleteAssembler.cs(72,17): warning CS1718: Comparison made to same variable; did you mean to compare something else? 2024-02-27T12:25:31.6227495Z #23 136.5 /project/src/Business/Assembler/DeleteAssembler.cs(74,17): warning CS1717: Assignment made to same variable; did you mean to assign something else? 2024-02-27T12:25:31.6228569Z #23 136.5 /project/src/Business/Assembler/DeleteAssembler.cs(72,13): warning CS0162: Unreachable code detected 2024-02-27T12:25:31.6229289Z #23 136.5 /project/src/Business/Assembler/DeleteAssembler.cs(70,13): warning SA1005: Single line comment should begin with a space. (https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1005.md) 2024-02-27T12:25:31.6229794Z #23 136.5 4 Warning(s) 2024-02-27T12:25:31.6230009Z #23 136.5 0 Error(s) 2024-02-27T12:25:31.6230209Z #23 136.5 2024-02-27T12:25:31.6230449Z #23 136.5 Time Elapsed 00:02:15.92 2024-02-27T12:25:31.7425579Z #23 DONE 136.7s

The result in Build Quality Check: 2024-02-26T12:09:33.7690084Z Counting warnings from tasks: 2024-02-26T12:09:33.7690717Z - Build solution-build 2024-02-26T12:09:33.7703089Z Waiting for log information of task 'Build solution-build'... 2024-02-26T12:09:33.8675874Z Running generic task log analysis... 2024-02-26T12:09:33.8683014Z Total warnings: 0, Selected warnings: 0

So, this task "solution-build" consists of a dockerfile build containing the "dotnet build" command in it. So how can we access the log file from the docker build to the build quality check task? Do we need to publish the log file somewhere? Or is it not possible to use Build Quality check with a docker container?

Thanks for help and kind regards, Stefan

StefanVonFunk commented 3 months ago

Here the yaml code for the task with the docker:

ReneSchumacher commented 3 months ago

Hi @StefanVonFunk,

when using a (multi-stage) docker build, the process becomes something like a black box for Azure Pipelines. All it can see it the output from the docker task itself. Since the task does not publish warnings of any internal commands as pipeline issues, they are not visible to BQC by default. I assume that you pipeline summary also does not show any warnings.

The only workaround is to apply some custom warningSelectors. E.g., the following selector would match the warnings above (and more of the same format): /\(\d+,\d+\): warning/i. It looks for the (line number, column): warning part of the log lines and assumes that every match is an individual warning.

StefanVonFunk commented 3 months ago

Thanks a lot.

That worked fine for me.

Kind regards.