diff --git a/release_notes.md b/release_notes.md index 7f2d3d806a..912ee06406 100644 --- a/release_notes.md +++ b/release_notes.md @@ -6,4 +6,4 @@ - Add JitTrace Files for v4.1042 - Updating OTel related nuget packages (#11216) - Moving to version 1.5.7 of Microsoft.Azure.AppService.Middleware.Functions (https://github.com/Azure/azure-functions-host/pull/11231) - +- Mark Failed Container Specialization as Fatal (https://github.com/Azure/azure-functions-host/pull/11250) diff --git a/src/WebJobs.Script.WebHost/Management/AtlasInstanceManager.cs b/src/WebJobs.Script.WebHost/Management/AtlasInstanceManager.cs index a4cf1948dc..720eec0f84 100644 --- a/src/WebJobs.Script.WebHost/Management/AtlasInstanceManager.cs +++ b/src/WebJobs.Script.WebHost/Management/AtlasInstanceManager.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; @@ -276,6 +276,11 @@ await _runFromPackageHandler.ApplyRunFromPackageContext(pkgContext, options.Scri _logger.LogWarning($"Failed to {nameof(_runFromPackageHandler.ApplyRunFromPackageContext)}. Attempting to use local disk instead"); await _runFromPackageHandler.ApplyRunFromPackageContext(pkgContext, options.ScriptPath, false); } + else if (!blobContextApplied && !azureFilesMounted) + { + await _meshServiceClient.NotifyHealthEvent(ContainerHealthEventType.Fatal, this.GetType(), + $"Failed to mount Azure File Share and failed to {nameof(_runFromPackageHandler.ApplyRunFromPackageContext)}"); + } } else if (pkgContext.IsRunFromLocalPackage()) { diff --git a/test/WebJobs.Script.Tests.Integration/Management/InstanceManagerTests.cs b/test/WebJobs.Script.Tests.Integration/Management/InstanceManagerTests.cs index 1fdae1cdcf..c327800496 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; @@ -1190,6 +1190,10 @@ public async Task Falls_Back_To_Local_Disk_If_Azure_Files_Unavailable_Only_If_Az .Setup(r => r.ApplyRunFromPackageContext(It.IsAny(), It.IsAny(), false, false)).ReturnsAsync(false); // return false to trigger failure + // setup notifyhealth method + _meshServiceClientMock.Setup(m => m.NotifyHealthEvent(ContainerHealthEventType.Fatal, + It.IsAny(), It.IsAny())).Returns(Task.CompletedTask); + // There will be no 2nd attempt since azure files mounting failed. var optionsFactory = new TestOptionsFactory(new ScriptApplicationHostOptions() { ScriptPath = scriptPath });