-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
PowerShell task should configure logging streams #15069
PowerShell task should configure logging streams #15069
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, but I'll leave it to @anatolybolshakov for the final approval.
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Commenter does not have sufficient privileges for PR 15069 in repo microsoft/azure-pipelines-tasks |
@EzzhevNikita I pushed a fix for the failing tests. Would you mind kicking off another run? |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for contribution!
Could you please take a look at the quick comment above?
@anatolybolshakov I have updated the task version number as requested, thanks for the feedback! Who else needs to sign off before we can merge? |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM and please take a look at the comment.
Also tested these changes manually, found no issues.
Link to the related test pipeline: https://v-alsmo.visualstudio.com/Test%20Playground/_build/results?buildId=1316&view=results
Sorry about the delay. I had to focus on another project for the past month. @anatolybolshakov I have made the requested changes. @alexander-smolyakov could we kick off another /azp run? |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Tested it locally with different preference values - works fine for me also.
@bradselw just one final comment - could you please bump task version to 2.194.0 - since for 193 sprint tasks are already shipped to be rolled out? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@anatolybolshakov done. What are the next steps for getting this rolled out? |
PR to update the docs: MicrosoftDocs/azure-devops-docs#11207 @anatolybolshakov, @alexander-smolyakov what are the next steps here? |
@bradselw thanks! We are proceeding with merging at the moment |
/azp run |
Azure Pipelines successfully started running 4 pipeline(s). |
Thanks @anatolybolshakov. When will this become available broadly? I am trying to decide when to merge the changes to the docs. |
Task name: PowerShellV2
Description: PowerShell has several output streams, many of which are used for logging. PowerShell supports different actions when objects are written to each of these streams, such as stopping execution, printing a message, or ignoring it. For example, the
Stop
action tells PowerShell to display a message and stop execution.While actions can be specified in scripts, a more common pattern is for the caller to specify the preferred "verbosity" of the script by setting the corresponding "preference" variable to a default action, to be used in cases where one is not already provided. For example, the PowerShellV2 task does this with the error stream: It allows the user to select what action they want to be taken (i.e.
Stop
,Continue
, orSilentlyContinue
) when an object is written to the error stream, by setting the$ErrorActionPreference
variable at the beginning of the script.Unfortunately, the PowerShellV2 task currently only gives users control over the error stream. All other streams are handled by PowerShell's default settings, which are rather limited and not suited for automation. Specifically, by default PowerShell suppresses the information and verbose streams, both of which provide crucial logging. The information stream is "intended to provide messages that help a user understand what a script is doing", while the verbose stream is "intended for messages that help users troubleshoot commands as they are run ... from a script." The PowerShellV2 task is meant to run on an agent in an automated environment that the user has limited access to, which makes the logging provided by these streams all the more vital.
This pull request addresses this gap in the PowerShellV2 task's logging in the follow ways:
System.Debug
variable is set to true. This is an established pattern leveraged across other tasks.Documentation changes required: No.
Added unit tests: Yes, updated existing unit tests.
Attached related issue: Yes: #15053
Checklist: