Skip to content

Commit

Permalink
Merge branch 'master' into renovate-arcus.webapi-monorepo
Browse files Browse the repository at this point in the history
  • Loading branch information
stijnmoreels authored Dec 21, 2022
2 parents 9fb7637 + d817606 commit d6bbd1d
Show file tree
Hide file tree
Showing 23 changed files with 677 additions and 202 deletions.
33 changes: 29 additions & 4 deletions build/templates/docker-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,26 @@ stages:
APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=$(Arcus.ApplicationInsights.InstrumentationKey)
- template: 'run-new-project-from-template.yml'
parameters:
projectName: 'Arcus.Demo.AzureFunctions.Http'
projectName: 'Arcus.Demo.AzureFunctions.InProcess.Http'
projectAlias: 'arcus-az-func-http'
ports: '$(Arcus.AzureFunctions.Http.HttpPort):80'
projectOptions: '--functions-worker inProcess'
ports: '$(Arcus.AzureFunctions.Http.InProcess.HttpPort):80'
script: |
Get-Content './Arcus.Demo.AzureFunctions.InProcess.Http/Startup.cs' -Raw |
% { $_ -replace '#error', '#warning' -replace '#if DEBUG', '#if RELEASE' } |
Set-Content './Arcus.Demo.AzureFunctions.InProcess.Http/Startup.cs'
envVars: |
APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=$(Arcus.ApplicationInsights.InstrumentationKey)
- template: 'run-new-project-from-template.yml'
parameters:
projectName: 'Arcus.Demo.AzureFunctions.Isolated.Http'
projectAlias: 'arcus-az-func-http'
projectOptions: '--functions-worker isolated'
ports: '$(Arcus.AzureFunctions.Http.Isolated.HttpPort):80'
script: |
Get-Content './Arcus.Demo.AzureFunctions.Http/Startup.cs' -Raw |
Get-Content './Arcus.Demo.AzureFunctions.Isolated.Http/Program.cs' -Raw |
% { $_ -replace '#error', '#warning' -replace '#if DEBUG', '#if RELEASE' } |
Set-Content './Arcus.Demo.AzureFunctions.Http/Startup.cs'
Set-Content './Arcus.Demo.AzureFunctions.Isolated.Http/Program.cs'
envVars: |
APPLICATIONINSIGHTS_CONNECTION_STRING=InstrumentationKey=$(Arcus.ApplicationInsights.InstrumentationKey)
- template: 'run-new-project-from-template.yml'
Expand Down Expand Up @@ -249,3 +262,15 @@ stages:
targetType: 'inline'
script: 'docker logs Arcus.Demo.AzureFunctions.ServiceBus.Topic.Isolated'
condition: failed()
- task: PowerShell@2
displayName: 'Get Docker container logs for Arcus.Demo.AzureFunctions.InProcess.Http'
inputs:
targetType: 'inline'
script: 'docker logs Arcus.Demo.AzureFunctions.InProcess.Http'
condition: failed()
- task: PowerShell@2
displayName: 'Get Docker container logs for Arcus.Demo.AzureFunctions.Isolated.Http'
inputs:
targetType: 'inline'
script: 'docker logs Arcus.Demo.AzureFunctions.Isolated.Http'
condition: failed()
3 changes: 2 additions & 1 deletion build/variables/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ variables:
Arcus.Databricks.JobId: 9
Arcus.AzureFunctions.ApplicationInsights.MetricName: 'Databricks Job Completed'
Arcus.AzureFunctions.Databricks.HttpPort: '5050'
Arcus.AzureFunctions.Http.HttpPort: '6060'
Arcus.AzureFunctions.Http.InProcess.HttpPort: '6060'
Arcus.AzureFunctions.Http.Isolated.HttpPort: '6061'
Arcus.AzureFunctions.ServiceBus.Queue.InProcess.Port: '42067'
Arcus.AzureFunctions.ServiceBus.Queue.Isolated.Port: '42097'
Arcus.AzureFunctions.ServiceBus.Topic.Port: '42068'
Expand Down
5 changes: 5 additions & 0 deletions docs/preview/features/azurefunctions-http-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,16 @@ Creates a starter worker project with by default configured:
* Request content and header to restrict to JSON content and JSON parsing with data model annotations validation
* General exception handling that results in 500 Internal Server Error
* OpenAPI docs generation and UI (see more info [here](https://github.com/Azure/azure-functions-openapi-extension))
* Dockerfile

### Configuration

And additional features available with options:

* `--functions-worker`: Configures the type of Azure Functions worker type the project should target.
* `isolated` (default): Uses the isolated Azure Functions worker type which runs on a different process as the Azure Function
* `inProcess`: Uses the in-process Azure Functions worker type which runs on the same process as run Azure Function
For more information on the difference between the two, see [Microsoft's documentation](https://learn.microsoft.com/en-us/azure/azure-functions/dotnet-isolated-process-guide).
* `--include-healthchecks` (default `false`): include a default Health Azure Function and health check services from the project
* `--exclude-openapi` (default `false`): exclude the [Azure Functions OpenAPI docs generation and UI](https://github.com/Azure/azure-functions-openapi-extension) from the project.
* `--exclude-serilog` (default `false`): exclude the [Serilog](https://serilog.net/) logging infrastructure in the Azure Functions project which includes default enrichers ([version](https://observability.arcus-azure.net/features/telemetry-enrichment#version-enricher) and [application](https://observability.arcus-azure.net/features/telemetry-enrichment#application-enricher)), and sinking to Application Insights.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
"icon": "icon.jpg",
"isApi": true,
"symbolInfo": [
{
"id": "functions-worker",
"name": {
"text": "Functions Worker"
},
"isVisible": true
},
{
"id": "include-healthchecks",
"name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,19 @@
"HttpCorrelationOpenApiResponseHeaders.cs",
"OpenApiConfigurationOptions.cs"
]
},
{
"condition": "Isolated",
"exclude": [
"Startup.cs",
"HttpBasedAzureFunction.cs"
]
},
{
"condition": "InProcess",
"exclude": [
"Program.cs"
]
}
]
}
Expand Down Expand Up @@ -85,6 +98,30 @@
},
"replaces": "//#error"
},
"functions-worker": {
"type": "parameter",
"datatype": "choice",
"choices": [
{
"choice": "inProcess",
"description": "Uses Azure Functions in-process project template"
},
{
"choice": "isolated",
"description": "Uses Azure Functions isolated project template"
}
],
"defaultValue": "isolated",
"description": "Chooses the kind of Azure Functions project template"
},
"InProcess": {
"type": "computed",
"value": "(functions-worker == \"inProcess\")"
},
"Isolated": {
"type": "computed",
"value": "(functions-worker == \"isolated\")"
},
"include-healthchecks": {
"type": "parameter",
"datatype": "bool",
Expand Down Expand Up @@ -118,6 +155,7 @@
},
"postActions": [
{
"condition": "InProcess",
"description": "Adding Reference to Microsoft.NET.Sdk.Functions Nuget package",
"actionId": "B17581D1-C5C9-4489-8F0A-004BE667B814",
"continueOnError": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<TargetFramework>net6.0</TargetFramework>
<AzureFunctionsVersion>v4</AzureFunctionsVersion>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<OutputType Condition="'$(Isolated)' == 'true'">Exe</OutputType>
<!--#if (AuthoringMode)-->
<Authors>Arcus</Authors>
<Company>Arcus</Company>
Expand Down Expand Up @@ -36,7 +37,9 @@
</ItemGroup>

<PropertyGroup>
<DefineConstants>$(DefineConstants);OpenApi;Serilog_AppInsights</DefineConstants>
<DefineConstants>$(DefineConstants);OpenApi;Serilog_AppInsights;InProcess</DefineConstants>
<Isolated>false</Isolated>
<InProcess>true</InProcess>
<OpenApi>true</OpenApi>
<Serilog_AppInsights>true</Serilog_AppInsights>
<DockerFastModeProjectMountDirectory>/home/site/wwwroot</DockerFastModeProjectMountDirectory>
Expand All @@ -62,16 +65,22 @@
<PackageReference Include="Arcus.Observability.Telemetry.AspNetCore" Version="2.6.0" />
<PackageReference Include="Arcus.Observability.Telemetry.AzureFunctions" Version="2.6.0" />
<PackageReference Include="Arcus.Observability.Telemetry.Core" Version="2.6.0" />
<PackageReference Include="Arcus.Observability.Telemetry.Serilog.Filters" Version="2.6.0" Condition="'$(Serilog_AppInsights)' == 'true'" />
<PackageReference Include="Arcus.Observability.Telemetry.Serilog.Filters" Version="2.6.0" Condition="'$(Serilog_AppInsights)' == 'true'" />
<PackageReference Include="Arcus.Observability.Telemetry.Serilog.Sinks.Applicationinsights" Version="2.6.0" Condition="'$(Serilog_AppInsights)' == 'true'" />
<PackageReference Include="Arcus.Security.AzureFunctions" Version="1.9.0" />
<PackageReference Include="Arcus.Security.Providers.AzureKeyVault" Version="1.9.0" />
<PackageReference Include="Arcus.WebApi.Hosting.AzureFunctions" Version="1.7.0" Condition="'$(Isolated)' == 'true'" />
<PackageReference Include="Arcus.WebApi.Logging.AzureFunctions" Version="1.7.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.2.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="1.4.0" Condition="'$(OpenApi)' == 'true'" />
<PackageReference Include="Microsoft.Azure.Functions.Worker" Version="1.9.0" Condition="'$(Isolated)' == 'true'" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.Http" Version="3.0.13" Condition="'$(Isolated)' == 'true'" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Extensions.OpenApi" Version="1.4.0" Condition="'$(OpenApi)' == 'true' and '$(Isolated)' == 'true'" />
<PackageReference Include="Microsoft.Azure.Functions.Worker.Sdk" Version="1.7.0" Condition="'$(Isolated)' == 'true'" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="4.0.1" Condition="'$(InProcess)' == 'true'" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.2.0" Condition="'$(InProcess)' == 'true'" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.OpenApi" Version="1.4.0" Condition="'$(OpenApi)' == 'true' and '$(InProcess)' == 'true'" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.17.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.1.0" Condition="'$(Serilog_AppInsights)' == 'true'" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.1.0" Condition="'$(Serilog_AppInsights)' == 'true'" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" Condition="'$(Serilog_AppInsights)' == 'true'" />
</ItemGroup>
</Project>
Loading

0 comments on commit d6bbd1d

Please sign in to comment.