diff --git a/release_notes.md b/release_notes.md index c5d38cf64a..7df13bb969 100644 --- a/release_notes.md +++ b/release_notes.md @@ -5,3 +5,4 @@ --> - Add JitTrace Files for v4.1046 - Update Java Worker Version to [2.19.4](https://github.com/Azure/azure-functions-java-worker/releases/tag/2.19.4) +- Logging environment value of LocalSitePackagesPath in RunFromPackageHandler (#11541) \ No newline at end of file diff --git a/src/WebJobs.Script.WebHost/Management/LinuxSpecialization/RunFromPackageHandler.cs b/src/WebJobs.Script.WebHost/Management/LinuxSpecialization/RunFromPackageHandler.cs index 104c044e5a..8d1dd3bb0d 100644 --- a/src/WebJobs.Script.WebHost/Management/LinuxSpecialization/RunFromPackageHandler.cs +++ b/src/WebJobs.Script.WebHost/Management/LinuxSpecialization/RunFromPackageHandler.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; @@ -49,10 +49,11 @@ public async Task ApplyRunFromPackageContext(RunFromPackageContext pkgCont // So extracting to /home/site/wwwroot can interfere with other running instances // Instead extract to localSitePackagesPath and bind to /home/site/wwwroot // home will continue to point to azure file share - var localSitePackagesPath = azureFilesMounted - ? _environment.GetEnvironmentVariableOrDefault(EnvironmentSettingNames.LocalSitePackages, - EnvironmentSettingNames.DefaultLocalSitePackagesPath) - : string.Empty; + var localSitePackagesEnvValue = _environment.GetEnvironmentVariable(EnvironmentSettingNames.LocalSitePackages); + var resolvedLocalSitePackagesPath = localSitePackagesEnvValue ?? EnvironmentSettingNames.DefaultLocalSitePackagesPath; + _logger.LogDebug("Environment variable '{LocalSitePackagesEnvVarName}' value: '{LocalSitePackagesEnvValue}'. Resolved path: '{ResolvedLocalSitePackagesPath}'", EnvironmentSettingNames.LocalSitePackages, localSitePackagesEnvValue, resolvedLocalSitePackagesPath); + + var localSitePackagesPath = azureFilesMounted ? resolvedLocalSitePackagesPath : string.Empty; // download zip string filePath = await _packageDownloadHandler.Download(pkgContext); diff --git a/test/WebJobs.Script.Tests.Integration/Management/InstanceManagerTests.cs b/test/WebJobs.Script.Tests.Integration/Management/InstanceManagerTests.cs index 1fdae1cdcf..68c8dae366 100644 --- a/test/WebJobs.Script.Tests.Integration/Management/InstanceManagerTests.cs +++ b/test/WebJobs.Script.Tests.Integration/Management/InstanceManagerTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. using System; @@ -222,12 +222,13 @@ public async Task StartAssignment_Succeeds_With_NonEmpty_ScmRunFromPackage_Blob( var logs = _loggerProvider.GetAllLogMessages().Select(p => p.FormattedMessage).ToArray(); - if (logs.Length == 10) + if (logs.Length == 11) { Assert.Collection(logs, p => Assert.StartsWith("Starting Assignment", p), p => Assert.StartsWith("Applying 1 app setting(s)", p), p => Assert.EndsWith("points to an existing blob: True", p), + p => Assert.StartsWith("Environment variable 'LocalSitePackagesPath'", p), p => Assert.StartsWith("Unsquashing remote zip", p), p => Assert.StartsWith("Running: ", p), p => Assert.StartsWith("Output:", p), @@ -1606,12 +1607,13 @@ public async Task AssignInstanceAsync_Succeeds_With_NonEmpty_ScmRunFromPackage_B var logs = _loggerProvider.GetAllLogMessages().Select(p => p.FormattedMessage).ToArray(); - if (logs.Length == 10) + if (logs.Length == 11) { Assert.Collection(logs, p => Assert.StartsWith("Starting Assignment", p), p => Assert.StartsWith("Applying 1 app setting(s)", p), p => Assert.EndsWith("points to an existing blob: True", p), + p => Assert.StartsWith("Environment variable 'LocalSitePackagesPath'", p), p => Assert.StartsWith("Unsquashing remote zip", p), p => Assert.StartsWith("Running: ", p), p => Assert.StartsWith("Output:", p),