Skip to content

Commit

Permalink
Merged PR 35038: Merge branch 'release/8.0-preview1' into 'internal/r…
Browse files Browse the repository at this point in the history
…elease/8.0-preview1'

Related work items: #467, #564, #648, #662, #664, #665, #669
  • Loading branch information
joperezr committed Nov 3, 2023
2 parents 3a0df4a + f8a6a44 commit 67464f9
Show file tree
Hide file tree
Showing 37 changed files with 1,547 additions and 42 deletions.
28 changes: 28 additions & 0 deletions Aspire.sln
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Hosting.Azure.Provis
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "eShopLite", "eShopLite", "{A68BA1A5-1604-433D-9778-DC0199831C2A}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.Azure.Cosmos", "src\Components\Aspire.Microsoft.Azure.Cosmos\Aspire.Microsoft.Azure.Cosmos.csproj", "{23298562-C1D4-41CD-83FE-426C94FEE35F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.EntityFrameworkCore.Cosmos", "src\Components\Aspire.Microsoft.EntityFrameworkCore.Cosmos\Aspire.Microsoft.EntityFrameworkCore.Cosmos.csproj", "{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.Azure.Cosmos.Tests", "tests\Aspire.Microsoft.Azure.Cosmos.Tests\Aspire.Microsoft.Azure.Cosmos.Tests.csproj", "{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests", "tests\Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests\Aspire.Microsoft.EntityFrameworkCore.Cosmos.Tests.csproj", "{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CatalogDb", "samples\eShopLite\CatalogDb\CatalogDb.csproj", "{A84C4EE3-2601-4804-BCDC-E9948E164A22}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{991DB378-6CB5-4441-BFC3-657400690FC3}"
Expand Down Expand Up @@ -370,6 +378,22 @@ Global
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D}.Release|Any CPU.Build.0 = Release|Any CPU
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{23298562-C1D4-41CD-83FE-426C94FEE35F}.Release|Any CPU.Build.0 = Release|Any CPU
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Debug|Any CPU.Build.0 = Debug|Any CPU
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Release|Any CPU.ActiveCfg = Release|Any CPU
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63}.Release|Any CPU.Build.0 = Release|Any CPU
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8}.Release|Any CPU.Build.0 = Release|Any CPU
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Debug|Any CPU.Build.0 = Debug|Any CPU
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Release|Any CPU.ActiveCfg = Release|Any CPU
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596}.Release|Any CPU.Build.0 = Release|Any CPU
{A84C4EE3-2601-4804-BCDC-E9948E164A22}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A84C4EE3-2601-4804-BCDC-E9948E164A22}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A84C4EE3-2601-4804-BCDC-E9948E164A22}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down Expand Up @@ -446,6 +470,10 @@ Global
{E2EC79D0-80F7-4471-9613-D7C8C3D52F95} = {B80354C7-BE58-43F6-8928-9F3A74AB7F47}
{D4BD974F-6505-43FC-A94E-2019F0DB5D5D} = {B80354C7-BE58-43F6-8928-9F3A74AB7F47}
{A68BA1A5-1604-433D-9778-DC0199831C2A} = {D173887B-AF42-4576-B9C1-96B9E9B3D9C0}
{23298562-C1D4-41CD-83FE-426C94FEE35F} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2}
{00C9BA50-2AFB-4D9C-A2D6-8154BCCD0A63} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2}
{A5836BC1-6A45-4BB6-9D22-A7F750890AB8} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
{FDA02617-9C49-4DA8-A43A-A34DBA9B8596} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
{A84C4EE3-2601-4804-BCDC-E9948E164A22} = {A68BA1A5-1604-433D-9778-DC0199831C2A}
{4D8A92AB-4E77-4965-AD8E-8E206DCE66A4} = {27381127-6C45-4B4C-8F18-41FF48DFE4B2}
{165411FE-755E-4869-A756-F87F455860AC} = {4981B3A5-4AFD-4191-BF7D-8692D9783D60}
Expand Down
4 changes: 3 additions & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageVersion Include="Azure.Security.KeyVault.Secrets" Version="4.5.0" />
<PackageVersion Include="Azure.Storage.Blobs" Version="12.18.0" />
<PackageVersion Include="Azure.Storage.Queues" Version="12.16.0" />
<PackageVersion Include="Microsoft.Azure.Cosmos" Version="3.36.0-preview" />
<PackageVersion Include="Microsoft.Extensions.Azure" Version="1.7.1" />
<!-- Azure Management SDK for .NET dependencies -->
<PackageVersion Include="Azure.ResourceManager.KeyVault" Version="1.2.0-beta.2" />
Expand Down Expand Up @@ -44,6 +45,7 @@
<!-- sql client dependencies -->
<PackageVersion Include="Microsoft.Data.SqlClient" Version="5.1.1" />
<!-- efcore dependencies -->
<PackageVersion Include="Microsoft.EntityFrameworkCore.Cosmos" Version="$(EfCoreVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="$(EfCoreVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="$(EfCoreVersion)" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="$(EfCoreVersion)" />
Expand Down Expand Up @@ -100,4 +102,4 @@
<PackageVersion Include="Microsoft.Signed.Wix" Version="1.0.0-v3.14.0.5722" />
<PackageVersion Include="Microsoft.DotNet.Build.Tasks.Installers" Version="8.0.0-beta.23371.1" />
</ItemGroup>
</Project>
</Project>
28 changes: 14 additions & 14 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<Dependencies>
<ProductDependencies>
<Dependency Name="Microsoft.DeveloperControlPlane.darwin-amd64" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.darwin-amd64" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.DeveloperControlPlane.darwin-arm64" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.darwin-arm64" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.DeveloperControlPlane.linux-amd64" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.linux-amd64" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.DeveloperControlPlane.linux-arm64" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.linux-arm64" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.DeveloperControlPlane.windows-386" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.windows-386" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.DeveloperControlPlane.windows-amd64" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.windows-amd64" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.DeveloperControlPlane.windows-arm64" Version="0.1.41">
<Dependency Name="Microsoft.DeveloperControlPlane.windows-arm64" Version="0.1.42">
<Uri>https://github.com/microsoft/usvc-apiserver</Uri>
<Sha>7a020a231e5b13608ab3749d30263269ff32984d</Sha>
<Sha>5173daa9d8649d3b1af7025adc0d3431a2b7434b</Sha>
</Dependency>
<Dependency Name="Microsoft.Extensions.Http.Resilience" Version="8.0.0">
<Uri>https://dev.azure.com/dnceng/internal/_git/dotnet-extensions</Uri>
Expand Down
14 changes: 7 additions & 7 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
<PropertyGroup>
<!-- Package versions defined directly in <reporoot>/Directory.Packages.props -->
<MicrosoftDotnetSdkInternalPackageVersion>8.0.100-rtm.23512.16</MicrosoftDotnetSdkInternalPackageVersion>
<MicrosoftDeveloperControlPlanedarwinamd64PackageVersion>0.1.41</MicrosoftDeveloperControlPlanedarwinamd64PackageVersion>
<MicrosoftDeveloperControlPlanedarwinarm64PackageVersion>0.1.41</MicrosoftDeveloperControlPlanedarwinarm64PackageVersion>
<MicrosoftDeveloperControlPlanelinuxamd64PackageVersion>0.1.41</MicrosoftDeveloperControlPlanelinuxamd64PackageVersion>
<MicrosoftDeveloperControlPlanelinuxarm64PackageVersion>0.1.41</MicrosoftDeveloperControlPlanelinuxarm64PackageVersion>
<MicrosoftDeveloperControlPlanewindows386PackageVersion>0.1.41</MicrosoftDeveloperControlPlanewindows386PackageVersion>
<MicrosoftDeveloperControlPlanewindowsamd64PackageVersion>0.1.41</MicrosoftDeveloperControlPlanewindowsamd64PackageVersion>
<MicrosoftDeveloperControlPlanewindowsarm64PackageVersion>0.1.41</MicrosoftDeveloperControlPlanewindowsarm64PackageVersion>
<MicrosoftDeveloperControlPlanedarwinamd64PackageVersion>0.1.42</MicrosoftDeveloperControlPlanedarwinamd64PackageVersion>
<MicrosoftDeveloperControlPlanedarwinarm64PackageVersion>0.1.42</MicrosoftDeveloperControlPlanedarwinarm64PackageVersion>
<MicrosoftDeveloperControlPlanelinuxamd64PackageVersion>0.1.42</MicrosoftDeveloperControlPlanelinuxamd64PackageVersion>
<MicrosoftDeveloperControlPlanelinuxarm64PackageVersion>0.1.42</MicrosoftDeveloperControlPlanelinuxarm64PackageVersion>
<MicrosoftDeveloperControlPlanewindows386PackageVersion>0.1.42</MicrosoftDeveloperControlPlanewindows386PackageVersion>
<MicrosoftDeveloperControlPlanewindowsamd64PackageVersion>0.1.42</MicrosoftDeveloperControlPlanewindowsamd64PackageVersion>
<MicrosoftDeveloperControlPlanewindowsarm64PackageVersion>0.1.42</MicrosoftDeveloperControlPlanewindowsarm64PackageVersion>
<MicrosoftNETCoreAppRefPackageVersion>8.0.0-rc.1.23419.3</MicrosoftNETCoreAppRefPackageVersion>
<MicrosoftmacOSSdkPackageVersion>13.3.8825-net8-rc1</MicrosoftmacOSSdkPackageVersion>
<MicrosoftDotNetBuildTasksPackagingVersion>8.0.0-beta.23525.4</MicrosoftDotNetBuildTasksPackagingVersion>
Expand Down
4 changes: 2 additions & 2 deletions samples/eShopLite/ServiceDefaults/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)
// app.MapPrometheusScrapingEndpoint();

// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks("/readiness");
app.MapHealthChecks("/health");

// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks("/liveness", new HealthCheckOptions
app.MapHealthChecks("/alive", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.Data.Cosmos;
using System.Text.Json;

namespace Aspire.Hosting;

/// <summary>
/// Provides extension methods for adding Azure Cosmos DB resources to an <see cref="IDistributedApplicationBuilder"/>.
/// </summary>
public static class AzureCosmosDBCloudApplicationBuilderExtensions
{
/// <summary>
/// Adds an Azure Cosmos DB connection to the application model.
/// </summary>
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/>.</param>
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
/// <param name="connectionString">The connection string.</param>
/// <returns>A reference to the <see cref="IResourceBuilder{AzureCosmosDatabaseResource}"/>.</returns>
public static IResourceBuilder<AzureCosmosDBConnectionResource> AddAzureCosmosDB(
this IDistributedApplicationBuilder builder,
string name,
string? connectionString = null)
{
var connection = new AzureCosmosDBConnectionResource(name, connectionString);
return builder.AddResource(connection)
.WithAnnotation(new ManifestPublishingCallbackAnnotation(jsonWriter => WriteCosmosDBConnectionToManifest(jsonWriter, connection)));
}

private static void WriteCosmosDBConnectionToManifest(Utf8JsonWriter jsonWriter, AzureCosmosDBConnectionResource cosmosDbConnection)
{
jsonWriter.WriteString("type", "azure.cosmosdb.connection.v0");
jsonWriter.WriteString("connectionString", cosmosDbConnection.GetConnectionString());
}

private static void WriteCosmosDBDatabaseToManifest(Utf8JsonWriter jsonWriter, AzureCosmosDatabaseResource cosmosDatabase)
{
jsonWriter.WriteString("type", "azure.cosmosdb.database.v0");
jsonWriter.WriteString("parent", cosmosDatabase.Parent.Name);
jsonWriter.WriteString("databaseName", cosmosDatabase.Name);
}

/// <summary>
/// Adds an Azure Cosmos DB database to a <see cref="IResourceBuilder{AzureCosmosDatabaseResource}"/>.
/// </summary>
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/>.</param>
/// <param name="name">The name of the resource. This name will be used as the connection string name when referenced in a dependency.</param>
/// <returns>A reference to the <see cref="IResourceBuilder{AzureCosmosDatabaseResource}"/>.</returns>
public static IResourceBuilder<AzureCosmosDatabaseResource> AddDatabase(this IResourceBuilder<AzureCosmosDBConnectionResource> builder, string name)
{
var cosmosDatabase = new AzureCosmosDatabaseResource(name, builder.Resource);
return builder
.ApplicationBuilder
.AddResource(cosmosDatabase)
.WithAnnotation(new ManifestPublishingCallbackAnnotation(
(json) => WriteCosmosDBDatabaseToManifest(json, cosmosDatabase)));
}
}
21 changes: 21 additions & 0 deletions src/Aspire.Hosting.Azure/AzureCosmosDBConnectionResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Aspire.Hosting.ApplicationModel;

namespace Aspire.Hosting.Azure.Data.Cosmos;

/// <summary>
/// Represents a connection to an Azure Cosmos DB account.
/// </summary>
/// <param name="name">The resource name.</param>
/// <param name="connectionString">The connection string to use to connect.</param>
public class AzureCosmosDBConnectionResource(string name, string? connectionString)
: Resource(name), IResourceWithConnectionString
{
/// <summary>
/// Gets the connection string to use for this database.
/// </summary>
/// <returns>The connection string to use for this database.</returns>
public string? GetConnectionString() => connectionString;
}
29 changes: 29 additions & 0 deletions src/Aspire.Hosting.Azure/AzureCosmosDatabaseResource.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using Aspire.Hosting.ApplicationModel;

namespace Aspire.Hosting.Azure.Data.Cosmos;

/// <summary>
/// Represents an Azure Cosmos DB database.
/// </summary>
/// <param name="name">The database name.</param>
/// <param name="parent">The parent <see cref="AzureCosmosDBConnectionResource"/>.</param>
public class AzureCosmosDatabaseResource(string name, AzureCosmosDBConnectionResource parent)
: Resource(name), IResourceWithParent<AzureCosmosDBConnectionResource>, IResourceWithConnectionString
{
/// <summary>
/// Gets the parent <see cref="AzureCosmosDBConnectionResource"/>.
/// </summary>
public AzureCosmosDBConnectionResource Parent { get; } = parent;

/// <summary>
/// Gets the connection string to use for this database.
/// </summary>
/// <returns>The connection string to use for this database.</returns>
public string? GetConnectionString()
{
return Parent.GetConnectionString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)
// app.MapPrometheusScrapingEndpoint();

// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks("/readiness");
app.MapHealthChecks("/health");

// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks("/liveness", new HealthCheckOptions
app.MapHealthChecks("/alive", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,10 @@ public static WebApplication MapDefaultEndpoints(this WebApplication app)
// app.MapPrometheusScrapingEndpoint();

// All health checks must pass for app to be considered ready to accept traffic after starting
app.MapHealthChecks("/readiness");
app.MapHealthChecks("/health");

// Only health checks tagged with the "live" tag must pass for app to be considered alive
app.MapHealthChecks("/liveness", new HealthCheckOptions
app.MapHealthChecks("/alive", new HealthCheckOptions
{
Predicate = r => r.Tags.Contains("live")
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>$(NetCurrent)</TargetFramework>
<IsPackable>true</IsPackable>
<EnableConfigurationBindingGenerator>false</EnableConfigurationBindingGenerator>
<IsAotCompatible>false</IsAotCompatible>
<PackageTags>$(ComponentAzurePackageTags) cosmos cosmosdb data database db</PackageTags>
<Description>A client for Azure Cosmos DB that integrates with Aspire, including logging and telemetry.</Description>
<PackageIconFullPath>$(SharedDir)AzureCosmosDB_256x.png</PackageIconFullPath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Azure.Identity" />
<PackageReference Include="Microsoft.Azure.Cosmos" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" />
</ItemGroup>

</Project>
Loading

0 comments on commit 67464f9

Please sign in to comment.