Skip to content

Commit 9a5b604

Browse files
khkh-msv-smanchem
andauthored
Updated Coretools to 4.30.0 (#3608)
* Updated Coretools to 4.30.0 * fixed the issue. * Added timeouts for the tests. * Fix for localhost auth. --------- Co-authored-by: v-smanchem <[email protected]>
1 parent fc93cca commit 9a5b604

File tree

5 files changed

+28
-4
lines changed

5 files changed

+28
-4
lines changed

src/Azure.Functions.Cli/Actions/HostActions/Startup.cs

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Azure.Functions.Cli.Diagnostics;
44
using Azure.Functions.Cli.ExtensionBundle;
55
using Azure.Functions.Cli.Helpers;
6+
using Microsoft.AspNetCore.Authorization;
67
using Microsoft.AspNetCore.Builder;
78
using Microsoft.AspNetCore.Hosting;
89
using Microsoft.Azure.WebJobs.Script;
@@ -73,6 +74,8 @@ public IServiceProvider ConfigureServices(IServiceCollection services)
7374
.AddScheme<ArmAuthenticationOptions, CliAuthenticationHandler<ArmAuthenticationOptions>>(ArmAuthenticationDefaults.AuthenticationScheme, _ => { });
7475
}
7576

77+
services.AddSingleton<IAuthorizationHandler, CoreToolsAuthorizationHandler>();
78+
7679
services.AddWebJobsScriptHostAuthorization();
7780

7881
services.AddMvc()

src/Azure.Functions.Cli/Actions/HostActions/WebHost/Security/CliAuthenticationHandler.cs

+13
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
using System.Security.Claims;
99
using Microsoft.Azure.WebJobs.Script.WebHost.Security.Authentication;
1010
using Microsoft.Azure.WebJobs.Extensions.Http;
11+
using Microsoft.AspNetCore.Authorization;
12+
using Microsoft.Azure.WebJobs.Script.WebHost.Security.Authorization;
13+
using Microsoft.Azure.WebJobs.Script.Description;
1114

1215
namespace Azure.Functions.Cli.Actions.HostActions.WebHost.Security
1316
{
@@ -33,4 +36,14 @@ protected override Task<AuthenticateResult> HandleAuthenticateAsync()
3336
return Task.FromResult(result);
3437
}
3538
}
39+
40+
public class CoreToolsAuthorizationHandler : AuthorizationHandler<FunctionAuthorizationRequirement, FunctionDescriptor>
41+
{
42+
protected override Task HandleRequirementAsync(AuthorizationHandlerContext context, FunctionAuthorizationRequirement requirement, FunctionDescriptor resource)
43+
{
44+
context.Succeed(requirement);
45+
46+
return Task.CompletedTask;
47+
}
48+
}
3649
}

src/Azure.Functions.Cli/Azure.Functions.Cli.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@
276276
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.21.0" />
277277
<PackageReference Include="Microsoft.AspNetCore.DataProtection" Version="2.2.0" />
278278
<PackageReference Include="Microsoft.Azure.DurableTask.AzureStorage.Internal" Version="1.4.0" />
279-
<PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="4.28.5" />
279+
<PackageReference Include="Microsoft.Azure.WebJobs.Script.WebHost" Version="4.30.0" />
280280
<PackageReference Include="Microsoft.Build" Version="17.0.0" />
281281
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.35.0" />
282282
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
@@ -291,7 +291,7 @@
291291
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.0" Version="4.0.2973" />
292292
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.2" Version="4.0.3070" />
293293
<PackageReference Include="Microsoft.Azure.Functions.PowerShellWorker.PS7.4" Version="4.0.3085" />
294-
<PackageReference Include="Microsoft.Azure.Functions.PythonWorker" Version="4.23.0" />
294+
<PackageReference Include="Microsoft.Azure.Functions.PythonWorker" Version="4.24.0" />
295295
</ItemGroup>
296296
<Target Name="ExcludeWorkersFromReadyToRun">
297297
<CreateItem Include="%(None.Filename)%(None.Extension)" Condition="$([System.String]::new('%(None.TargetPath)').StartsWith('workers'))" PreserveExistingMetadata="false">

src/Azure.Functions.Cli/ExtensionBundle/ExtensionBundleHelper.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Azure.Functions.Cli.Common;
22
using Microsoft.Azure.WebJobs.Script;
3+
using Microsoft.Azure.WebJobs.Script.Config;
34
using Microsoft.Azure.WebJobs.Script.Configuration;
45
using Microsoft.Azure.WebJobs.Script.Diagnostics;
56
using Microsoft.Azure.WebJobs.Script.ExtensionBundle;
@@ -32,7 +33,9 @@ public static ExtensionBundleManager GetExtensionBundleManager()
3233
extensionBundleOption.DownloadPath = GetBundleDownloadPath(extensionBundleOption.Id);
3334
extensionBundleOption.EnsureLatest = true;
3435
}
35-
return new ExtensionBundleManager(extensionBundleOption, SystemEnvironment.Instance, NullLoggerFactory.Instance);
36+
37+
var configOptions = new FunctionsHostingConfigOptions();
38+
return new ExtensionBundleManager(extensionBundleOption, SystemEnvironment.Instance, NullLoggerFactory.Instance, configOptions);
3639
}
3740

3841
public static ExtensionBundleContentProvider GetExtensionBundleContentProvider()

test/Azure.Functions.Cli.Tests/E2E/StartTests.cs

+6-1
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ await CliTester.Run(new RunConfiguration
9393
result.Should().Be("Hello, Test. This HTTP triggered function executed successfully.", because: "response from default function should be 'Hello, {name}. This HTTP triggered function executed successfully.'");
9494
}
9595
},
96+
CommandTimeout = TimeSpan.FromSeconds(120),
9697
}, _output);
9798
}
9899

@@ -306,6 +307,7 @@ await CliTester.Run(new RunConfiguration
306307
result.Should().Be("Hello, Test. This HTTP triggered function executed successfully.", because: "response from default function should be 'Hello, {name}. This HTTP triggered function executed successfully.'");
307308
}
308309
},
310+
CommandTimeout = TimeSpan.FromSeconds(120),
309311
}, _output);
310312
}
311313

@@ -502,7 +504,8 @@ await CliTester.Run(new RunConfiguration[]
502504
OutputDoesntContain = new string[]
503505
{
504506
"Skipping 'emptySetting' from local settings as it's already defined in current environment variables."
505-
}
507+
},
508+
CommandTimeout = TimeSpan.FromSeconds(120),
506509
}
507510
}, _output);
508511
}
@@ -632,6 +635,7 @@ await CliTester.Run(new RunConfiguration[]
632635
{
633636
"Using for user secrets file configuration."
634637
},
638+
CommandTimeout = TimeSpan.FromSeconds(120),
635639
Test = async (workingDir, p) =>
636640
{
637641
using (var client = new HttpClient() { BaseAddress = new Uri("http://localhost:7071/") })
@@ -705,6 +709,7 @@ await CliTester.Run(new RunConfiguration[]
705709
{
706710
"start --functions http1 --csharp",
707711
},
712+
CommandTimeout = TimeSpan.FromSeconds(120),
708713
ExpectExit = true,
709714
ExitInError = true,
710715
ErrorContains = new[] { "Missing value for AzureWebJobsStorage in local.settings.json and User Secrets. This is required for all triggers other than httptrigger, kafkatrigger. You can run 'func azure functionapp fetch-app-settings <functionAppName>' or specify a connection string in local.settings.json or User Secrets." },

0 commit comments

Comments
 (0)