diff --git a/src/WebJobs.Script/Environment/EnvironmentExtensions.cs b/src/WebJobs.Script/Environment/EnvironmentExtensions.cs
index 4f48232b45..3793aa4174 100644
--- a/src/WebJobs.Script/Environment/EnvironmentExtensions.cs
+++ b/src/WebJobs.Script/Environment/EnvironmentExtensions.cs
@@ -462,6 +462,15 @@ public static bool IsLogicApp(this IEnvironment environment)
return !string.IsNullOrEmpty(appKind) && appKind.Contains(ScriptConstants.WorkFlowAppKind);
}
+ ///
+ /// Gets if codeful mode is enabled for Logic App app kind.
+ ///
+ public static bool IsLogicAppCodefulModeEnabled(this IEnvironment environment)
+ {
+ bool.TryParse(environment.GetEnvironmentVariable(EnvironmentSettingNames.LogicAppCodefulModeEnabled), out bool logicAppCodefulModeEnabled);
+ return logicAppCodefulModeEnabled;
+ }
+
///
/// Gets if runtime environment needs multi language.
///
diff --git a/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs b/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs
index cea779be92..91cb7a6428 100644
--- a/src/WebJobs.Script/Environment/EnvironmentSettingNames.cs
+++ b/src/WebJobs.Script/Environment/EnvironmentSettingNames.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.
namespace Microsoft.Azure.WebJobs.Script
@@ -155,6 +155,8 @@ public static class EnvironmentSettingNames
public const string AppKind = "APP_KIND";
+ public const string LogicAppCodefulModeEnabled = "WORKFLOW_CODEFUL_ENABLED";
+
public const string DrainOnApplicationStopping = "FUNCTIONS_ENABLE_DRAIN_ON_APP_STOPPING";
}
}
diff --git a/src/WebJobs.Script/Host/ScriptHost.cs b/src/WebJobs.Script/Host/ScriptHost.cs
index 00ae152101..9ce4368c22 100644
--- a/src/WebJobs.Script/Host/ScriptHost.cs
+++ b/src/WebJobs.Script/Host/ScriptHost.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;
@@ -803,7 +803,7 @@ internal async Task> GetFunctionDescriptorsAsync(
Collection functionDescriptors = new Collection();
if (!cancellationToken.IsCancellationRequested)
{
- bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = true;
+ bool throwOnWorkerRuntimeAndPayloadMetadataMismatch = !(_environment.IsLogicApp() && _environment.IsLogicAppCodefulModeEnabled());
// this dotnet isolated specific logic is temporary to ensure in-proc payload compatibility with "dotnet-isolated" as the FUNCTIONS_WORKER_RUNTIME value.
if (string.Equals(workerRuntime, RpcWorkerConstants.DotNetIsolatedLanguageWorkerName, StringComparison.OrdinalIgnoreCase) && !_environment.IsPlaceholderModeEnabled())
{
diff --git a/src/WebJobs.Script/Utility.cs b/src/WebJobs.Script/Utility.cs
index 731b45b4a8..4bca723f07 100644
--- a/src/WebJobs.Script/Utility.cs
+++ b/src/WebJobs.Script/Utility.cs
@@ -1034,7 +1034,8 @@ public static void ValidateRetryOptions(RetryOptions
// WORKER_INDEXING_DISABLED contains the customers app name worker indexing is then disabled for that customer only
public static bool CanWorkerIndex(IEnumerable workerConfigs, IEnvironment environment, FunctionsHostingConfigOptions functionsHostingConfigOptions)
{
- if (environment.IsLogicApp())
+ // NOTE(apseth): Enabling the worker indexing for Logic Apps with codeful mode enabled.
+ if (environment.IsLogicApp() && !environment.IsLogicAppCodefulModeEnabled())
{
return false;
}
diff --git a/test/WebJobs.Script.Tests/UtilityTests.cs b/test/WebJobs.Script.Tests/UtilityTests.cs
index 6de634d6aa..a844003f1a 100644
--- a/test/WebJobs.Script.Tests/UtilityTests.cs
+++ b/test/WebJobs.Script.Tests/UtilityTests.cs
@@ -960,6 +960,31 @@ private void VerifyCanWorkerIndexUtility(bool workerIndexingFeatureFlag, bool wo
Assert.Equal(expected, workerShouldIndex);
}
+ [Theory]
+ [InlineData(true, true, true)]
+ [InlineData(true, false, false)]
+ public void WorkerIndexingDecisionLogic_LogicApps(bool workerIndexingFeatureFlag, bool enableIndexingForCodeful, bool expected)
+ {
+ var testEnv = new TestEnvironment();
+ testEnv.SetEnvironmentVariable(EnvironmentSettingNames.FunctionWorkerRuntime, RpcWorkerConstants.DotNetExecutableName);
+ testEnv.SetEnvironmentVariable(EnvironmentSettingNames.AppKind, ScriptConstants.WorkFlowAppKind);
+
+ if (workerIndexingFeatureFlag)
+ {
+ testEnv.SetEnvironmentVariable(EnvironmentSettingNames.AzureWebJobsFeatureFlags, ScriptConstants.FeatureFlagEnableWorkerIndexing);
+ }
+
+ if (enableIndexingForCodeful)
+ {
+ testEnv.SetEnvironmentVariable(EnvironmentSettingNames.LogicAppCodefulModeEnabled, "true");
+ }
+
+ RpcWorkerConfig workerConfig = new RpcWorkerConfig() { Description = TestHelpers.GetTestWorkerDescription("dotnet", "none", true) };
+
+ bool workerShouldIndex = Utility.CanWorkerIndex(new List() { workerConfig }, testEnv, new FunctionsHostingConfigOptions());
+ Assert.Equal(expected, workerShouldIndex);
+ }
+
[Theory]
[InlineData(true, false)]
[InlineData(false, false)]