Replies: 1 comment 1 reply
-
This is a big area of investment for the next wave of features. No real details yet but this is issue is good motivation. Is this a publish time feature you’re building or a runtime one? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Problem
I'm trying to use the manifest of an Aspire model as input to drive some proprietary CLI tooling to further simplify onboarding for teams. A mono repository in Git is not an option to store all source code for dependencies. So ideally a newcomer to the project would only have to have their dev machine setup with the CLI tool, clone the Aspire project and simply run a CLI command to get up an running.
Idea
Our CLI's magic will then read the manifest for metadata and handle cloning all Git repositories to a relative location the Aspire project expects.
This eliminates the need for written documentation that must be maintained about which repositories need to be manually cloned to successfully run our Aspire project and allows us to fully automate that process making onboarding even more "turn key".
The Aspire app model might describe this metadata like
At this point the addition of the
WithGitRepository
extension will invokeWithManifestPublishingCallback
A few issues arise around extensibility:
ManifestPublishCallbackAnnotation
lacks a way to express whether its mutation intends to fully override, be ignored, or just be additive. In my case I wish to make it additive, adding a new object key that's it.ManifestPublishCallbackAnnotation
using theWithManifestPublishingCallback
does not provide a reference to the resource or access to the default methods on theManifestPublishingContext
to delegate back to. I have no recourse but to rewrite my own so it's also lacking exposure of necessary details. My preference would be to avoid reimplementing any of the default implementation and have to maintain parity as time goes on. This could be made more flexible and not be exclusive as full override or not.aspire/src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs
Lines 88 to 130 in 7f63747
WithManifestPublishingCallback
all wanting to mutate the manifest in subtle ways on anIResource
the last one wins.Potential areas of enhancement:
ManifestPublishingCallbackAnnotation
to indicate whether this should be override or additive?ManifestPublishingContext
which invokes the callback registered with theManifestPublishingCallbackAnnotation
to expose more detail about the current context.WithManifestPublishingCallback
extensions in whichIResource
reference to the callback is provided with a signature such asFunc<ManifestPublishingContext, IResource, Task>
WithManifestPublishingCallback
so that your callback can invoke thisaction
delegate rather than the other way around. The context will still create start and end object, but this provides an option to invert control so the callback chooses to invoke it or not if you want the default (similar to how middleware can chose to halt the request pipeline by not callingawait _next(context)
).aspire/src/Aspire.Hosting/Publishing/ManifestPublishingContext.cs
Lines 124 to 128 in 7f63747
ManifestPublishingCallbackAnnotation
having some type of property likeManifiestPublishingEvents
to follow a flexible eventing pattern which contain numerousFunc<ManifestPublishingContext, IResource, Task>
would be more appropriate to modify behavior at different points of the "writing" processes. Similar to howOpenIdConnectEvents
work. https://github.com/dotnet/aspnetcore/blob/794124fda4e2de1db0e6893dc0cc031a181ce52a/src/Security/Authentication/OpenIdConnect/src/Events/OpenIdConnectEvents.cs#L9-L72Beta Was this translation helpful? Give feedback.
All reactions