Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CoreWCF Services Support #5473

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion NuGet.config
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="dotnet-eng" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" />
<add key="dotnet-tools" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-tools/nuget/v3/index.json" />
<add key="dotnet-public" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json" />
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<add key="CoreWCF_Dev" value="https://pkgs.dev.azure.com/dotnet/CoreWCF/_packaging/CoreWCF/nuget/v3/index.json" />
</packageSources>
<disabledPackageSources />
</configuration>
13 changes: 6 additions & 7 deletions System.ServiceModel.sln
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Encoding.MessageVersion.Int
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensibility.MessageEncoder.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Extensibility\MessageEncoder\Extensibility.MessageEncoder.IntegrationTests.csproj", "{76361777-321D-4588-87F9-38992A758350}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensibility.MessageInterceptor.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Extensibility\MessageInterceptor\Extensibility.MessageInterceptor.IntegrationTests.csproj", "{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Extensibility.WebSockets.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Extensibility\WebSockets\Extensibility.WebSockets.IntegrationTests.csproj", "{C8CA16D3-5B1E-4EC0-A817-205A798DC272}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Infrastructure.IntegrationTests", "src\System.Private.ServiceModel\tests\Scenarios\Infrastructure\Infrastructure.IntegrationTests.csproj", "{719E874A-AEFA-44D5-9530-9C41BD0FA4E8}"
Expand Down Expand Up @@ -91,6 +89,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Binding.UDS.IntegrationTest
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.ServiceModel.NetNamedPipe.Tests", "src\System.ServiceModel.NetNamedPipe\tests\System.ServiceModel.NetNamedPipe.Tests.csproj", "{FD188537-21AF-48C5-84FF-F8758F4C42A8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SelfHostedCoreWCFService", "src\System.Private.ServiceModel\tools\SelfHostedCoreWcfService\SelfHostedCoreWCFService.csproj", "{D89D949F-254B-4A29-AE78-DEB081ACA601}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -189,10 +189,6 @@ Global
{76361777-321D-4588-87F9-38992A758350}.Debug|Any CPU.Build.0 = Debug|Any CPU
{76361777-321D-4588-87F9-38992A758350}.Release|Any CPU.ActiveCfg = Release|Any CPU
{76361777-321D-4588-87F9-38992A758350}.Release|Any CPU.Build.0 = Release|Any CPU
{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267}.Release|Any CPU.Build.0 = Release|Any CPU
{C8CA16D3-5B1E-4EC0-A817-205A798DC272}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C8CA16D3-5B1E-4EC0-A817-205A798DC272}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C8CA16D3-5B1E-4EC0-A817-205A798DC272}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -265,6 +261,10 @@ Global
{FD188537-21AF-48C5-84FF-F8758F4C42A8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FD188537-21AF-48C5-84FF-F8758F4C42A8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FD188537-21AF-48C5-84FF-F8758F4C42A8}.Release|Any CPU.Build.0 = Release|Any CPU
{D89D949F-254B-4A29-AE78-DEB081ACA601}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D89D949F-254B-4A29-AE78-DEB081ACA601}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D89D949F-254B-4A29-AE78-DEB081ACA601}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D89D949F-254B-4A29-AE78-DEB081ACA601}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -289,7 +289,6 @@ Global
{48C41A27-631F-45FA-ACD5-7D7EDD4A4931} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
{36DD97F6-1F78-4843-A9C0-58C59D367603} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
{76361777-321D-4588-87F9-38992A758350} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
{ACCCB1B8-5ABE-4F3B-BFEF-9A9C15AA1267} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
{C8CA16D3-5B1E-4EC0-A817-205A798DC272} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
{719E874A-AEFA-44D5-9530-9C41BD0FA4E8} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
{E878E412-F0AB-4D87-8A7A-3114AAC48CD5} = {D6302510-AB10-4775-BCE9-98FA96FDEB76}
Expand Down
5 changes: 5 additions & 0 deletions azure-pipelines-arcade-PR.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ variables:
value: true
- name: _RunAsInternal
value: false
- name: _RunWithCoreWcfService
value: false

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- name: _RunAsPublic
Expand Down Expand Up @@ -126,6 +128,7 @@ stages:
-projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
$(_TestArgs)
/p:TestJob=Windows
/p:RunWithCoreWcfService=$(_RunWithCoreWcfService)
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
displayName: Windows - Run Helix Tests
env:
Expand Down Expand Up @@ -187,6 +190,7 @@ stages:
--projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
$(_TestArgs)
/p:TestJob=Linux
/p:RunWithCoreWcfService=$(_RunWithCoreWcfService)
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
displayName: Linux - Run Helix Tests
env:
Expand Down Expand Up @@ -246,6 +250,7 @@ stages:
-projects $(Build.SourcesDirectory)/eng/SendToHelix.proj
$(_TestArgs)
/p:TestJob=MacOS
/p:RunWithCoreWcfService=$(_RunWithCoreWcfService)
/bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
displayName: MacOS - Run Helix Tests
env:
Expand Down
4 changes: 3 additions & 1 deletion azure-pipelines-arcade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ variables:
value: false
- name: _RunAsInternal
value: true
- name: _RunWithCoreWcfService
value: false
- group: DotNet-Wcf-SDLValidation-Params
resources:
repositories:
Expand Down Expand Up @@ -95,7 +97,7 @@ extends:
clean: true
- script: eng\common\cibuild.cmd -configuration $(_BuildConfig) -preparemachine $(_InternalBuildArgs) $(_TestArgs) /p:Test=false
displayName: Windows Build / Publish
- powershell: eng\common\build.ps1 -configuration $(_BuildConfig) -preparemachine -ci -test -integrationTest -projects $(Build.SourcesDirectory)/eng/SendToHelix.proj $(_TestArgs) /p:TestJob=Windows /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
- powershell: eng\common\build.ps1 -configuration $(_BuildConfig) -preparemachine -ci -test -integrationTest -projects $(Build.SourcesDirectory)/eng/SendToHelix.proj $(_TestArgs) /p:TestJob=Windows /p:RunWithCoreWcfService=$(_RunWithCoreWcfService) /bl:$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)/SendToHelix.binlog
displayName: Windows - Run Helix Tests
env:
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
Expand Down
58 changes: 51 additions & 7 deletions eng/SendToHelix.proj
Original file line number Diff line number Diff line change
@@ -1,19 +1,34 @@
<Project Sdk="Microsoft.DotNet.Helix.Sdk" DefaultTargets="Test">
<Project Sdk="Microsoft.DotNet.Helix.Sdk" InitialTargets="InstallDotNet;Test">
<PropertyGroup>
<HelixSource Condition=" '$(RunAsPublic)' == 'true' ">pr/dotnet/wcf/$(BUILD_SOURCEBRANCH)/</HelixSource>
<HelixSource Condition=" '$(RunAsInternal)' == 'true' ">official/dotnet/wcf/$(BUILD_SOURCEBRANCH)/</HelixSource>
<HelixType>test/product/</HelixType>
<HelixBuild>$(BUILD_BUILDNUMBER)</HelixBuild>
<HelixBuild Condition="'$(HelixBuild)' == ''">123460.01</HelixBuild>
<DotNetCliPackageType>sdk</DotNetCliPackageType>
<DotNetCliVersion>8.0.100</DotNetCliVersion>
<IncludeDotNetCli>true</IncludeDotNetCli>

<!-- Read global.json so we know the version of the dotnet cli we need -->
<GlobalJsonContent>$([System.IO.File]::ReadAllText('$(RepoRoot)global.json'))</GlobalJsonContent>
<DotNetCliPackageType>sdk</DotNetCliPackageType>
<DotNetCliVersion>$([System.Text.RegularExpressions.Regex]::Match($(GlobalJsonContent), '(%3F&lt;="dotnet": ").*(%3F=")'))</DotNetCliVersion>

<IncludeDotNetCli>true</IncludeDotNetCli>
<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
<TestRunNamePrefix>$(AGENT_JOBNAME)</TestRunNamePrefix>

<EnableXUnitReporter>true</EnableXUnitReporter>
</PropertyGroup>

<Target Name="InstallDotNet">
<ItemGroup>
<AdditionalDotNetPackage Include="8.0.5">
<PackageType>aspnetcore-runtime</PackageType>
<Channel>Current</Channel>
</AdditionalDotNetPackage>
</ItemGroup>
</Target>

<ItemGroup>
<ProjectsToBuild Include="..\src\System.Private.ServiceModel\tools\SelfHostedCoreWcfService\SelfHostedCoreWCFService.csproj"/>
</ItemGroup>

<ItemGroup>
<XUnitProject Include="..\src\System.Private.ServiceModel\tests\Scenarios\**\*.IntegrationTests.csproj">
Expand Down Expand Up @@ -54,19 +69,48 @@
<Creator>$(BUILD_SOURCEVERSIONAUTHOR)</Creator>
<Creator Condition=" '$(Creator)' == ''">anon</Creator>
</PropertyGroup>

<PropertyGroup>
<RunWithCoreWCFService Condition="'$(RunWithCoreWCFService)' == ''">false</RunWithCoreWCFService>
</PropertyGroup>

<PropertyGroup Condition="!$(HelixTargetQueue.StartsWith('Windows'))">
<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'false' AND '$(TestJob)' != 'Windows'" >
<HelixPreCommands>$(HelixPreCommands);chmod a+x $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);sudo -E -n $HELIX_CORRELATION_PAYLOAD/InstallRootCertificate.sh --service-host $(ServiceHost) --cert-file /tmp/wcfrootca.crt</HelixPreCommands>
</PropertyGroup>

<Target Name="Pack"/>
<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'true' AND '$(TestJob)' == 'Windows'">
<HelixPreCommands>$(HelixPreCommands);set PATH=%HELIX_CORRELATION_PAYLOAD%\dotnet-cli%3B%PATH%</HelixPreCommands>
<!-- %3B is an escaped ; -->
<HelixPreCommands>$(HelixPreCommands);set DOTNET_ROOT=%HELIX_CORRELATION_PAYLOAD%\dotnet-cli;set DOTNET_CLI_TELEMETRY_OPTOUT=1</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);set DOTNET_CLI_HOME=%HELIX_WORKITEM_ROOT%\.dotnet</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);set NUGET_PACKAGES=%HELIX_WORKITEM_ROOT%\.nuget</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);set ServiceUri=localhost</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);%HELIX_CORRELATION_PAYLOAD%\SelfHostedCoreWCFService\$(Configuration)\net8.0\SelfHostedCoreWCFService bootstrap:true</HelixPreCommands>
</PropertyGroup>

<PropertyGroup Condition="'$(RunWithCoreWcfService)' == 'true' AND '$(TestJob)' != 'Windows'">
<HelixPreCommands>$(HelixPreCommands);export PATH=$HELIX_CORRELATION_PAYLOAD/dotnet-cli:$PATH</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);export DOTNET_ROOT=$HELIX_CORRELATION_PAYLOAD/dotnet-cli;export DOTNET_CLI_TELEMETRY_OPTOUT=1</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);export DOTNET_CLI_HOME=$HELIX_WORKITEM_ROOT/.dotnet</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);export NUGET_PACKAGES=$HELIX_WORKITEM_ROOT/.nuget</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);export ServiceUri=localhost</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);dotnet exec --roll-forward Major $HELIX_CORRELATION_PAYLOAD/SelfHostedCoreWCFService/$(Configuration)/net8.0/SelfHostedCoreWCFService.dll bootstrap:true</HelixPreCommands>
</PropertyGroup>

<Target Name="BuildProjects">
<MSBuild Targets="Publish" Projects="@(ProjectsToBuild)" Properties="PublishDir='$(MSBuildThisFileDirectory)\..\artifacts\bin\SelfHostedCoreWCFService'" />
</Target>

<ItemGroup>
<!-- Directory that is zipped up and sent as a correlation payload to Helix -->
<HelixCorrelationPayload Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\src\System.Private.ServiceModel\tools\scripts'))" >
<PayloadDirectory>%(Identity)</PayloadDirectory>
</HelixCorrelationPayload>

<HelixCorrelationPayload Include="$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\..\artifacts\bin\SelfHostedCoreWCFService'))" >
<Destination>SelfHostedCoreWCFService</Destination>
</HelixCorrelationPayload>
</ItemGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,14 @@ public static string GetResourceFromServiceAsString(string resource)
using (HttpClient httpClient = new HttpClient())
{
HttpResponseMessage response = httpClient.GetAsync(requestUri).GetAwaiter().GetResult();
return response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
if (response.IsSuccessStatusCode)
{
return response.Content.ReadAsStringAsync().GetAwaiter().GetResult();
}
else
{
throw new Exception($"Got Status code {response.StatusCode} from {requestUri}.");
}
}
}

Expand All @@ -547,7 +554,14 @@ public static byte[] GetResourceFromServiceAsByteArray(string resource)
using (HttpClient httpClient = new HttpClient())
{
HttpResponseMessage response = httpClient.GetAsync(requestUri).GetAwaiter().GetResult();
return response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult();
if (response.IsSuccessStatusCode)
{
return response.Content.ReadAsByteArrayAsync().GetAwaiter().GetResult();
}
else
{
throw new Exception($"Got Status code {response.StatusCode} from {requestUri}.");
}
}
}

Expand All @@ -559,7 +573,14 @@ public static async Task<byte[]> GetResourceFromServiceAsByteArrayAsync(string r
using (HttpClient httpClient = new HttpClient())
{
HttpResponseMessage response = await httpClient.GetAsync(requestUri);
return await response.Content.ReadAsByteArrayAsync();
if (response.IsSuccessStatusCode)
{
return await response.Content.ReadAsByteArrayAsync();
}
else
{
throw new Exception($"Got Status code {response.StatusCode} from {requestUri}.");
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(ServiceTcpPort)' == ''">
<ServiceTcpPort>809</ServiceTcpPort>
<ServiceTcpPort>8808</ServiceTcpPort>
</PropertyGroup>

<PropertyGroup Condition="'$(ServiceWebSocketPort)' == ''">
Expand Down
Loading
Loading