-
Notifications
You must be signed in to change notification settings - Fork 96
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
Preview message is written to StdErr which causes scripts using the preview message fail in pipelines #166
Comments
Writing to std.err is a very common behavior across many CLI tools. The CI should not rely on the contents in std.err. The CI should check the exit code instead: https://github.com/Azure/azure-cli#exit-codes |
Whether it is common does not make it correct. A warning is not an error it is information. The decision on how the pipeline should handle warnings, as distinct from errors, has now been removed. Azure pipelines, Microsoft's public CI tool treats any output on STDERR as an Error. Can you amend the tool to write Warnings, information and debug out to an appropriate stream so that when a developer raises a warning via your tool it is identifiable as a warning and not an error. To assume and imply that there is no distinction between a warning and an error is not a valid assumption and not a common use of the terms. Cheers |
I have had the same issue with warnings in pipelines. Latest one I've had a problem with was with the Storage account, that the name is going to change from StorageV2 to Storage
It doesn't matter if you set the name to Storage or StorageV2, this warning comes up every time and breaks the pipeline. I have reported it here: I've been told that they can replicate the issue and the ticket has been moved to the product team. |
@jiasli How about having a suppress warning (--suppress-warning) flag in the command? This can be a global parameter and framework should handle not putting warnings in case the flag is specified. This way users will know when they are taking dependency on a preview command and can explicitly suppress warnings in the scripts if they do not want the noise in the output. @sebastianrogers @pmatthews05 What do you guys think? Will this be a reasonable option for fixing the issue. |
I don't like this option as it is negating a negation. It would be best if only errors were output to the error output. We are looking at a wrapper function in PowerShell to handle it at the moment, typing this from memory so may have the odd typo. function Invoke-AzCommand() { The command to execute[string] $LastErrorActionPreference = $ErrorActionPreference |
Please find the solution at Azure/azure-devops-cli-extension#811 (comment) |
Been doing some reading and https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html seems to be the definitive link.
So it looks like it depends on if you catagorise a warning as a diagnostic, which grammatically I would not, but it does imply that similarly if a verbose or debug output was requested then the logging should definitely put it out on STD_ERR! Based on this it does appear that the script above for PowerShell or for Bash something like exec 2>&1 before the az command will be required. |
|
We have added option |
Reported on Azure-Devops extension - Azure/azure-devops-cli-extension#811
The text was updated successfully, but these errors were encountered: