diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 32c85b632fa..91f240a760e 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -108,7 +108,17 @@ jobs: - name: Trust HTTPS development certificate (Linux) if: inputs.os == 'ubuntu-latest' - run: ${{ env.DOTNET_SCRIPT }} dev-certs https --trust + # Allow the task to succeed on partial trust. + # Remove this workaround once https://github.com/dotnet/aspnetcore/pull/65392 has shipped + run: | + EXIT_CODE=0 + ${{ env.DOTNET_SCRIPT }} dev-certs https --trust || EXIT_CODE=$? + if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 4 ]; then + echo "dev-certs https --trust failed with exit code $EXIT_CODE" + exit $EXIT_CODE + fi + env: + WSL_INTEROP: "" - name: Verify Docker is running # nested docker containers not supported on windows diff --git a/global.json b/global.json index 4b04b6417a9..da2bc9f162c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "10.0.101", + "version": "10.0.103", "rollForward": "major", "allowPrerelease": true, "paths": [ @@ -10,7 +10,7 @@ "errorMessage": "The .NET SDK could not be found. Run ./restore.sh (Linux/macOS) or ./restore.cmd (Windows) to install the local SDK." }, "tools": { - "dotnet": "10.0.101", + "dotnet": "10.0.103", "runtimes": { "dotnet/x64": [ "$(DotNetRuntimePreviousVersionForTesting)", diff --git a/src/Aspire.Cli/DotNet/DotNetCliRunner.cs b/src/Aspire.Cli/DotNet/DotNetCliRunner.cs index 32837b9f2da..690df26eb5d 100644 --- a/src/Aspire.Cli/DotNet/DotNetCliRunner.cs +++ b/src/Aspire.Cli/DotNet/DotNetCliRunner.cs @@ -449,7 +449,7 @@ public async Task TrustHttpCertificateAsync(DotNetCliRunnerInvocationOption } } - private static bool TryParsePackageVersionFromStdout(string stdout, [NotNullWhen(true)] out string? version) + internal static bool TryParsePackageVersionFromStdout(string stdout, [NotNullWhen(true)] out string? version) { var lines = stdout.Split(Environment.NewLine); var successLine = lines.SingleOrDefault(x => x.StartsWith("Success: Aspire.ProjectTemplates")); @@ -461,9 +461,12 @@ private static bool TryParsePackageVersionFromStdout(string stdout, [NotNullWhen } var templateVersion = successLine.Split(" ") switch { // Break up the success line. - { Length: > 2 } chunks => chunks[1].Split("::") switch { // Break up the template+version string + { Length: > 2 } chunks => chunks[1].Split("@") switch { // Break up the template+version string (@ separator for .NET 10.0+) { Length: 2 } versionChunks => versionChunks[1], // The version in the second chunk - _ => null + _ => chunks[1].Split("::") switch { // Fallback to :: separator for older SDK versions + { Length: 2 } versionChunks => versionChunks[1], + _ => null + } }, _ => null }; diff --git a/tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs b/tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs index ffd41df618e..378380b8cd0 100644 --- a/tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs +++ b/tests/Aspire.Cli.Tests/DotNet/DotNetCliRunnerTests.cs @@ -1291,6 +1291,21 @@ await runner.GetProjectItemsAndPropertiesAsync( CancellationToken.None ); } + + [Theory] + [InlineData("Success: Aspire.ProjectTemplates@13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // New .NET 10.0 SDK format with @ separator + [InlineData("Success: Aspire.ProjectTemplates::13.2.0-preview.1.26101.12 installed the following templates:", true, "13.2.0-preview.1.26101.12")] // Old SDK format with :: separator + [InlineData("Some other output", false, null)] // Missing success line + [InlineData("Success: Aspire.ProjectTemplates installed the following templates:", false, null)] // Invalid format without version separator + public void TryParsePackageVersionFromStdout_ParsesCorrectly(string stdout, bool expectedResult, string? expectedVersion) + { + // Act + var result = DotNetCliRunner.TryParsePackageVersionFromStdout(stdout, out var version); + + // Assert + Assert.Equal(expectedResult, result); + Assert.Equal(expectedVersion, version); + } } internal sealed class AssertingDotNetCliRunner(