Certain PowerShell versions interpret non-errors as errors and end deployments as a failure. #6528
Closed
5 tasks done
Labels
kind/bug
This issue represents a verified problem we are committed to solving
Prerequisites
The bug
Certain versions of Windows PowerShell (5.1.17763 and later) will cause Octopus deployments to fail from non-error messages being written to the std-error stream.
What I expected to happen
Non-errors will be output at the appropriate level (progress/warning/etc), and not as a failure.
Steps to reproduce
Step 1: Go to Infrastructure > accounts > add account > azure subscription
Step 2: Fill in: Subscription ID, Tenant ID, Application ID, Application Password / Key, give it a name like
AzureAccount
Step 3: Click Save and test
Step 4 Go to
Projects
>Add Project
Step 5: Unde
Deployments
chooseProcess
Step 6: Click
Add Step
>Azure
>Run an azure Script
Step 7: In your new step fill in
Step Name
aspre-aks preview
Step 8: select
Account
as your newly createdAzureAccount
from step 2.Step 9: In the
Script
section, underInline Source Code
, add the following script:Step 10: click
Save
Step 11: Click
Add Step
>Azure
>Run an azure Script
againStep 12: In your new step fill in
Step Name
aspost-aks preview install
Step 13: select
Account
as your newly createdAzureAccount
from step 2.Step 14: In the
Script
section, underInline Source Code
, add the following script:Step 15: click
Save
Step 16: click
Create Release
Step 17: click
Save
, thenDeploy to environment
Expected Results:
Both steps pass, but
post-aks preview install
will show a warningActual Results:
Step 1 passes, but
post-aks preview install
will will throw an exception (in log exerpt section below):Screen capture
N/A
Log exerpt
Affected versions
This is independent of Octopus Version.
Certain versions of PowerShell, for example, 5.1.17763 and later will have this issue.
This behavior is an intentional change by Microsoft (link below.)
Workarounds
You would need to add
$ErrorActionPreference
= “silentlycontinue”` before the part that will cause the deployment to fail. After that point, you can change the error preference back to whatever you prefer.Links
Source ticket: https://help.octopus.com/t/is-there-a-way-to-set-the-erroractionpreference-on-calamari/25477/36
Microsoft post explaining the change: https://devblogs.microsoft.com/powershell/powershell-7-1-preview-6/#make-erroractionpreference-not-affect-stderr-output-of-native-commands
The text was updated successfully, but these errors were encountered: