Browse Source

stash in function app explore

pull/1612/head
Phill Morton 3 years ago
parent
commit
52ef3d0961
  1. 13
      .idea/.idea.tye/.idea/.gitignore
  2. 6
      .idea/.idea.tye/.idea/GitLink.xml
  3. 6
      .idea/.idea.tye/.idea/codestream.xml
  4. 8
      .idea/.idea.tye/.idea/indexLayout.xml
  5. 6
      .idea/.idea.tye/.idea/vcs.xml
  6. 2
      src/Microsoft.Tye.Core/AzureFunctionServiceBuilder.cs
  7. 3
      src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs
  8. 4
      test/E2ETest/Microsoft.Tye.E2ETests.csproj
  9. 4
      test/E2ETest/TyeGenerateTests.cs
  10. 33
      test/E2ETest/TyeRunTests.cs
  11. 13
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/.gitignore
  12. 1
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/.name
  13. 6
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/GitLink.xml
  14. 6
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/codestream.xml
  15. 4
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/encodings.xml
  16. 8
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/indexLayout.xml
  17. 6
      test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/vcs.xml
  18. 6
      test/E2ETest/testassets/projects/azure-functions/backend/backend.csproj
  19. 25
      test/E2ETest/testassets/projects/dapr-function-app/dapr-function-app.sln
  20. 32
      test/E2ETest/testassets/projects/dapr-function-app/function/HttpTrigger.cs
  21. 18
      test/E2ETest/testassets/projects/dapr-function-app/function/Program.cs
  22. 27
      test/E2ETest/testassets/projects/dapr-function-app/function/Properties/launchSettings.json
  23. 9
      test/E2ETest/testassets/projects/dapr-function-app/function/appsettings.Development.json
  24. 10
      test/E2ETest/testassets/projects/dapr-function-app/function/appsettings.json
  25. 23
      test/E2ETest/testassets/projects/dapr-function-app/function/dapr-function-app.csproj
  26. 12
      test/E2ETest/testassets/projects/dapr-function-app/function/host.json
  27. 6
      test/E2ETest/testassets/projects/dapr-function-app/function/local.settings.json
  28. 8
      test/E2ETest/testassets/projects/dapr-function-app/tye.yaml
  29. 4
      test/E2ETest/testassets/projects/dotnet-env-vars/tye.yaml

13
.idea/.idea.tye/.idea/.gitignore

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
/.idea.tye.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

6
.idea/.idea.tye/.idea/GitLink.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="uk.co.ben_gibson.git.link.SettingsState">
<option name="host" value="72037fcc-cb9c-4c22-960a-ffe73fd5e229" />
</component>
</project>

6
.idea/.idea.tye/.idea/codestream.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CodeStream">
<option name="webViewContext" value="{&quot;chatProviderAccess&quot;:&quot;strict&quot;,&quot;currentTeamId&quot;:&quot;&quot;,&quot;currentStreamId&quot;:&quot;&quot;,&quot;pullRequestCheckoutBranch&quot;:false,&quot;isRepositioning&quot;:false,&quot;onboardStep&quot;:0,&quot;panelStack&quot;:[&quot;landing-redirect&quot;],&quot;hasFocus&quot;:false,&quot;channelFilter&quot;:&quot;all&quot;,&quot;channelsMuteAll&quot;:false,&quot;codemarkFileFilter&quot;:&quot;all&quot;,&quot;codemarkTypeFilter&quot;:&quot;all&quot;,&quot;codemarkTagFilter&quot;:&quot;all&quot;,&quot;codemarkBranchFilter&quot;:&quot;all&quot;,&quot;codemarkAuthorFilter&quot;:&quot;all&quot;,&quot;codemarksFileViewStyle&quot;:&quot;inline&quot;,&quot;codemarksShowArchived&quot;:false,&quot;codemarksShowResolved&quot;:false,&quot;codemarksWrapComments&quot;:false,&quot;showFeedbackSmiley&quot;:true,&quot;route&quot;:{&quot;name&quot;:&quot;newUserEntry&quot;,&quot;params&quot;:{}},&quot;spatialViewShowPRComments&quot;:false,&quot;currentPullRequestNeedsRefresh&quot;:{&quot;needsRefresh&quot;:false,&quot;providerId&quot;:&quot;&quot;,&quot;pullRequestId&quot;:&quot;&quot;},&quot;__teamless__&quot;:{&quot;selectedRegion&quot;:&quot;us&quot;},&quot;sessionStart&quot;:1695871220871}" />
</component>
</project>

8
.idea/.idea.tye/.idea/indexLayout.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
.idea/.idea.tye/.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

2
src/Microsoft.Tye.Core/AzureFunctionServiceBuilder.cs

@ -6,7 +6,7 @@ using System.Collections.Generic;
namespace Microsoft.Tye
{
public class AzureFunctionServiceBuilder : ServiceBuilder
public class AzureFunctionServiceBuilder : LaunchedServiceBuilder
{
public AzureFunctionServiceBuilder(string name, string path, ServiceSource source)
: base(name, source)

3
src/Microsoft.Tye.Extensions/Dapr/DaprExtension.cs

@ -28,7 +28,8 @@ namespace Microsoft.Tye.Extensions.Dapr
// For local run, enumerate all projects, and add services for each dapr proxy.
var projects = context.Application.Services.OfType<ProjectServiceBuilder>().Cast<LaunchedServiceBuilder>();
var executables = context.Application.Services.OfType<ExecutableServiceBuilder>().Cast<LaunchedServiceBuilder>();
var services = projects.Concat(executables).ToList();
var functions = context.Application.Services.OfType<AzureFunctionServiceBuilder>().Cast<LaunchedServiceBuilder>();
var services = projects.Concat(executables).Concat(functions).ToList();
foreach (var project in services)
{

4
test/E2ETest/Microsoft.Tye.E2ETests.csproj

@ -15,6 +15,7 @@
The Microsoft.Build.Locator package takes care of dynamically loading these assemblies
at runtime. We don't need/want to ship them, just to have them as references.
-->
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.12" />
<PackageReference Include="Microsoft.Build" Version="17.3.2" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Framework" Version="17.3.2" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.Build.Locator" Version="1.5.5" />
@ -29,6 +30,9 @@
</ItemGroup>
<ItemGroup>
<Compile Include="testassets\projects\dapr-function-app\function\HttpTrigger.cs" />
<Compile Include="testassets\projects\dapr-function-app\HttpTrigger.cs" />
<Compile Include="testassets\projects\dapr-function-app\Properties\HttpTrigger.cs" />
<Content Include="testassets\**\*" CopyToOutputDirectory="PreserveNewest" />
<Compile Remove="testassets\**\*" />
<None Remove="testassets\generate\apps-with-ingress.1.18.yaml" />

4
test/E2ETest/TyeGenerateTests.cs

@ -253,6 +253,10 @@ namespace E2ETest
}
}
[ConditionalFact]
[SkipIfDockerNotRunning]
public async Task Generate_ConnectionStringDependency()

33
test/E2ETest/TyeRunTests.cs

@ -82,12 +82,13 @@ namespace E2ETest
});
}
[Fact(Skip = "Need to figure out how to install func before running")]
//[Fact(Skip = "Need to figure out how to install func before running")]
[Fact]
public async Task FrontendBackendAzureFunctionTest()
{
// Install to directory
using var tmp = TempDirectory.Create();
await ProcessUtil.RunAsync("npm", "install azure-functions-core-tools@3`", workingDirectory: tmp.DirectoryPath);
//await ProcessUtil.RunAsync("npm", "install azure-functions-core-tools@3`", workingDirectory: tmp.DirectoryPath);
using var projectDirectory = CopyTestProjectDirectory("azure-functions");
var content = @$"
@ -97,7 +98,6 @@ name: frontend-backend
services:
- name: backend
azureFunction: backend/
pathToFunc: {tmp.DirectoryPath}/node_modules/azure-functions-core-tools/bin/func.dll
- name: frontend
project: frontend/frontend.csproj";
@ -126,6 +126,33 @@ services:
Assert.True(frontendResponse.IsSuccessStatusCode);
});
}
[Fact]
public async Task DaprAzureFunctionTest()
{
using var projectDirectory = CopyTestProjectDirectory("dapr-function-app");
var projectFile = new FileInfo(Path.Combine(projectDirectory.DirectoryPath, "tye.yaml"));
var outputContext = new OutputContext(_sink, Verbosity.Debug);
var application = await ApplicationFactory.CreateAsync(outputContext, projectFile);
await application.ProcessExtensionsAsync(new HostOptions(), outputContext, ExtensionContext.OperationKind.LocalRun);
var handler = new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (a, b, c, d) => true,
AllowAutoRedirect = false
};
var client = new HttpClient(new RetryHandler(handler));
await RunHostingApplication(application, new HostOptions(), async (app, uri) =>
{
var backendUri = await GetServiceUrl(client, uri, "dapr-test-project");
var backendResponse = await client.GetAsync(backendUri);
Assert.True(backendResponse.IsSuccessStatusCode);
});
}
[ConditionalTheory]
[SkipIfDockerNotRunning]

13
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/.gitignore

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/modules.xml
/contentModel.xml
/.idea.frontend-backend.iml
/projectSettingsUpdater.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

1
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/.name

@ -0,0 +1 @@
frontend-backend

6
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/GitLink.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="uk.co.ben_gibson.git.link.SettingsState">
<option name="host" value="72037fcc-cb9c-4c22-960a-ffe73fd5e229" />
</component>
</project>

6
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/codestream.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CodeStream">
<option name="webViewContext" value="{&quot;chatProviderAccess&quot;:&quot;strict&quot;,&quot;currentTeamId&quot;:&quot;&quot;,&quot;currentStreamId&quot;:&quot;&quot;,&quot;pullRequestCheckoutBranch&quot;:false,&quot;isRepositioning&quot;:false,&quot;onboardStep&quot;:0,&quot;panelStack&quot;:[&quot;landing-redirect&quot;],&quot;hasFocus&quot;:false,&quot;channelFilter&quot;:&quot;all&quot;,&quot;channelsMuteAll&quot;:false,&quot;codemarkFileFilter&quot;:&quot;all&quot;,&quot;codemarkTypeFilter&quot;:&quot;all&quot;,&quot;codemarkTagFilter&quot;:&quot;all&quot;,&quot;codemarkBranchFilter&quot;:&quot;all&quot;,&quot;codemarkAuthorFilter&quot;:&quot;all&quot;,&quot;codemarksFileViewStyle&quot;:&quot;inline&quot;,&quot;codemarksShowArchived&quot;:false,&quot;codemarksShowResolved&quot;:false,&quot;codemarksWrapComments&quot;:false,&quot;showFeedbackSmiley&quot;:true,&quot;route&quot;:{&quot;name&quot;:&quot;newUserEntry&quot;,&quot;params&quot;:{}},&quot;spatialViewShowPRComments&quot;:false,&quot;currentPullRequestNeedsRefresh&quot;:{&quot;needsRefresh&quot;:false,&quot;providerId&quot;:&quot;&quot;,&quot;pullRequestId&quot;:&quot;&quot;},&quot;__teamless__&quot;:{&quot;selectedRegion&quot;:&quot;us&quot;},&quot;sessionStart&quot;:1695868774707}" />
</component>
</project>

4
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/encodings.xml

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

8
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/indexLayout.xml

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders />
<explicitIncludes />
<explicitExcludes />
</component>
</project>

6
test/E2ETest/testassets/projects/azure-functions/.idea/.idea.frontend-backend/.idea/vcs.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/../../../../.." vcs="Git" />
</component>
</project>

6
test/E2ETest/testassets/projects/azure-functions/backend/backend.csproj

@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<TargetFramework>net7.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.3" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.2.0" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">

25
test/E2ETest/testassets/projects/dapr-function-app/dapr-function-app.sln

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 25.0.1706.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dapr-function-app", "function/dapr-function-app.csproj", "{0979B3EB-D56F-4402-A858-AB19B6D9B902}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0979B3EB-D56F-4402-A858-AB19B6D9B902}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0979B3EB-D56F-4402-A858-AB19B6D9B902}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0979B3EB-D56F-4402-A858-AB19B6D9B902}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0979B3EB-D56F-4402-A858-AB19B6D9B902}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B9930E6C-6675-4B5A-8D01-5BEEABAF024D}
EndGlobalSection
EndGlobal

32
test/E2ETest/testassets/projects/dapr-function-app/function/HttpTrigger.cs

@ -0,0 +1,32 @@
using System.Net;
using Microsoft.Azure.Functions.Worker;
using Microsoft.Azure.Functions.Worker.Http;
using Microsoft.Extensions.Logging;
namespace dapr_function_app
{
public class HttpTrigger1
{
private readonly ILogger _logger;
public HttpTrigger1(ILoggerFactory loggerFactory)
{
_logger = loggerFactory.CreateLogger<HttpTrigger1>();
}
[Function("HttpTrigger1")]
public HttpResponseData Run([HttpTrigger(AuthorizationLevel.Anonymous, "get", "post")] HttpRequestData req)
{
_logger.LogInformation("C# HTTP trigger function processed a request.");
var response = req.CreateResponse(HttpStatusCode.OK);
response.Headers.Add("Content-Type", "text/plain; charset=utf-8");
response.WriteString("Welcome to Azure Functions!");
return response;
}
}
}

18
test/E2ETest/testassets/projects/dapr-function-app/function/Program.cs

@ -0,0 +1,18 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
internal class Program
{
private static void Main(string[] args)
{
var host = new HostBuilder()
.ConfigureFunctionsWorkerDefaults(config =>
{
config.Services.AddLogging();
})
.Build();
host.Run();
}
}

27
test/E2ETest/testassets/projects/dapr-function-app/function/Properties/launchSettings.json

@ -0,0 +1,27 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:64181",
"sslPort": 44315
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"dapr": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

9
test/E2ETest/testassets/projects/dapr-function-app/function/appsettings.Development.json

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

10
test/E2ETest/testassets/projects/dapr-function-app/function/appsettings.json

@ -0,0 +1,10 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
},
"AllowedHosts": "*"
}

23
test/E2ETest/testassets/projects/dapr-function-app/function/dapr-function-app.csproj

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<OutputType>Exe</OutputType>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.19.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.1.0" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.14.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>

12
test/E2ETest/testassets/projects/dapr-function-app/function/host.json

@ -0,0 +1,12 @@
{
"version": "2.0",
"logging": {
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
},
"enableLiveMetricsFilters": true
}
}
}

6
test/E2ETest/testassets/projects/dapr-function-app/function/local.settings.json

@ -0,0 +1,6 @@
{
"IsEncrypted": false,
"Values": {
"FUNCTIONS_WORKER_RUNTIME": "dotnet-isolated"
}
}

8
test/E2ETest/testassets/projects/dapr-function-app/tye.yaml

@ -0,0 +1,8 @@
name: dapr_test_application
extensions:
- name: dapr
config: tracing
log-level: debug
services:
- name: dapr-test-project
azureFunction: function/

4
test/E2ETest/testassets/projects/dotnet-env-vars/tye.yaml

@ -1,6 +1,10 @@
# tye application configuration file
# read all about it at https://github.com/dotnet/tye
name: dotnet-env-vars
extensions:
- name: dapr
config: tracing
log-level: debug
dashboardPort: 8005
services:
- name: test-project

Loading…
Cancel
Save