How to hide redundant argument values appear in the console, when using Powershell @2?

69 views Asked by At

I have a pipeline which is running a series of Powershell@2 task. Since last Friday, I started to see the output different from before. Please check the current output below: enter image description here

Previously, only arguments in the format of a line (line 37, marked in blue) were displayed. But now, the arguments are listed in sequence and separated by line breaks (starts from line 10 to line 36).

What I can see is the version have been upgraded from 2.231.0 to 2.231.4, but I am not sure if it is the root cause... May I ask what cause this change? And what should I do to restore the old display format?

I try to make changes to Powershell version. However, it is impossible - according to https://learn.microsoft.com/en-us/azure/devops/pipelines/tasks/reference/powershell-v2?view=azure-pipelines , it is based on the agent.

1

There are 1 answers

2
Andy Li-MSFT On BEST ANSWER

I can reproduce the issue. PowerShell tasks appear to have been updated recently.

Except that the output is different from before, it doesn't seem to affect usage. If you want to know the root cause, you can try to check source code here : Tasks/PowerShellV2.

However, if you want to see the old display format, then you can use the old version (2.231.0) of the task by specifying the full version number of a task after the @ sign (example: [email protected]). See Task versions for details.

For example:

- task: [email protected]
  inputs:
    filePath: '$(Build.SourcesDirectory)\test.ps1'
    arguments: '-arg1 Test01 -arg2 Test02 -arg3 Test03 -arg4 Test04 -arg5 Test05'

enter image description here