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

Update Steeltoe to build and run tests against .NET 9 RC2 #1368

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
8 changes: 6 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ jobs:
displayName: Install .NET 8
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Install .NET 9
inputs:
version: 9.0.x
- task: DotNetCoreCLI@2
displayName: Install Nerdbank.GitVersioning tool
condition: eq(variables['imageName'], 'macOS-latest')
Expand Down Expand Up @@ -101,11 +105,11 @@ jobs:
condition: eq(variables['integrationTests'], 'true')
displayName: Start Docker services
- task: DotNetCoreCLI@2
displayName: dotnet test net8.0
displayName: dotnet test net9.0
inputs:
command: test
projects: '**/*.csproj'
arguments: '--blame-hang-timeout 3m -f net8.0 --no-build -c $(buildConfiguration) -maxcpucount:1 $(skipFilter) --collect "XPlat Code Coverage" --settings coverlet.runsettings --logger trx --results-directory $(Build.SourcesDirectory)'
arguments: '--blame-hang-timeout 3m -f net9.0 --no-build -c $(buildConfiguration) -maxcpucount:1 $(skipFilter) --collect "XPlat Code Coverage" --settings coverlet.runsettings --logger trx --results-directory $(Build.SourcesDirectory)'
publishTestResults: false
- task: CopyFiles@2
condition: failed()
Expand Down
4 changes: 4 additions & 0 deletions build/package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ jobs:
displayName: Install .NET 8
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Install .NET 9
inputs:
version: 9.0.x
- task: PowerShell@2
displayName: Set package version
env:
Expand Down
4 changes: 4 additions & 0 deletions build/pr-code-cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
displayName: Install .NET 8
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Install .NET 9
inputs:
version: 9.0.x
- checkout: self
fetchDepth: 0
persistCredentials: true
Expand Down
8 changes: 6 additions & 2 deletions build/sonar-analyze.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
displayName: Install .NET 8
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Install .NET 9
inputs:
version: 9.0.x
- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
Expand Down Expand Up @@ -55,11 +59,11 @@ jobs:
docker run -d --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3-management
displayName: Start Docker services
- task: DotNetCoreCLI@2
displayName: dotnet test net8.0
displayName: dotnet test net9.0
inputs:
command: test
projects: '**/*.csproj'
arguments: '--blame-hang-timeout 3m -f net8.0 --no-build -c $(buildConfiguration) -maxcpucount:1 --filter "Category!=SkipOnLinux" --collect "XPlat Code Coverage" --settings coverlet.runsettings --logger trx --results-directory $(Build.SourcesDirectory)'
arguments: '--blame-hang-timeout 3m -f net9.0 --no-build -c $(buildConfiguration) -maxcpucount:1 --filter "Category!=SkipOnLinux" --collect "XPlat Code Coverage" --settings coverlet.runsettings --logger trx --results-directory $(Build.SourcesDirectory)'
publishTestResults: false
- task: CopyFiles@2
condition: failed()
Expand Down
14 changes: 12 additions & 2 deletions build/templates/component-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ jobs:
displayName: Install .NET 8
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Install .NET 9
inputs:
version: 9.0.x
- task: DotNetCoreCLI@2
displayName: Install Nerdbank.GitVersioning tool
condition: eq('${{parameters.OS}}', 'macOS')
Expand Down Expand Up @@ -63,12 +67,18 @@ jobs:
- script: docker run -d --name configserver -p 8888:8888 steeltoe.azurecr.io/config-server --spring.cloud.config.server.git.default-label=main; sleep 10s
condition: eq(${{parameters.runConfigServer}}, 'true')
displayName: Start Config Server
- task: PowerShell@2
displayName: Dump env
inputs:
targetType: 'inline'
script: |
gci env: | Format-Table -Wrap -AutoSize
- task: DotNetCoreCLI@2
displayName: dotnet test net8.0
displayName: dotnet test net9.0
inputs:
command: test
projects: $(SolutionFile)
arguments: -f net8.0 ${{parameters.skipFilter}} $(CommonTestArgs)
arguments: -f net9.0 ${{parameters.skipFilter}} $(CommonTestArgs)
publishTestResults: false
- task: CopyFiles@2
condition: failed()
Expand Down
4 changes: 4 additions & 0 deletions build/verify-code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
displayName: Install .NET 8
inputs:
version: 8.0.x
- task: UseDotNet@2
displayName: Install .NET 9
inputs:
version: 9.0.x
- checkout: self
persistCredentials: true
fetchDepth: 0
Expand Down
2 changes: 1 addition & 1 deletion nuget.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<!-- Required for .NET Aspire Configuration Schema Generator, which needs System.CommandLine. -->
Expand Down
2 changes: 2 additions & 0 deletions shared.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
<NuGetAuditMode>direct</NuGetAuditMode>
<NoWarn>$(NoWarn);NU1608</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Package for automatically configuring Steeltoe packages that have separately been added to a project.</Description>
<PackageTags>Autoconfiguration;automatic configuration;application bootstrapping</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
4 changes: 4 additions & 0 deletions src/Common/src/Certificates/ConfigureCertificateOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@ public void Configure(string? name, CertificateOptions options)

options.Certificate = privateKeyFilePath != null && File.Exists(privateKeyFilePath)
? X509Certificate2.CreateFromPemFile(certificateFilePath, privateKeyFilePath)
#pragma warning disable SYSLIB0057 // Type or member is obsolete
: new X509Certificate2(certificateFilePath);
#pragma warning restore SYSLIB0057 // Type or member is obsolete

X509Certificate2[] certificateChain = CertificateRegex.Matches(File.ReadAllText(certificateFilePath))
#pragma warning disable SYSLIB0057 // Type or member is obsolete
.Select(x => new X509Certificate2(Encoding.ASCII.GetBytes(x.Value))).ToArray();
#pragma warning restore SYSLIB0057 // Type or member is obsolete

foreach (X509Certificate2 issuer in certificateChain.Skip(1))
{
Expand Down
4 changes: 4 additions & 0 deletions src/Common/src/Certificates/LocalCertificateWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ public void Write(Guid orgId, Guid spaceId)
}
else
{
#pragma warning disable SYSLIB0057 // Type or member is obsolete
caCertificate = new X509Certificate2(RootCaPfxPath);
#pragma warning restore SYSLIB0057 // Type or member is obsolete
}

// Create the intermediate certificate if it doesn't already exist (can be shared by multiple applications)
Expand All @@ -61,7 +63,9 @@ public void Write(Guid orgId, Guid spaceId)
}
else
{
#pragma warning disable SYSLIB0057 // Type or member is obsolete
intermediateCertificate = new X509Certificate2(IntermediatePfxPath);
#pragma warning restore SYSLIB0057 // Type or member is obsolete
}

var subjectAlternativeNameBuilder = new SubjectAlternativeNameBuilder();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Steeltoe common library for using certificates</Description>
<PackageTags>security;pem;certificate</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Common/Steeltoe.Common.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Steeltoe common library</Description>
<PackageTags>health;health-checks;service-discovery;network</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Hosting/Steeltoe.Common.Hosting.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Steeltoe library for common hosting-related utilities</Description>
<PackageTags>NET Core;Cloud Hosting;</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Http/Steeltoe.Common.Http.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Steeltoe common library for HTTP</Description>
<PackageTags>http; discovery; loadbalancing</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Logging/BootstrapLoggerFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public sealed class BootstrapLoggerFactory : ILoggerFactory
}).Build());
};

private readonly object _lock = new();
private readonly Lock _lock = new();
private readonly Dictionary<string, UpgradableLogger> _loggersByCategoryName = [];
private ILoggerFactory _innerFactory;

Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Logging/Steeltoe.Common.Logging.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Steeltoe library for common logging-related utilities</Description>
<PackageTags>logging</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
2 changes: 1 addition & 1 deletion src/Common/src/Net/Steeltoe.Common.Net.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Steeltoe common library for network interaction</Description>
<PackageTags>Windows-file-sharing; network-file-system</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,19 @@ public void CertificatesIncludeParams()
using var rsa = RSA.Create();

certificateWriter.Write(orgId, spaceId);
#pragma warning disable SYSLIB0057 // Type or member is obsolete
var rootCertificate = new X509Certificate2(LocalCertificateWriter.RootCaPfxPath);
var intermediateCertificate = new X509Certificate2(LocalCertificateWriter.IntermediatePfxPath);
#pragma warning restore SYSLIB0057 // Type or member is obsolete

rsa.ImportFromPem(File.ReadAllText(Path.Combine(LocalCertificateWriter.AppBasePath, LocalCertificateWriter.CertificateDirectoryName,
"SteeltoeAppInstanceKey.pem")));

X509Certificate2 certificate =
#pragma warning disable SYSLIB0057 // Type or member is obsolete
new X509Certificate2(File.ReadAllBytes(Path.Combine(LocalCertificateWriter.AppBasePath, LocalCertificateWriter.CertificateDirectoryName,
"SteeltoeAppInstanceCert.pem"))).CopyWithPrivateKey(rsa);
#pragma warning restore SYSLIB0057 // Type or member is obsolete

rootCertificate.Should().NotBeNull();
intermediateCertificate.Should().NotBeNull();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Common/test/Common.Test/Steeltoe.Common.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Common/test/Http.Test/Steeltoe.Common.Http.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Common/test/Net.Test/Steeltoe.Common.Net.Test.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
</PropertyGroup>

<Import Project="..\..\..\..\shared.props" />
Expand Down
2 changes: 1 addition & 1 deletion src/Common/test/TestResources/CapturingLoggerProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public sealed class CapturingLoggerProvider : ILoggerProvider
private static readonly Func<string, LogLevel, bool> DefaultFilter = (_, _) => true;
private readonly Func<string, LogLevel, bool> _filter;

private readonly object _lockObject = new();
private readonly Lock _lockObject = new();
private readonly List<string> _messages = [];

public CapturingLoggerProvider()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<RootNamespace>Steeltoe.Configuration</RootNamespace>
<Description>Abstractions used in Steeltoe Configuration libraries</Description>
<PackageTags>abstractions;configuration</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Configuration Provider for reading Cloud Foundry environment variables</Description>
<PackageTags>configuration;CloudFoundry;vcap;vcap_application;vcap_services;tanzu</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Configuration provider for reading from Spring Cloud Config Server</Description>
<PackageTags>configuration;Spring Cloud;Spring Cloud Config Server</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ internal sealed partial class DecryptionConfigurationProvider(
IList<IConfigurationProvider> providers, ITextDecryptor? textDecryptor, ILoggerFactory loggerFactory)
: CompositeConfigurationProvider(providers, loggerFactory)
{
#pragma warning disable IDE0052 // Remove unread private members
private readonly ILogger<DecryptionConfigurationProvider> _logger = loggerFactory.CreateLogger<DecryptionConfigurationProvider>();
#pragma warning restore IDE0052 // Remove unread private members
private ITextDecryptor? _textDecryptor = textDecryptor;

[GeneratedRegex("^{cipher}({key:(?<alias>.*)})?(?<cipher>.*)$", RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture, 1000)]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Configuration provider for decrypting encrypted configuration values</Description>
<PackageTags>configuration;cryptography;decryption;spring boot</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Configuration Provider for reading Kubernetes Service Bindings</Description>
<PackageTags>configuration;kubernetes;k8s;service-bindings;tanzu</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Configuration provider for resolving property placeholders in configuration values</Description>
<PackageTags>configuration;placeholders;spring boot</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0</TargetFrameworks>
<TargetFrameworks>net9.0</TargetFrameworks>
<Description>Configuration provider for generating random values</Description>
<PackageTags>configuration;random values</PackageTags>
<IsPackable>true</IsPackable>
Expand Down
Loading
Loading