Skip to content

Commit af22d03

Browse files
committed
Revert IComputeResource changes
1 parent 3a9fcb1 commit af22d03

File tree

16 files changed

+63
-67
lines changed

16 files changed

+63
-67
lines changed

src/Aspire.Hosting.Azure.AppContainers/AzureContainerAppsInfrastructure.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,11 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
6262
// container app environment in the deployment target information
6363
// associated with each compute resource that needs an image
6464
#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.
65-
if (r is IComputeResource computeResource)
65+
r.Annotations.Add(new DeploymentTargetAnnotation(containerApp)
6666
{
67-
computeResource.ContainerRegistry = caes.FirstOrDefault();
68-
computeResource.ComputeEnvironment = environment as IComputeEnvironmentResource;
69-
}
70-
r.Annotations.Add(new DeploymentTargetAnnotation(containerApp));
67+
ContainerRegistry = caes.FirstOrDefault(),
68+
ComputeEnvironment = environment as IComputeEnvironmentResource
69+
});
7170
#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.
7271
}
7372

src/Aspire.Hosting.Azure/Aspire.Hosting.Azure.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
<PackageReference Include="System.IO.Hashing" />
3434
<PackageReference Include="Azure.Provisioning" />
3535
<PackageReference Include="Azure.Provisioning.KeyVault" />
36-
<PackageReference Include="Azure.Provisioning.ContainerRegistry" />
3736
<PackageReference Include="Azure.ResourceManager.Authorization" />
3837
<PackageReference Include="Azure.ResourceManager.KeyVault" />
3938
<PackageReference Include="Azure.ResourceManager.Resources" />

src/Aspire.Hosting.Azure/AzurePublishingContext.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,11 @@ void CaptureBicepOutputs(object value)
238238
File.Copy(file.Path, modulePath, true);
239239

240240
// Capture any bicep outputs from the registry info as it may be needed
241-
if (resource is IComputeResource computeResource)
241+
Visit(annotation.ContainerRegistry?.Name, CaptureBicepOutputs);
242+
Visit(annotation.ContainerRegistry?.Endpoint, CaptureBicepOutputs);
243+
if (annotation.ContainerRegistry is IAzureContainerRegistry acr)
242244
{
243-
Visit(computeResource.ContainerRegistry?.Name, CaptureBicepOutputs);
244-
Visit(computeResource.ContainerRegistry?.Endpoint, CaptureBicepOutputs);
245-
if (computeResource.ContainerRegistry is IAzureContainerRegistry acr)
246-
{
247-
Visit(acr.ManagedIdentityId, CaptureBicepOutputs);
248-
}
245+
Visit(acr.ManagedIdentityId, CaptureBicepOutputs);
249246
}
250247

251248
foreach (var parameter in br.Parameters)

src/Aspire.Hosting.Docker/DockerComposeInfrastructure.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
5757

5858
// Add deployment target annotation to the resource
5959
#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.
60-
r.Annotations.Add(new DeploymentTargetAnnotation(serviceResource));
61-
if (r is IComputeResource computeResource)
60+
r.Annotations.Add(new DeploymentTargetAnnotation(serviceResource)
6261
{
63-
computeResource.ComputeEnvironment = environment;
64-
}
62+
ComputeEnvironment = environment
63+
});
6564
#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.
6665
}
6766
}

src/Aspire.Hosting.Kubernetes/KubernetesInfrastructure.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,10 @@ public async Task BeforeStartAsync(DistributedApplicationModel appModel, Cancell
5757

5858
// Add deployment target annotation to the resource
5959
#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.
60-
r.Annotations.Add(new DeploymentTargetAnnotation(serviceResource));
61-
if (r is IComputeResource computeResource)
60+
r.Annotations.Add(new DeploymentTargetAnnotation(serviceResource)
6261
{
63-
computeResource.ComputeEnvironment = environment;
64-
}
62+
ComputeEnvironment = environment
63+
});
6564
#pragma warning restore ASPIRECOMPUTE001
6665
}
6766
}

src/Aspire.Hosting/ApplicationModel/ContainerResource.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,4 @@ public class ContainerResource(string name, string? entrypoint = null)
1919
/// </summary>
2020
/// <remarks><c>null</c> means use the default Entrypoint defined by the container.</remarks>
2121
public string? Entrypoint { get; set; } = entrypoint;
22-
23-
/// <inheritdoc />
24-
IComputeEnvironmentResource? IComputeResource.ComputeEnvironment { get; set; }
25-
26-
/// <inheritdoc />
27-
IContainerRegistry? IComputeResource.ContainerRegistry { get; set; }
2822
}

src/Aspire.Hosting/ApplicationModel/DeploymentTargetAnnotation.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4+
using System.Diagnostics.CodeAnalysis;
5+
46
namespace Aspire.Hosting.ApplicationModel;
57

68
/// <summary>
@@ -12,4 +14,17 @@ public sealed class DeploymentTargetAnnotation(IResource target) : IResourceAnno
1214
/// The deployment target.
1315
/// </summary>
1416
public IResource DeploymentTarget { get; } = target;
17+
18+
/// <summary>
19+
/// Gets or sets the container registry information associated with
20+
/// the deployment target, if the deployment target is an image-based environment.
21+
/// </summary>
22+
[Experimental("ASPIRECOMPUTE001")]
23+
public IContainerRegistry? ContainerRegistry { get; set; }
24+
25+
/// <summary>
26+
/// Gets or sets the compute environment resource associated with the deployment target.
27+
/// </summary>
28+
[Experimental("ASPIRECOMPUTE001")]
29+
public IComputeEnvironmentResource? ComputeEnvironment { get; set; }
1530
}

src/Aspire.Hosting/ApplicationModel/ExecutableResource.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ public class ExecutableResource(string name, string command, string workingDirec
2828
/// </summary>
2929
public string WorkingDirectory { get; } = workingDirectory ?? throw new ArgumentNullException(nameof(workingDirectory));
3030

31-
/// <inheritdoc />
32-
IComputeEnvironmentResource? IComputeResource.ComputeEnvironment { get; set; }
33-
34-
/// <inheritdoc />
35-
IContainerRegistry? IComputeResource.ContainerRegistry { get; set; }
36-
3731
private static string ThrowIfNullOrEmpty([NotNull] string? argument, [CallerArgumentExpression(nameof(argument))] string? paramName = null)
3832
{
3933
ArgumentException.ThrowIfNullOrEmpty(argument, paramName);

src/Aspire.Hosting/ApplicationModel/IComputeResource.cs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,4 @@ namespace Aspire.Hosting.ApplicationModel;
1515
[Experimental("ASPIRECOMPUTE001")]
1616
public interface IComputeResource : IResource
1717
{
18-
/// <summary>
19-
/// Gets or sets the compute environment resource associated with this compute resource.
20-
/// </summary>
21-
public IComputeEnvironmentResource? ComputeEnvironment { get; set; }
22-
23-
/// <summary>
24-
/// Gets or sets the container registry associated with this compute resource.
25-
/// </summary>
26-
public IContainerRegistry? ContainerRegistry { get; set; }
2718
}

src/Aspire.Hosting/ApplicationModel/ProjectResource.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,6 @@ public class ProjectResource(string name)
2222
// Track the https endpoint that was added as a default, and should be excluded from the port & kestrel environment
2323
internal EndpointAnnotation? DefaultHttpsEndpoint { get; set; }
2424

25-
/// <inheritdoc />
26-
IComputeEnvironmentResource? IComputeResource.ComputeEnvironment { get; set; }
27-
28-
/// <inheritdoc />
29-
IContainerRegistry? IComputeResource.ContainerRegistry { get; set; }
30-
3125
internal bool ShouldInjectEndpointEnvironment(EndpointReference e)
3226
{
3327
var endpoint = e.EndpointAnnotation;

0 commit comments

Comments
 (0)