-
Notifications
You must be signed in to change notification settings - Fork 748
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add input parameter to bicep build
command that allows suppressing verbosity during execution
#12653
Comments
This may or may not be related to #2334 |
It sounds like the powershell script or your CI pipeline is treating stderr as an indication that the command has failed? I would recommend instead checking the exit code to determine success or failure, and allowing stderr to be written to the normal error output channel. If you're just looking to suppress stderr, then using bicep build main.bicep --stdout 2>$null Bash: bicep build main.bicep --stdout 2>/dev/null |
Dear @anthony-c-martin , thank you for the swift reply. Let me give that a shot. :) |
So... the Bicep command really didn't like the Nethertheless - it did allow us to get past the issue. Thank you @anthony-c-martin :) If you happen to have a pointer regarding the |
@AlexanderSehr I'll start by saying that I'm not a powershell expert. Generally, there are 3 things to check when you invoke a process: stdout, stderr, exit code. My recommendation would be:
Example of the approach I followed for accomplishing something similar in C# here:
Personally I'm not a PowerShell expert, so I'd have to defer to someone else to recommend how to accomplish this in Pwsh. |
…l to fail (#709) ## Description Fixed issue where Bicep build output would cause Foreach-Parallel to fail. This unblocks - `operational-insights/workspace` - `compute/virtual-machine` Ref: Azure/bicep#12653 | Pipeline | | - | | [![avm.res.operational-insights.workspace](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operational-insights.workspace.yml/badge.svg?branch=users%2Falsehr%2FthreadingTest_2)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operational-insights.workspace.yml) | --------- Co-authored-by: Erika Gressi <56914614+eriqua@users.noreply.github.com>
Working recently on troubleshooting why something like
$templatePaths | Foreach-Object -Parallel { bicep build $_ }
would work for some Bicep templates but not for others I found out that the vebosity of thebicep build
command seems to conflict with this kind of multithreading on Linux pipeline agents (I'm not able to reproduce this locally neither on Windows nor the WSL) - consistently.The verbosity I'm referring to specifically are warnings returned by the template. For example
/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/res/operational-insights/workspace/saved-search/main.bicep(44,5) : Warning BCP037: The property "etag" is not allowed on objects of type "SavedSearchProperties". No other properties are allowed. If this is an inaccuracy in the documentation, please report it to the Bicep Team. [https://aka.ms/bicep-type-issues]
which is, unforatuntely, a false positive.What happens using the above command is, that
bicep build
starts running in a thread, it prints the warning, and then the code goes into an 'error' state without an actual error to show for. To find out that it's because of the verbosity took a while:While there is a 'workaround', that is, adding
#disable-next-line
to any line in question, there is a fair chance these issues will return each time e.g. the Bicep linter rules are updated.To solve this for cases where I'm not interested in this verbositry (e.g., when I just want to build a dozen templates to statically test them) it would be very helpful if there would be a parameter to prevent the command from trying to write anything to the output/console stream. For example
bicep build <path> --no-verbose
.The text was updated successfully, but these errors were encountered: