Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
<PackageReference Include="Azure.Provisioning.KeyVault" />
<PackageReference Include="Azure.Provisioning.Storage" />
<ProjectReference Include="..\Aspire.Hosting.Azure\Aspire.Hosting.Azure.csproj" />
<ProjectReference Include="..\Aspire.Hosting.Azure.ContainerRegistry\Aspire.Hosting.Azure.ContainerRegistry.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ public static IResourceBuilder<AzureContainerAppEnvironmentResource> AddAzureCon
infra.Add(identity);

ContainerRegistryService? containerRegistry = null;
#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
if (appEnvResource.TryGetLastAnnotation<ContainerRegistryReferenceAnnotation>(out var registryReferenceAnnotation) && registryReferenceAnnotation.Registry is AzureProvisioningResource registry)
#pragma warning restore ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
{
containerRegistry = (ContainerRegistryService)registry.AddAsExistingResource(infra);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<PackageReference Include="Azure.Provisioning.AppService" />
<PackageReference Include="Azure.Provisioning.ContainerRegistry" />
<ProjectReference Include="..\Aspire.Hosting.Azure\Aspire.Hosting.Azure.csproj" />
<ProjectReference Include="..\Aspire.Hosting.Azure.ContainerRegistry\Aspire.Hosting.Azure.ContainerRegistry.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ public static IResourceBuilder<AzureAppServiceEnvironmentResource> AddAzureAppSe
infra.Add(identity);

ContainerRegistryService? containerRegistry = null;
#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
if (resource.TryGetLastAnnotation<ContainerRegistryReferenceAnnotation>(out var registryReferenceAnnotation) && registryReferenceAnnotation.Registry is AzureProvisioningResource registry)
#pragma warning restore ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
{
containerRegistry = (ContainerRegistryService)registry.AddAsExistingResource(infra);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using Aspire.Hosting.ApplicationModel;

namespace Aspire.Hosting.Azure.AppService;
namespace Aspire.Hosting.Azure;

/// <summary>
/// Represents an Azure App Service Environment resource.
Expand Down Expand Up @@ -33,4 +33,4 @@ public class AzureAppServiceEnvironmentResource(string name, Action<AzureResourc

ReferenceExpression IContainerRegistry.Endpoint =>
ReferenceExpression.Create($"{ContainerRegistryUrl}");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure;
using Aspire.Hosting.Azure.ContainerRegistry;
using Azure.Provisioning;
using Azure.Provisioning.ContainerRegistry;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
Expand All @@ -7,7 +7,7 @@
using Azure.Provisioning.ContainerRegistry;
using Azure.Provisioning.Primitives;

namespace Aspire.Hosting.Azure.ContainerRegistry;
namespace Aspire.Hosting.Azure;

/// <summary>
/// Represents an Azure Container Registry resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure;
using Azure.Provisioning;

namespace Aspire.Hosting;
namespace Aspire.Hosting.Azure;

/// <summary>
/// A resource that represents an Azure Blob Storage container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure;

namespace Aspire.Hosting.Azure;

/// <summary>
/// Provides extension methods for adding Azure environment resources to the application model.
Expand Down
2 changes: 1 addition & 1 deletion src/Aspire.Hosting.Azure/AzurePublishingContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public sealed class AzurePublishingContext(
/// <summary>
/// Gets the main.bicep infrastructure for the distributed application.
/// </summary>
public Infrastructure MainInfrastructure = new()
public Infrastructure MainInfrastructure { get; } = new()
{
TargetScope = DeploymentScope.Subscription
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
#pragma warning disable ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Docker.Resources;
Expand Down Expand Up @@ -53,9 +54,7 @@ public DockerComposeEnvironmentResource(string name) : base(name)

private Task PublishAsync(PublishingContext context)
{
#pragma warning disable ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
var imageBuilder = context.Services.GetRequiredService<IResourceContainerImageBuilder>();
#pragma warning restore ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

var dockerComposePublishingContext = new DockerComposePublishingContext(
context.ExecutionContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
#pragma warning disable ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using Aspire.Hosting.ApplicationModel;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#pragma warning disable ASPIRECOMPUTE001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;

namespace Aspire.Hosting.ApplicationModel;

/// <summary>
Expand All @@ -12,6 +12,7 @@ namespace Aspire.Hosting.ApplicationModel;
/// Initializes a new instance of the <see cref="ContainerRegistryReferenceAnnotation"/> class.
/// </remarks>
/// <param name="registry">The container registry resource.</param>
[Experimental("ASPIRECOMPUTE001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public class ContainerRegistryReferenceAnnotation(IContainerRegistry registry) : IResourceAnnotation
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;

namespace Aspire.Hosting.ApplicationModel;

/// <summary>
Expand All @@ -10,10 +12,11 @@ namespace Aspire.Hosting.ApplicationModel;
/// Initializes a new instance of the <see cref="PublishingCallbackAnnotation"/> class.
/// </remarks>
/// <param name="callback">The publishing callback.</param>
[Experimental("ASPIREPUBLISHERS001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public sealed class PublishingCallbackAnnotation(Func<PublishingContext, Task> callback) : IResourceAnnotation
{
/// <summary>
/// The publishing callback.
/// </summary>
public Func<PublishingContext, Task> Callback { get; } = callback ?? throw new ArgumentNullException(nameof(callback));
}
}
10 changes: 9 additions & 1 deletion src/Aspire.Hosting/CompatibilitySuppressions.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- https://learn.microsoft.com/dotnet/fundamentals/package-validation/diagnostic-ids -->
<Suppressions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!-- Shipped as experimental in 9.2 but removed because we no longer have multiple publishers -->
<Suppression>
<DiagnosticId>CP0001</DiagnosticId>
<Target>T:Aspire.Hosting.PublisherDistributedApplicationBuilderExtensions</Target>
<Left>lib/net8.0/Aspire.Hosting.dll</Left>
<Right>lib/net8.0/Aspire.Hosting.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
<!-- Shipped as experimental in 9.2 but removed because we are removing inspect mode -->
<Suppression>
<DiagnosticId>CP0002</DiagnosticId>
Expand All @@ -16,4 +24,4 @@
<Right>lib/net8.0/Aspire.Hosting.dll</Right>
<IsBaselineSuppression>true</IsBaselineSuppression>
</Suppression>
</Suppressions>
</Suppressions>
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Aspire.Hosting.Publishing;
using Microsoft.Extensions.DependencyInjection;

Expand All @@ -10,7 +9,7 @@ namespace Aspire.Hosting;
/// <summary>
/// Extensions for adding a publisher to the distributed application.
/// </summary>
public static class PublisherDistributedApplicationBuilderExtensions
internal static class PublisherDistributedApplicationBuilderExtensions
{
/// <summary>
/// Adds a publisher to the distributed application for use by the Aspire CLI.
Expand All @@ -20,8 +19,7 @@ public static class PublisherDistributedApplicationBuilderExtensions
/// <param name="builder">The <see cref="IDistributedApplicationBuilder"/>. </param>
/// <param name="name">The name of the publisher.</param>
/// <param name="configureOptions">Callback to configure options for the publisher.</param>
[Experimental("ASPIREPUBLISHERS001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public static IDistributedApplicationBuilder AddPublisher<TPublisher, TPublisherOptions>(this IDistributedApplicationBuilder builder, string name, Action<TPublisherOptions>? configureOptions = null)
internal static IDistributedApplicationBuilder AddPublisher<TPublisher, TPublisherOptions>(this IDistributedApplicationBuilder builder, string name, Action<TPublisherOptions>? configureOptions = null)
where TPublisher : class, IDistributedApplicationPublisher
where TPublisherOptions : class
{
Expand All @@ -46,4 +44,4 @@ public static IDistributedApplicationBuilder AddPublisher<TPublisher, TPublisher

return builder;
}
}
}
2 changes: 2 additions & 0 deletions src/Aspire.Hosting/Publishing/Publisher.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using Aspire.Hosting.ApplicationModel;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
Expand Down
2 changes: 2 additions & 0 deletions src/Aspire.Hosting/Publishing/PublishingContext.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Diagnostics.CodeAnalysis;
using Microsoft.Extensions.Logging;

namespace Aspire.Hosting.ApplicationModel;
Expand All @@ -14,6 +15,7 @@ namespace Aspire.Hosting.ApplicationModel;
/// <param name="logger">The logger for publishing operations.</param>
/// <param name="cancellationToken">The cancellation token for the publishing operation.</param>
/// <param name="outputPath">The output path for publishing artifacts.</param>
[Experimental("ASPIREPUBLISHERS001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public sealed class PublishingContext(
DistributedApplicationModel model,
DistributedApplicationExecutionContext executionContext,
Expand Down
1 change: 1 addition & 0 deletions src/Aspire.Hosting/ResourceBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ public static IResourceBuilder<T> WithManifestPublishingCallback<T>(this IResour
/// <param name="builder">The resource builder.</param>
/// <param name="callback">Callback method which takes a <see cref="PublishingContext"/> which can be used to publish assets.</param>
/// <returns></returns>
[Experimental("ASPIREPUBLISHERS001", UrlFormat = "https://aka.ms/aspire/diagnostics/{0}")]
public static IResourceBuilder<T> WithPublishingCallback<T>(this IResourceBuilder<T> builder, Func<PublishingContext, Task> callback) where T : IResource
{
ArgumentNullException.ThrowIfNull(builder);
Expand Down
1 change: 0 additions & 1 deletion tests/Aspire.Hosting.Azure.Tests/AzureAppServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Text.Json.Nodes;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.AppService;
using Aspire.Hosting.Utils;
using Microsoft.Extensions.DependencyInjection;
using static Aspire.Hosting.Utils.AzureManifestUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Text.Json.Nodes;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.AppContainers;
using Aspire.Hosting.Azure.ContainerRegistry;
using Aspire.Hosting.Utils;
using Azure.Provisioning;
using Azure.Provisioning.AppContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.AppContainers;
using Aspire.Hosting.Azure.ContainerRegistry;
using Aspire.Hosting.Utils;
using Azure.Provisioning.ContainerRegistry;
using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.AppContainers;
using Aspire.Hosting.Azure.ContainerRegistry;
using Aspire.Hosting.Utils;
using Azure.Provisioning.ContainerRegistry;
using Microsoft.Extensions.DependencyInjection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ public void EnsureFailingPublishResultsInRunMethodThrowing()
{
var args = new[] { "--publisher", "explodingpublisher" };
using var builder = TestDistributedApplicationBuilder.Create(outputHelper, args);
#pragma warning disable ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
builder.AddPublisher<ExplodingPublisher, ExplodingPublisherOptions>("explodingpublisher");
#pragma warning restore ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
using var app = builder.Build();

var ex = Assert.Throws<AggregateException>(app.Run);
Expand All @@ -38,4 +36,4 @@ public Task PublishAsync(DistributedApplicationModel model, CancellationToken ca

internal sealed class ExplodingPublisherOptions
{
}
}
2 changes: 2 additions & 0 deletions tests/Aspire.Hosting.Tests/PublishingTests.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#pragma warning disable ASPIREPUBLISHERS001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

using Aspire.Hosting.Utils;
using Xunit;

Expand Down