Skip to content

Support logicapps pwsh version setting #11105

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
- My change description (#PR)
-->
- Update Java Worker Version to [2.19.1](https://github.com/Azure/azure-functions-java-worker/releases/tag/2.19.1)
- Support `LOGIC_APPS_POWERSHELL_VERSION` when resolving powershell's `worker.config.json` for logic-app apps only. (#11105)
- Update Python Worker Version to [4.38.0](https://github.com/Azure/azure-functions-python-worker/releases/tag/4.38.0)
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ internal void AddProvider(string workerDir)

// Check if any app settings are provided for that language
var languageSection = _config.GetSection($"{RpcWorkerConstants.LanguageWorkersSectionName}:{workerDescription.Language}");
workerDescription.Arguments = workerDescription.Arguments ?? new List<string>();
workerDescription.Arguments ??= new List<string>();
GetWorkerDescriptionFromAppSettings(workerDescription, languageSection);
AddArgumentsFromAppSettings(workerDescription, languageSection);

Expand Down
1 change: 1 addition & 0 deletions src/WebJobs.Script/Workers/Rpc/RpcWorkerConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ public static class RpcWorkerConstants
public const string FunctionWorkerRuntimeVersionSettingName = "FUNCTIONS_WORKER_RUNTIME_VERSION";
public const string FunctionsWorkerProcessCountSettingName = "FUNCTIONS_WORKER_PROCESS_COUNT";
public const string FunctionsWorkerSharedMemoryDataTransferEnabledSettingName = "FUNCTIONS_WORKER_SHARED_MEMORY_DATA_TRANSFER_ENABLED";
public const string LogicAppsPowerShellVersionSettingName = "LOGIC_APPS_POWERSHELL_VERSION";

// Comma-separated list of directories where shared memory maps can be created for data transfer between host and worker.
// This will override the default directories.
Expand Down
19 changes: 15 additions & 4 deletions src/WebJobs.Script/Workers/Rpc/RpcWorkerDescription.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ private void ValidateOSPlatform(OSPlatform os)
{
if (!SupportedOperatingSystems.Any(s => s.Equals(os.ToString(), StringComparison.OrdinalIgnoreCase)))
{
throw new PlatformNotSupportedException($"OS {os.ToString()} is not supported for language {Language}");
throw new PlatformNotSupportedException($"OS {os} is not supported for language {Language}");
}
}

private void ValidateArchitecture(Architecture architecture)
{
if (!SupportedArchitectures.Any(s => s.Equals(architecture.ToString(), StringComparison.OrdinalIgnoreCase)))
{
throw new PlatformNotSupportedException($"Architecture {architecture.ToString()} is not supported for language {Language}");
throw new PlatformNotSupportedException($"Architecture {architecture} is not supported for language {Language}");
}
}

Expand Down Expand Up @@ -192,9 +192,20 @@ internal void FormatWorkerPathIfNeeded(ISystemRuntimeInformation systemRuntimeIn

OSPlatform os = systemRuntimeInformation.GetOSPlatform();
Architecture architecture = systemRuntimeInformation.GetOSArchitecture();

string workerRuntime = environment.GetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeSettingName);
string version = environment.GetEnvironmentVariable(RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName);
logger.LogDebug($"EnvironmentVariable {RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName}: {version}");

string workerRuntimeVersionSettingName = RpcWorkerConstants.FunctionWorkerRuntimeVersionSettingName;

// For LogicApps and the powershell worker config, we special case a separate environment variable.
if (environment.IsLogicApp() && string.Equals(
Language, RpcWorkerConstants.PowerShellLanguageWorkerName, StringComparison.Ordinal))
{
workerRuntimeVersionSettingName = RpcWorkerConstants.LogicAppsPowerShellVersionSettingName;
}

string version = environment.GetEnvironmentVariable(workerRuntimeVersionSettingName);
logger.LogDebug($"EnvironmentVariable {workerRuntimeVersionSettingName}: {version}");

// Only over-write DefaultRuntimeVersion if workerRuntime matches language for the worker config
if (!string.IsNullOrEmpty(workerRuntime) && workerRuntime.Equals(Language, StringComparison.OrdinalIgnoreCase) && !string.IsNullOrEmpty(version))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,25 @@ public void DefaultWorkerConfigs_Overrides_VersionAppSetting()
Assert.Equal("7.4", powershellWorkerConfig.Description.DefaultRuntimeVersion);
}

[Fact]
public void LogicApps_Overrides_PowershellVersionSetting()
{
var testEnvironment = new TestEnvironment();
testEnvironment.SetEnvironmentVariable("APP_KIND", "workflowapp");
testEnvironment.SetEnvironmentVariable("FUNCTIONS_WORKER_RUNTIME_VERSION", "7.2");
testEnvironment.SetEnvironmentVariable("LOGIC_APPS_POWERSHELL_VERSION", "7.4");
var configBuilder = ScriptSettingsManager.CreateDefaultConfigurationBuilder();
var config = configBuilder.Build();
var scriptSettingsManager = new ScriptSettingsManager(config);
var testLogger = new TestLogger("test");
var configFactory = new RpcWorkerConfigFactory(config, testLogger, _testSysRuntimeInfo, testEnvironment, new TestMetricsLogger(), _testWorkerProfileManager);
var workerConfigs = configFactory.GetConfigs();
var powershellWorkerConfig = workerConfigs.FirstOrDefault(w => w.Description.Language.Equals("powershell", StringComparison.OrdinalIgnoreCase));
Assert.Equal(4, workerConfigs.Count);
Assert.NotNull(powershellWorkerConfig);
Assert.Equal("7.4", powershellWorkerConfig.Description.DefaultRuntimeVersion);
}

[Theory]
[InlineData("python", "Python", false, true)]
[InlineData("python", "NOde", false, false)]
Expand Down