Skip to content

Commit

Permalink
Merge branch 'aok-foss-fix/cli-runtimeversion'
Browse files Browse the repository at this point in the history
and note in log
  • Loading branch information
giuliov committed Apr 30, 2022
2 parents 7e2d967 + 10cc698 commit 95a12bc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Next-Release-ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ This release has a few fixes and a new feature.

CLI Commands and Options
========================
No changes.
Fixes upgrading a previous instance to the latest run-time (PR #263).


Docker and Azure Function Hosting
========================
No changes.


Rule Language
========================
No changes.
Expand Down
11 changes: 8 additions & 3 deletions src/aggregator-cli/Instances/AggregatorInstances.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Reflection;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Azure.Management.AppService.Fluent;
using Microsoft.Azure.Management.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent;
using Microsoft.Azure.Management.ResourceManager.Fluent.Models;
Expand Down Expand Up @@ -371,15 +372,19 @@ private static async Task<Dictionary<string, string>> UpdateDefaultFilesAsync(Fu

private async Task ForceFunctionRuntimeVersionAsync(InstanceName instance, CancellationToken cancellationToken)
{
const string TargetVersion = "~3";
// Change V2 to V3 FUNCTIONS_EXTENSION_VERSION ~3
const string TargetVersion = "~4";
const string DotNetVersion = "v6.0";
// Change V2/V3 to V4 FUNCTIONS_EXTENSION_VERSION ~4
var webFunctionApp = await GetWebApp(instance, cancellationToken);
var currentAzureRuntimeVersion = webFunctionApp.GetAppSettings()
.GetValueOrDefault("FUNCTIONS_EXTENSION_VERSION");
if (currentAzureRuntimeVersion?.Value != TargetVersion)
var currentDotNetVersion = webFunctionApp.NetFrameworkVersion;
if (currentAzureRuntimeVersion?.Value != TargetVersion ||
currentDotNetVersion?.Value != DotNetVersion)
{
webFunctionApp.Update()
.WithAppSetting("FUNCTIONS_EXTENSION_VERSION", TargetVersion)
.WithNetFrameworkVersion(NetFrameworkVersion.Parse(DotNetVersion))
.Apply();
}
}
Expand Down

0 comments on commit 95a12bc

Please sign in to comment.