Skip to content

Commit 65affe4

Browse files
Francisco-GaminoazfuncghahmedmuhsinAzureFunctionsJavasatvu
authored
Cherry-pick changes to release/4.38: Update Java Worker Version to 2.18.1 #10820, Platform release channel bundles resolution fix and additional logging #10921, Update PowerShell worker for patch #10924 (#10926)
* Update version to 4.1038.300 * Clear release notes * Update Java Worker Version to 2.18.1 (#10820) Co-authored-by: AzureFunctionsJava <[email protected]> * Platform release channel bundles resolution fix and additional logging (#10921) * Update PowerShell worker for patch (#10924) * Cherry-pick test changes for PS worker * Update tests for pwsh7.4 default --------- Co-authored-by: Andy Staples <[email protected]> * Correct ItemGroup issue * PS worker version --------- Co-authored-by: Azure Functions Release <[email protected]> Co-authored-by: Ahmed Muhsin <[email protected]> Co-authored-by: AzureFunctionsJava <[email protected]> Co-authored-by: sarah <[email protected]> Co-authored-by: andystaples <[email protected]> Co-authored-by: Jacob Viau <[email protected]> Co-authored-by: Andy Staples <[email protected]>
1 parent 00772e9 commit 65affe4

File tree

9 files changed

+52
-38
lines changed

9 files changed

+52
-38
lines changed

eng/build/Workers.Java.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project>
22

33
<ItemGroup>
4-
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.18.0" />
4+
<PackageReference Include="Microsoft.Azure.Functions.JavaWorker" Version="2.18.1" />
55
</ItemGroup>
66

77
</Project>

eng/build/Workers.Powershell.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<ItemGroup>
44
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.0" Version="4.0.3148" />
55
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.4025" />
6-
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4134" />
6+
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.4206" />
77
</ItemGroup>
88

99
<Target Name="RemovePowershellWorkerRuntimes" BeforeTargets="AssignTargetPaths" Condition="'$(RuntimeIdentifier)' != ''">

release_notes.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
### Release notes
2-
3-
<!-- Please add your release notes in the following format:
4-
- My change description (#PR)
5-
-->
6-
- Fixing default DateTime bug with TimeZones in TimerTrigger (#10906)
7-
- Fixing invalid DateTimes in status blobs when invoking via portal (#10916)
1+
### Release notes
2+
3+
<!-- Please add your release notes in the following format:
4+
- My change description (#PR)
5+
-->
6+
- Update Java Worker Version to [2.18.1](https://github.com/Azure/azure-functions-java-worker/releases/tag/2.18.1)
7+
- Bug fix for platform release channel bundles resolution casing issue and additional logging (#10921)
8+
- Update PowerShell worker to [4.0.4206](https://github.com/Azure/azure-functions-powershell-worker/releases/tag/v4.0.4206)

src/Directory.Version.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project>
22
<PropertyGroup>
3-
<VersionPrefix>4.1038.200</VersionPrefix>
3+
<VersionPrefix>4.1038.300</VersionPrefix>
44
<UpdateBuildNumber>true</UpdateBuildNumber>
55
</PropertyGroup>
66
</Project>

src/WebJobs.Script/ExtensionBundle/ExtensionBundleManager.cs

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
using System.Linq;
99
using System.Net.Http;
1010
using System.Threading.Tasks;
11-
using Grpc.Net.Client.Balancer;
1211
using Microsoft.Azure.WebJobs.Script.Config;
1312
using Microsoft.Azure.WebJobs.Script.Configuration;
1413
using Microsoft.Azure.WebJobs.Script.Diagnostics.Extensions;
@@ -294,7 +293,7 @@ internal string FindBestVersionMatch(VersionRange versionRange, IEnumerable<stri
294293
return matchingVersion?.ToString();
295294
}
296295

297-
private NuGetVersion ResolvePlatformReleaseChannelVersion(IList<NuGetVersion> orderedByDescBundles) => _platformReleaseChannel switch
296+
private NuGetVersion ResolvePlatformReleaseChannelVersion(IList<NuGetVersion> orderedByDescBundles) => _platformReleaseChannel.ToUpper() switch
298297
{
299298
ScriptConstants.StandardPlatformChannelNameUpper or ScriptConstants.ExtendedPlatformChannelNameUpper => GetStandardOrExtendedBundleVersion(orderedByDescBundles),
300299
ScriptConstants.LatestPlatformChannelNameUpper or "" => GetLatestBundleVersion(orderedByDescBundles),
@@ -306,27 +305,36 @@ internal string FindBestVersionMatch(VersionRange versionRange, IEnumerable<stri
306305
// However, Functions and Rapid Update should treat Standard and Extended the same, resolving to n-1.
307306
private NuGetVersion GetStandardOrExtendedBundleVersion(IList<NuGetVersion> orderedByDescBundlesList)
308307
{
308+
var latest = orderedByDescBundlesList.FirstOrDefault();
309+
309310
if (orderedByDescBundlesList.Count > 1)
310311
{
312+
var previous = orderedByDescBundlesList[1];
313+
_logger.LogInformation("Applying platform release channel configuration {platformReleaseChannelName}. Previous bundle version {previous} will be used instead of latest version {latest}.", _platformReleaseChannel, previous, latest);
314+
311315
// These channels should resolve to the version prior to latest. This list is in descending order, which makes latest [0], and prior-to-latest [1].
312-
return orderedByDescBundlesList[1];
316+
return previous;
313317
}
314318

315319
// keep the latest version, log a notice
316-
var latest = orderedByDescBundlesList.FirstOrDefault();
317-
_logger.LogInformation("Unable to apply platform release channel configuration {platformReleaseChannelName}. Only one matching bundle version is available. {latestBundleVersion} will be used", _platformReleaseChannel, latest);
320+
_logger.LogWarning("Unable to apply platform release channel configuration {platformReleaseChannelName}. Only one matching bundle version is available. {latestBundleVersion} will be used", _platformReleaseChannel, latest);
318321
return latest;
319322
}
320323

321-
private static NuGetVersion GetLatestBundleVersion(IList<NuGetVersion> orderedByDescBundlesList)
324+
private NuGetVersion GetLatestBundleVersion(IList<NuGetVersion> orderedByDescBundlesList)
322325
{
323-
return orderedByDescBundlesList.FirstOrDefault();
326+
var latest = orderedByDescBundlesList.FirstOrDefault();
327+
if (string.Equals(_platformReleaseChannel.ToUpper(), ScriptConstants.LatestPlatformChannelNameUpper))
328+
{
329+
_logger.LogInformation("Applying platform release channel configuration {platformReleaseChannelName}. Bundle version {latest} will be used", _platformReleaseChannel, latest);
330+
}
331+
return latest;
324332
}
325333

326334
private NuGetVersion HandleUnknownPlatformReleaseChannelName(IList<NuGetVersion> orderedByDescBundlesList)
327335
{
328336
var latest = GetLatestBundleVersion(orderedByDescBundlesList);
329-
_logger.LogInformation("Unknown platform release channel name {platformReleaseChannelName}. The latest bundle version, {latestBundleVersion}, will be used.", _platformReleaseChannel, latest);
337+
_logger.LogWarning("Unknown platform release channel name {platformReleaseChannelName}. The latest bundle version, {latestBundleVersion}, will be used.", _platformReleaseChannel, latest);
330338
return latest;
331339
}
332340

test/WebJobs.Script.Tests.Integration/WebHostEndToEnd/SpecializationE2ETests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ public async Task StartAsync_SetsCorrectActiveHost_RefreshesLanguageWorkerOption
539539
// We want it to start first, but finish last, so unstick it in a couple seconds.
540540
Task ignore = Task.Delay(3000).ContinueWith(_ => _pauseAfterStandbyHostBuild.Release());
541541

542-
var expectedPowerShellVersion = "7.2";
542+
var expectedPowerShellVersion = "7.4";
543543
IWebHost host = builder.Build();
544544
var scriptHostService = host.Services.GetService<WebJobsScriptHostService>();
545545
var channelFactory = host.Services.GetService<IRpcWorkerChannelFactory>();

test/WebJobs.Script.Tests/ExtensionBundle/ExtensionBundleManagerTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,11 @@ public void LimitMaxVersion(string versionRange, string hostConfigVersion, strin
418418
[InlineData(ScriptConstants.StandardPlatformChannelNameUpper, "[4.*, 5.0.0)", "4.1.0", "4.1.0")]
419419
[InlineData(ScriptConstants.ExtendedPlatformChannelNameUpper, "[4.*, 5.0.0)", "4.1.0", "4.1.0")]
420420
[InlineData(ScriptConstants.LatestPlatformChannelNameUpper, "[4.*, 5.0.0)", null, "4.3.0")]
421+
[InlineData("latest", "[4.*, 5.0.0)", null, "4.3.0")]
421422
[InlineData(ScriptConstants.StandardPlatformChannelNameUpper, "[4.*, 5.0.0)", null, "4.2.0")]
423+
[InlineData("standard", "[4.*, 5.0.0)", null, "4.2.0")]
422424
[InlineData(ScriptConstants.ExtendedPlatformChannelNameUpper, "[4.*, 5.0.0)", null, "4.2.0")]
425+
[InlineData("extended", "[4.*, 5.0.0)", null, "4.2.0")]
423426
public void WhenPlatformReleaseChannelSet_ExpectedVersionChosen(string platformReleaseChannelName, string versionRange, string hostConfigMaxVersion, string expectedVersion)
424427
{
425428
var range = VersionRange.Parse(versionRange);
@@ -462,7 +465,7 @@ public void StandardExtendedReleaseChannel_OneBundleVersionOnDisk_Handled(string
462465
var expected = "4.20.0";
463466

464467
var loggedString = $"Unable to apply platform release channel configuration {platformReleaseChannelName}. Only one matching bundle version is available. {expected} will be used";
465-
var mockLogger = GetVerifiableMockLogger(loggedString);
468+
var mockLogger = GetVerifiableMockLogger(loggedString, LogLevel.Warning);
466469
var mockLoggerFactory = new Mock<ILoggerFactory>();
467470
mockLoggerFactory.Setup(f => f.CreateLogger(It.IsAny<string>())).Returns(() => mockLogger.Object);
468471

@@ -485,7 +488,7 @@ public void UnknownReleaseChannel_ExpectedVersionChosen()
485488

486489
var incorrectChannelName = "someIncorrectReleaseChannelName";
487490
var loggedString = $"Unknown platform release channel name {incorrectChannelName}. The latest bundle version, {expected}, will be used.";
488-
var mockLogger = GetVerifiableMockLogger(loggedString);
491+
var mockLogger = GetVerifiableMockLogger(loggedString, LogLevel.Warning);
489492
var mockLoggerFactory = new Mock<ILoggerFactory>();
490493
mockLoggerFactory.Setup(f => f.CreateLogger(It.IsAny<string>())).Returns(() => mockLogger.Object);
491494

@@ -573,12 +576,12 @@ private IList<string> GetLargeVersionsList()
573576
{ "3.7.0", "3.10.0", "3.11.0", "3.15.0", "3.14.0", "2.16.0", "3.13.0", "3.12.0", "3.9.1", "2.12.1", "2.18.0", "3.16.0", "2.19.0", "3.17.0", "4.0.2", "2.20.0", "3.18.0", "4.1.0", "4.2.0", "2.21.0", "3.19.0", "3.19.2", "4.3.0", "3.20.0" };
574577
}
575578

576-
private Mock<ILogger> GetVerifiableMockLogger(string stringToVerify)
579+
private Mock<ILogger> GetVerifiableMockLogger(string stringToVerify, LogLevel logLevel)
577580
{
578581
var mockLogger = new Mock<ILogger>();
579582
mockLogger
580583
.Setup(x => x.Log(
581-
LogLevel.Information,
584+
logLevel,
582585
It.IsAny<EventId>(),
583586
It.Is<It.IsAnyType>((v, t) => v.ToString().Contains(stringToVerify)),
584587
It.IsAny<Exception>(),

test/WebJobs.Script.Tests/ScriptHostTests.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,11 @@ public async Task Initialize_WithLatestSiteExtensionVersion_LogsWarning()
453453
[InlineData("node", "~3", "~8", "node-~8")]
454454
[InlineData("node", "~2", "~8", "node-~8")]
455455
[InlineData("powershell", "~2", "", "powershell")]
456-
[InlineData("powershell", "~2", "~7", "powershell-~7")]
456+
[InlineData("powershell", "~2", "7.4", "powershell-7.4")]
457457
[InlineData("java", "~3", "", "java")]
458+
#if NET6_0
459+
[InlineData("powershell", "~2", "~7", "powershell-~7")] // pwsh 7.0 only available for net6 host.
460+
#endif
458461
public async Task Initialize_WithRuntimeAndWorkerVersion_ReportRuntimeToMetricsTable(
459462
string functionsWorkerRuntime,
460463
string functionsExtensionVersion,

test/WebJobs.Script.Tests/Workers/Rpc/RpcWorkerConfigFactoryTests.cs

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -154,25 +154,24 @@ public void DefaultWorkerConfigs_Overrides_DefaultWorkerRuntimeVersion_AppSettin
154154
var scriptSettingsManager = new ScriptSettingsManager(config);
155155
var testLogger = new TestLogger("test");
156156
_testEnvironment.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebsitePlaceholderMode, "1");
157-
using (var variables = new TestScopedSettings(scriptSettingsManager, testEnvVariables))
158-
{
159-
var configFactory = new RpcWorkerConfigFactory(config, testLogger, _testSysRuntimeInfo, _testEnvironment, new TestMetricsLogger(), _testWorkerProfileManager);
160-
var workerConfigs = configFactory.GetConfigs();
161-
var pythonWorkerConfig = workerConfigs.FirstOrDefault(w => w.Description.Language.Equals("python", StringComparison.OrdinalIgnoreCase));
162-
var powershellWorkerConfig = workerConfigs.FirstOrDefault(w => w.Description.Language.Equals("powershell", StringComparison.OrdinalIgnoreCase));
163-
Assert.Equal(5, workerConfigs.Count);
164-
Assert.NotNull(pythonWorkerConfig);
165-
Assert.NotNull(powershellWorkerConfig);
166-
Assert.Equal("3.8", pythonWorkerConfig.Description.DefaultRuntimeVersion);
167-
Assert.Equal("7.2", powershellWorkerConfig.Description.DefaultRuntimeVersion);
168-
}
157+
158+
using var variables = new TestScopedSettings(scriptSettingsManager, testEnvVariables);
159+
var configFactory = new RpcWorkerConfigFactory(config, testLogger, _testSysRuntimeInfo, _testEnvironment, new TestMetricsLogger(), _testWorkerProfileManager);
160+
var workerConfigs = configFactory.GetConfigs();
161+
var pythonWorkerConfig = workerConfigs.FirstOrDefault(w => w.Description.Language.Equals("python", StringComparison.OrdinalIgnoreCase));
162+
var powershellWorkerConfig = workerConfigs.FirstOrDefault(w => w.Description.Language.Equals("powershell", StringComparison.OrdinalIgnoreCase));
163+
Assert.Equal(5, workerConfigs.Count);
164+
Assert.NotNull(pythonWorkerConfig);
165+
Assert.NotNull(powershellWorkerConfig);
166+
Assert.Equal("3.8", pythonWorkerConfig.Description.DefaultRuntimeVersion);
167+
Assert.Equal("7.4", powershellWorkerConfig.Description.DefaultRuntimeVersion);
169168
}
170169

171170
[Fact]
172171
public void DefaultWorkerConfigs_Overrides_VersionAppSetting()
173172
{
174173
var testEnvironment = new TestEnvironment();
175-
testEnvironment.SetEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME_VERSION", "7.2");
174+
testEnvironment.SetEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME_VERSION", "7.4");
176175
testEnvironment.SetEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME", "powerShell");
177176
var configBuilder = ScriptSettingsManager.CreateDefaultConfigurationBuilder();
178177
var config = configBuilder.Build();
@@ -183,7 +182,7 @@ public void DefaultWorkerConfigs_Overrides_VersionAppSetting()
183182
var powershellWorkerConfig = workerConfigs.FirstOrDefault(w => w.Description.Language.Equals("powershell", StringComparison.OrdinalIgnoreCase));
184183
Assert.Equal(1, workerConfigs.Count);
185184
Assert.NotNull(powershellWorkerConfig);
186-
Assert.Equal("7.2", powershellWorkerConfig.Description.DefaultRuntimeVersion);
185+
Assert.Equal("7.4", powershellWorkerConfig.Description.DefaultRuntimeVersion);
187186
}
188187

189188
[Theory]

0 commit comments

Comments
 (0)