Skip to content

Commit

Permalink
Issue a warning on PowerShell 6 end-of-life (#540)
Browse files Browse the repository at this point in the history
* Add PowerShell6EndOfLifeWarning message

* Log the warning

* Move logging the message to PowerShellManager

* Add "Your Function app is still supported"

* Fix unit test
  • Loading branch information
AnatoliB authored Sep 15, 2020
1 parent 13e92f7 commit 3f4a365
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/PowerShell/PowerShellManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ internal void Initialize()
{
if (!_runspaceInited)
{
Logger.Log(isUserOnlyLog: true, LogLevel.Warning, PowerShellWorkerStrings.PowerShell6EndOfLifeWarning);

// Register stream events
RegisterStreamEvents();
// Deploy functions from the function App
Expand Down
3 changes: 3 additions & 0 deletions src/resources/PowerShellWorkerStrings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -319,4 +319,7 @@
<data name="SettingCurrentDirectory" xml:space="preserve">
<value>Setting current directory to '{0}'.</value>
</data>
<data name="PowerShell6EndOfLifeWarning" xml:space="preserve">
<value>The Function app uses PowerShell Core 6. Your Function app is still supported, but this version of PowerShell reached end of life, so it is strongly recommended that you migrate the Function app to PowerShell 7. For more details, see https://aka.ms/functions-powershell-6-to-7.</value>
</data>
</root>
3 changes: 1 addition & 2 deletions test/Unit/PowerShell/PowerShellManagerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -344,8 +344,7 @@ public void PSManagerCtorRunsProfileByDefault()
s_testLogger.FullLog.Clear();
NewTestPowerShellManager(s_testLogger);

Assert.Single(s_testLogger.FullLog);
Assert.Equal($"Trace: No 'profile.ps1' is found at the function app root folder: {FunctionLoader.FunctionAppRootPath}.", s_testLogger.FullLog[0]);
Assert.Contains($"Trace: No 'profile.ps1' is found at the function app root folder: {FunctionLoader.FunctionAppRootPath}.", s_testLogger.FullLog);
}

[Fact]
Expand Down

0 comments on commit 3f4a365

Please sign in to comment.