diff --git a/Kudu.Core/Functions/SyncTriggerHandler.cs b/Kudu.Core/Functions/SyncTriggerHandler.cs index eeb824e4..bc2addf9 100644 --- a/Kudu.Core/Functions/SyncTriggerHandler.cs +++ b/Kudu.Core/Functions/SyncTriggerHandler.cs @@ -38,15 +38,8 @@ public async Task SyncTriggers(string functionTriggersPayload) var scaleTriggers = scaleTriggersContent.Item1; string appName = _environment.K8SEAppName; - string buildNumber = Guid.NewGuid().ToString(); - var buildMetadata = new BuildMetadata() - { - AppName = appName, - BuildVersion = buildNumber, - AppSubPath = string.Empty - }; - await Task.Run(() => K8SEDeploymentHelper.UpdateFunctionAppTriggers(appName, scaleTriggers, buildMetadata)); + await Task.Run(() => K8SEDeploymentHelper.UpdateFunctionAppTriggers(appName, scaleTriggers, null)); } return null; diff --git a/Kudu.Core/K8SE/K8SEDeploymentHelper.cs b/Kudu.Core/K8SE/K8SEDeploymentHelper.cs index a57ffbd9..52451087 100644 --- a/Kudu.Core/K8SE/K8SEDeploymentHelper.cs +++ b/Kudu.Core/K8SE/K8SEDeploymentHelper.cs @@ -181,7 +181,7 @@ public static string GetAppKind(HttpContext context) throw new InvalidOperationException("Couldn't recognize AppKind"); } - return appKind; + return appKind; } public static string GetAppNamespace(HttpContext context) @@ -214,33 +214,30 @@ public static void UpdateContextWithAppSettings(HttpContext context) private static string GetFunctionAppPatchJson(IEnumerable functionTriggers, BuildMetadata buildMetadata) { - if (functionTriggers == null || !functionTriggers.Any()) + if ((functionTriggers == null || !functionTriggers.Any()) && buildMetadata == null) { return null; } - if (buildMetadata == null ) + var patchAppJson = new PatchAppJson { PatchSpec = new PatchSpec { } }; + if (functionTriggers?.Any() == true) { - return null; + patchAppJson.PatchSpec.TriggerOptions = new TriggerOptions + { + Triggers = functionTriggers + }; } - var patchAppJson = new PatchAppJson + if (buildMetadata != null) { - PatchSpec = new PatchSpec + patchAppJson.PatchSpec.Code = new CodeSpec { - TriggerOptions = new TriggerOptions - { - Triggers = functionTriggers - }, - Code = new CodeSpec + PackageRef = new PackageReference { - PackageRef = new PackageReference - { - BuildMetadata = GetBuildMetadataStr(buildMetadata), - } + BuildMetadata = GetBuildMetadataStr(buildMetadata), } - } - }; + }; + } var str= System.Convert.ToBase64String(ASCIIEncoding.ASCII.GetBytes(JsonConvert.SerializeObject(patchAppJson))); Console.WriteLine("Test Str: " + str);