-
Notifications
You must be signed in to change notification settings - Fork 720
Implement new "default" publisher #9096
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
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f7ad98a
Implement new "default" publisher
davidfowl b56cf6a
Remove redundant pragma warning directives in ResourceExtensions.cs
davidfowl 8211afa
Fix error in tests
davidfowl e2b97db
Refactor publishing annotations and context for improved clarity and …
davidfowl 3f8687c
Reorganize using directives and namespace declaration for clarity
davidfowl a537b5a
Reorganize using directives for improved clarity
davidfowl 9f0ced1
Enhance GetDeploymentTargetAnnotation to prioritize ComputeEnvironmen…
davidfowl 1f6fad4
Refactor WriteKubernetesOutputAsync to improve handling of Kubernetes…
davidfowl 7197d2c
Fix tests
davidfowl b2d4399
Only single compute enviroment at a time
davidfowl c109365
Make PublishingCallbackAnnotation class sealed to prevent inheritance
davidfowl c27233a
Added smoke test for default publisher
davidfowl 14bc3fd
Verify that these resources are publishing in the right mode.
davidfowl File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
playground/publishers/Publishers.AppHost/.aspire/settings.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| "appHostPath": "../Publishers.AppHost.csproj" | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,5 +6,8 @@ | |
| "Aspire.Hosting.Dcp": "Warning", | ||
| "Aspire.Hosting": "Information" | ||
| } | ||
| }, | ||
| "Deployment": { | ||
| "Target": "kube" | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/Aspire.Hosting/ApplicationModel/PublishingCallbackAnnotation.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Aspire.Hosting.ApplicationModel; | ||
|
|
||
| /// <summary> | ||
| /// Represents a default publishing callback annotation for a distributed application model. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// Initializes a new instance of the <see cref="PublishingCallbackAnnotation"/> class. | ||
| /// </remarks> | ||
| /// <param name="callback">The publishing callback.</param> | ||
| 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)); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // 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 Microsoft.Extensions.Logging; | ||
| using Microsoft.Extensions.Options; | ||
|
|
||
| namespace Aspire.Hosting.Publishing; | ||
|
|
||
| internal class Publisher( | ||
| ILogger<Publisher> logger, | ||
| IOptions<PublishingOptions> options, | ||
| DistributedApplicationExecutionContext executionContext, | ||
| IServiceProvider serviceProvider) : IDistributedApplicationPublisher | ||
| { | ||
| public Task PublishAsync(DistributedApplicationModel model, CancellationToken cancellationToken) | ||
| { | ||
| if (options.Value.OutputPath == null) | ||
| { | ||
| throw new DistributedApplicationException( | ||
| "The '--output-path [path]' option was not specified." | ||
| ); | ||
| } | ||
|
|
||
| var context = new PublishingContext(model, executionContext, serviceProvider, logger, cancellationToken, options.Value.OutputPath); | ||
| return context.WriteModelAsync(model); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.