Skip to content

Commit 4c224ab

Browse files
rzikmIlya SkuratovskyantonfirsovManickaP
authored
Add deploy pipeline for networking echo test servers. (#111398)
* 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]>
1 parent e93f360 commit 4c224ab

File tree

6 files changed

+416
-10
lines changed

6 files changed

+416
-10
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# This pipeline deploys the test servers we are using to run (outerloop) Functional tests for various functionality in System.Net namespace.
2+
# The pipeline deploys to staging slots, which are available at
3+
# - corefx-net-http11-staging.azurewebsites.net
4+
# - corefx-net-http2-staging.azurewebsites.net
5+
#
6+
# Usage instructions:
7+
# 1) Start pipeline at https://dev.azure.com/dnceng/internal/_build?definitionId=1419 (
8+
deploy-networking-echo-test-servers), pick the correct branch and start the build.
9+
# 2) After pipeline succeeds, check your changes against the staging slots, two possible ways to do this are:
10+
# - create a no-merge PR where you overwrite the default urls (e.g. https://github.com/dotnet/runtime/pull/111396)
11+
# - test locally, either by same changes as in above PR, or by using the override environment variables
12+
#
13+
# DOTNET_TEST_HTTPHOST=http://corefx-net-http11-staging.azurewebsites.net
14+
# DOTNET_TEST_SECUREHTTPHOST=https://corefx-net-http11-staging.azurewebsites.net
15+
# DOTNET_TEST_WEBSOKETHOST=http://corefx-net-http11-staging.azurewebsites.net
16+
# DOTNET_TEST_SECUREWEBSOKETHOST=http://corefx-net-http11-staging.azurewebsites.net
17+
#
18+
# DOTNET_TEST_HTTP2HOST=http://corefx-net-http2-staging.azurewebsites.net
19+
# 3) If there are no issues, you can swap the staging slots with production slots via the Azure portal.
20+
# Only the members of the .NET Networking team have access to the Azure Subscription which hosts the
21+
# servers. Look for the "Deployment slots" section at corefx-net-http11 and corefx-net-http2 Web Apps
22+
23+
trigger: none
24+
25+
resources:
26+
repositories:
27+
- repository: 1ESPipelineTemplates
28+
type: git
29+
name: 1ESPipelineTemplates/1ESPipelineTemplates
30+
ref: refs/tags/release
31+
32+
variables:
33+
- template: /eng/common/templates-official/variables/pool-providers.yml
34+
- name: FrameworkVersion
35+
value: 8.x
36+
- name: TargetFramework
37+
value: net8.0
38+
39+
extends:
40+
template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates
41+
parameters:
42+
customBuildTags:
43+
- 1ES.PT.ViaStartRight
44+
pool:
45+
name: $(DncEngInternalBuildPool)
46+
image: 1es-windows-2022
47+
os: windows
48+
49+
stages:
50+
- stage: stage
51+
displayName: Building in a VM
52+
jobs:
53+
- job: job
54+
displayName: Build
55+
steps:
56+
- checkout: self
57+
58+
- task: UseDotNet@2
59+
inputs:
60+
packageType: "sdk"
61+
version: $(FrameworkVersion)
62+
63+
- script: echo {} > ./global.json
64+
displayName: Bypass repository global.json
65+
workingDirectory: ./src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer
66+
67+
- script: dotnet publish -c Release /p:GenevaTelemetry=true /p:_TargetFrameworkForXHarness=$(TargetFramework)
68+
workingDirectory: ./src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer
69+
displayName: Run dotnet publish
70+
71+
- task: zip@0
72+
displayName: Zip artifacts
73+
inputs:
74+
pathToZipFolder: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish\'
75+
pathToZipFile: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish.zip'
76+
77+
- task: AzureRmWebAppDeployment@4
78+
displayName: Deploy to corefx-net-http11-staging
79+
inputs:
80+
ConnectionType: "AzureRM"
81+
azureSubscription: .NET Libraries Network Testing
82+
appType: "webApp"
83+
WebAppName: "corefx-net-http11"
84+
deployToSlotOrASE: true
85+
ResourceGroupName: "Production-WestUS"
86+
SlotName: "staging"
87+
package: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish.zip'
88+
89+
- task: AzureRmWebAppDeployment@4
90+
displayName: Deploy to corefx-net-http2-staging
91+
inputs:
92+
ConnectionType: "AzureRM"
93+
azureSubscription: .NET Libraries Network Testing
94+
appType: "webApp"
95+
WebAppName: "corefx-net-http2"
96+
deployToSlotOrASE: true
97+
ResourceGroupName: "Production-WestUS"
98+
SlotName: "staging"
99+
package: 'artifacts\bin\NetCoreServer\Release\$(TargetFramework)\publish.zip'

src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Directory.Build.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
</PropertyGroup>
55

66
<Import Project="$([MSBuild]::NormalizePath($(RepositoryRoot), 'eng', 'testing', 'ForXHarness.Directory.Build.props'))" />
7+
<Import Project="$([MSBuild]::NormalizePath($(RepositoryRoot), 'eng', 'Versions.props'))" />
78
</Project>

src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/GenericHandler.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ public GenericHandler(RequestDelegate next)
1919
public async Task Invoke(HttpContext context)
2020
{
2121
PathString path = context.Request.Path;
22+
if (path.Equals(new PathString("/swagger.json")))
23+
{
24+
using (var stream = typeof(GenericHandler).Assembly.GetManifestResourceStream("NetCoreServer.swagger.json"))
25+
{
26+
context.Response.ContentType = "application/json";
27+
await stream.CopyToAsync(context.Response.Body);
28+
}
29+
return;
30+
}
31+
2232
if (path.Equals(new PathString("/deflate.ashx")))
2333
{
2434
await DeflateHandler.InvokeAsync(context);

src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/NetCoreServer.csproj

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,16 @@
1616
</ItemGroup>
1717

1818
<ItemGroup Condition="'$(GenevaTelemetry)' == 'true'">
19-
<PackageReference Include="OpenTelemetry" Version="1.2.0-rc2" />
20-
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.2.0-rc2" />
21-
<PackageReference Include="OpenTelemetry.Exporter.Geneva" Version="1.2.1" />
22-
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.0.0-rc9" />
23-
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9" />
19+
<PackageReference Include="OpenTelemetry" Version="1.10.0" />
20+
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
21+
<PackageReference Include="OpenTelemetry.Exporter.Geneva" Version="1.7.0" />
22+
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
23+
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
24+
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="9.0.0" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<EmbeddedResource Include="swagger.json" />
2429
</ItemGroup>
2530

2631
<ItemGroup>

src/libraries/Common/tests/System/Net/Prerequisites/NetCoreServer/Startup.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
using OpenTelemetry.Trace;
1111
using OpenTelemetry.Metrics;
1212
using OpenTelemetry.Exporter.Geneva;
13-
using System.Diagnostics.Metrics;
14-
using Microsoft.AspNetCore.Http;
15-
using System.Threading.Tasks;
16-
using System.Diagnostics;
1713
using System.Collections.Generic;
1814
#endif
1915

@@ -31,7 +27,8 @@ public Startup(IConfiguration configuration)
3127
public void ConfigureServices(IServiceCollection services)
3228
{
3329
#if GENEVA_TELEMETRY
34-
services.AddOpenTelemetryMetrics((builder) => builder
30+
services.AddOpenTelemetry()
31+
.WithMetrics((builder) => builder
3532
.AddAspNetCoreInstrumentation()
3633
.AddGenevaMetricExporter(options =>
3734
{

0 commit comments

Comments
 (0)