Skip to content

Commit

Permalink
Add deploy pipeline for networking echo test servers. (#111398)
Browse files Browse the repository at this point in the history
* Set up CI with Start Right

* Update deploy-networking-echo-test-servers.yml for Azure Pipelines

* Update deploy-networking-echo-test-servers.yml for Azure Pipelines

Add build and publish steps (TODO: Authorize)

* Update deploy-networking-echo-test-servers.yml for Azure Pipelines

Add azureSubscription reference

* Update .NET version in pipeline

* allow preview versions of .NET

* fix

* Update deploy-networking-echo-test-servers.yml for Azure Pipelines

* Use multi level lookup

* Manual invocation of dotnet build.

* use .NET 8

* script task instead of powershell

* Specify working directory during build

* remove global.json

* fix

* Add versions reference

* Update to released OpenTelemetry packages

* Turn on GenevaTelemetry in the pipeline build

* Add swagger file

* Move yml file to eng/pipelines/libraries

* Fix pipeline

* Deploy to http2 as well

* Update eng/pipelines/libraries/deploy-networking-echo-test-servers.yml

* Remove duplicate server URL from swagger file

* Update eng/pipelines/libraries/deploy-networking-echo-test-servers.yml

Co-authored-by: Anton Firszov <[email protected]>

* Add deploy instructions

* Update eng/pipelines/libraries/deploy-networking-echo-test-servers.yml

Co-authored-by: Marie Píchová <[email protected]>

---------

Co-authored-by: Ilya Skuratovsky <[email protected]>
Co-authored-by: Anton Firszov <[email protected]>
Co-authored-by: Marie Píchová <[email protected]>
  • Loading branch information
4 people authored Jan 20, 2025
1 parent e93f360 commit 4c224ab
Show file tree
Hide file tree
Showing 6 changed files with 416 additions and 10 deletions.
99 changes: 99 additions & 0 deletions eng/pipelines/libraries/deploy-networking-echo-test-servers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# This pipeline deploys the test servers we are using to run (outerloop) Functional tests for various functionality in System.Net namespace.
# The pipeline deploys to staging slots, which are available at
# - corefx-net-http11-staging.azurewebsites.net
# - corefx-net-http2-staging.azurewebsites.net
#
# Usage instructions:
# 1) Start pipeline at https://dev.azure.com/dnceng/internal/_build?definitionId=1419 (
deploy-networking-echo-test-servers), pick the correct branch and start the build.
# 2) After pipeline succeeds, check your changes against the staging slots, two possible ways to do this are:
# - create a no-merge PR where you overwrite the default urls (e.g. https://github.com/dotnet/runtime/pull/111396)
# - test locally, either by same changes as in above PR, or by using the override environment variables
#
# DOTNET_TEST_HTTPHOST=http://corefx-net-http11-staging.azurewebsites.net
# DOTNET_TEST_SECUREHTTPHOST=https://corefx-net-http11-staging.azurewebsites.net
# DOTNET_TEST_WEBSOKETHOST=http://corefx-net-http11-staging.azurewebsites.net
# DOTNET_TEST_SECUREWEBSOKETHOST=http://corefx-net-http11-staging.azurewebsites.net
#
# DOTNET_TEST_HTTP2HOST=http://corefx-net-http2-staging.azurewebsites.net
# 3) If there are no issues, you can swap the staging slots with production slots via the Azure portal.
# Only the members of the .NET Networking team have access to the Azure Subscription which hosts the
# servers. Look for the "Deployment slots" section at corefx-net-http11 and corefx-net-http2 Web Apps

trigger: none

resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release

variables:
- template: /eng/common/templates-official/variables/pool-providers.yml
- name: FrameworkVersion
value: 8.x
- name: TargetFramework
value: net8.0

extends:
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
customBuildTags:
- 1ES.PT.ViaStartRight
pool:
name: $(DncEngInternalBuildPool)
image: 1es-windows-2022
os: windows

stages:
- stage: stage
displayName: Building in a VM
jobs:
- job: job
displayName: Build
steps:
- checkout: self

- task: UseDotNet@2
inputs:
packageType: "sdk"
version: $(FrameworkVersion)

- script: echo {} > ./global.json
displayName: Bypass repository global.json
workingDirectory: ./src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer

- script: dotnet publish -c Release /p:GenevaTelemetry=true /p:_TargetFrameworkForXHarness=$(TargetFramework)
workingDirectory: ./src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer
displayName: Run dotnet publish

- task: zip@0
displayName: Zip artifacts
inputs:
pathToZipFolder: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish\'
pathToZipFile: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish.zip'

- task: AzureRmWebAppDeployment@4
displayName: Deploy to corefx-net-http11-staging
inputs:
ConnectionType: "AzureRM"
azureSubscription: .NET Libraries Network Testing
appType: "webApp"
WebAppName: "corefx-net-http11"
deployToSlotOrASE: true
ResourceGroupName: "Production-WestUS"
SlotName: "staging"
package: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish.zip'

- task: AzureRmWebAppDeployment@4
displayName: Deploy to corefx-net-http2-staging
inputs:
ConnectionType: "AzureRM"
azureSubscription: .NET Libraries Network Testing
appType: "webApp"
WebAppName: "corefx-net-http2"
deployToSlotOrASE: true
ResourceGroupName: "Production-WestUS"
SlotName: "staging"
package: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish.zip'
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
</PropertyGroup>

<Import Project="$([MSBuild]::NormalizePath($(RepositoryRoot), 'eng', 'testing', 'ForXHarness.Directory.Build.props'))" />
<Import Project="$([MSBuild]::NormalizePath($(RepositoryRoot), 'eng', 'Versions.props'))" />
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ public GenericHandler(RequestDelegate next)
public async Task Invoke(HttpContext context)
{
PathString path = context.Request.Path;
if (path.Equals(new PathString("/swagger.json")))
{
using (var stream = typeof(GenericHandler).Assembly.GetManifestResourceStream("NetCoreServer.swagger.json"))
{
context.Response.ContentType = "application/json";
await stream.CopyToAsync(context.Response.Body);
}
return;
}

if (path.Equals(new PathString("/deflate.ashx")))
{
await DeflateHandler.InvokeAsync(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,16 @@
</ItemGroup>

<ItemGroup Condition="'$(GenevaTelemetry)' == 'true'">
<PackageReference Include="OpenTelemetry" Version="1.2.0-rc2" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.2.0-rc2" />
<PackageReference Include="OpenTelemetry.Exporter.Geneva" Version="1.2.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9" />
<PackageReference Include="OpenTelemetry" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Geneva" Version="1.7.0" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Include="swagger.json" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
using OpenTelemetry.Trace;
using OpenTelemetry.Metrics;
using OpenTelemetry.Exporter.Geneva;
using System.Diagnostics.Metrics;
using Microsoft.AspNetCore.Http;
using System.Threading.Tasks;
using System.Diagnostics;
using System.Collections.Generic;
#endif

Expand All @@ -31,7 +27,8 @@ public Startup(IConfiguration configuration)
public void ConfigureServices(IServiceCollection services)
{
#if GENEVA_TELEMETRY
services.AddOpenTelemetryMetrics((builder) => builder
services.AddOpenTelemetry()
.WithMetrics((builder) => builder
.AddAspNetCoreInstrumentation()
.AddGenevaMetricExporter(options =>
{
Expand Down
Loading

0 comments on commit 4c224ab

Please sign in to comment.