From 44985feba838c76d7a906c53a90d0473b8e4e318 Mon Sep 17 00:00:00 2001 From: Viktor Andersson Date: Tue, 30 Mar 2021 09:38:35 +0200 Subject: [PATCH 1/3] Add support for dotnet-isolated runtime. --- src/Farmer/Builders/Builders.Functions.fs | 14 +++++++++++--- src/Tests/Functions.fs | 7 +++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Farmer/Builders/Builders.Functions.fs b/src/Farmer/Builders/Builders.Functions.fs index bdb12aa5f..3d701e61f 100644 --- a/src/Farmer/Builders/Builders.Functions.fs +++ b/src/Farmer/Builders/Builders.Functions.fs @@ -12,7 +12,10 @@ open Farmer.Arm.KeyVault open Farmer.Arm.KeyVault.Vaults open System -type FunctionsRuntime = DotNet | Node | Java | Python +type RuntimeKind = + | Isolated + | InProcess +type FunctionsRuntime = DotNet of RuntimeKind | Node | Java | Python type FunctionsExtensionVersion = V1 | V2 | V3 module private FunctionsConfig = @@ -142,6 +145,11 @@ type FunctionsConfig = | None -> () + let functionsRuntime = + match this.Runtime with + | DotNet Isolated -> "dotnet-isolated" + | DotNet InProcess -> "dotnet" + | other -> (string other).ToLower() { Name = this.Name ServicePlan = this.ServicePlanId Location = location @@ -149,7 +157,7 @@ type FunctionsConfig = Tags = this.Tags ConnectionStrings = Map.empty AppSettings = [ - "FUNCTIONS_WORKER_RUNTIME", (string this.Runtime).ToLower() + "FUNCTIONS_WORKER_RUNTIME", functionsRuntime "WEBSITE_NODE_DEFAULT_VERSION", "10.14.1" "FUNCTIONS_EXTENSION_VERSION", match this.ExtensionVersion with V1 -> "~1" | V2 -> "~2" | V3 -> "~3" "AzureWebJobsStorage", StorageAccount.getConnectionString this.StorageAccountName |> ArmExpression.Eval @@ -280,7 +288,7 @@ type FunctionsBuilder() = StorageAccount = derived (fun config -> let storage = config.Name.Map (sprintf "%sstorage") |> sanitiseStorage |> ResourceName storageAccounts.resourceId storage) - Runtime = DotNet + Runtime = DotNet InProcess ExtensionVersion = V3 Cors = None HTTPSOnly = false diff --git a/src/Tests/Functions.fs b/src/Tests/Functions.fs index 73d92f97c..a187f1e18 100644 --- a/src/Tests/Functions.fs +++ b/src/Tests/Functions.fs @@ -106,4 +106,11 @@ let tests = testList "Functions tests" [ Expect.equal secrets.[1].Value (ExpressionSecret sa.Key) "Incorrect secret value" Expect.sequenceEqual secrets.[1].Dependencies [ vaults.resourceId "testfuncvault"; storageAccounts.resourceId "teststorage" ] "Incorrect secret dependencies" } + + test "Supports dotnet-isolated runtime" { + let f = functions { use_runtime (FunctionsRuntime.DotNet RuntimeKind.Isolated) } + let resources = (f :> IBuilder).BuildResources Location.WestEurope + let site = resources.[0] :?> Web.Site + Expect.equal site.AppSettings.["FUNCTIONS_WORKER_RUNTIME"] (LiteralSetting "dotnet-isolated") "Should use dotnet-isolated functions runtime" + } ] \ No newline at end of file From f86b3711a6c56f32eb1d26247fc57cf17de6aeeb Mon Sep 17 00:00:00 2001 From: Viktor Andersson Date: Fri, 9 Apr 2021 09:02:58 +0200 Subject: [PATCH 2/3] Update release notes. --- RELEASE_NOTES.md | 1 + 1 file changed, 1 insertion(+) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 4fc34d6a5..a50c39076 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -9,6 +9,7 @@ Release Notes * Event Grid: Add ServiceBus Queue and Topic as supported destinations * Functions: Support for 64 bits. * Functions: Add option to use managed Key Vault +* Functions: Add support for dotnet-isolated runtime (NET5) * KeyVault: Fix an issue with adding tags on main KeyVault builder. * ServiceBus: update namespace validation rules to follow [Microsoft documentation](https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/resource-name-rules#microsoftservicebus) * Storage: Add support for tables From a640a14355cc68d0b0d7aa5cdafc200a7c55b349 Mon Sep 17 00:00:00 2001 From: Dave Curylo Date: Fri, 23 Apr 2021 11:23:08 -0400 Subject: [PATCH 3/3] Specify isolated dotnet functionapp with 'DotNetIsolated' --- src/Farmer/Builders/Builders.Functions.fs | 11 ++++------- src/Tests/Functions.fs | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/Farmer/Builders/Builders.Functions.fs b/src/Farmer/Builders/Builders.Functions.fs index 3d701e61f..e07b7f6b4 100644 --- a/src/Farmer/Builders/Builders.Functions.fs +++ b/src/Farmer/Builders/Builders.Functions.fs @@ -12,10 +12,7 @@ open Farmer.Arm.KeyVault open Farmer.Arm.KeyVault.Vaults open System -type RuntimeKind = - | Isolated - | InProcess -type FunctionsRuntime = DotNet of RuntimeKind | Node | Java | Python +type FunctionsRuntime = DotNet | DotNetIsolated | Node | Java | Python type FunctionsExtensionVersion = V1 | V2 | V3 module private FunctionsConfig = @@ -147,8 +144,8 @@ type FunctionsConfig = let functionsRuntime = match this.Runtime with - | DotNet Isolated -> "dotnet-isolated" - | DotNet InProcess -> "dotnet" + | DotNetIsolated -> "dotnet-isolated" + | DotNet -> "dotnet" | other -> (string other).ToLower() { Name = this.Name ServicePlan = this.ServicePlanId @@ -288,7 +285,7 @@ type FunctionsBuilder() = StorageAccount = derived (fun config -> let storage = config.Name.Map (sprintf "%sstorage") |> sanitiseStorage |> ResourceName storageAccounts.resourceId storage) - Runtime = DotNet InProcess + Runtime = DotNet ExtensionVersion = V3 Cors = None HTTPSOnly = false diff --git a/src/Tests/Functions.fs b/src/Tests/Functions.fs index a187f1e18..9df21fdfd 100644 --- a/src/Tests/Functions.fs +++ b/src/Tests/Functions.fs @@ -108,7 +108,7 @@ let tests = testList "Functions tests" [ } test "Supports dotnet-isolated runtime" { - let f = functions { use_runtime (FunctionsRuntime.DotNet RuntimeKind.Isolated) } + let f = functions { use_runtime (FunctionsRuntime.DotNetIsolated) } let resources = (f :> IBuilder).BuildResources Location.WestEurope let site = resources.[0] :?> Web.Site Expect.equal site.AppSettings.["FUNCTIONS_WORKER_RUNTIME"] (LiteralSetting "dotnet-isolated") "Should use dotnet-isolated functions runtime"