Skip to content

Make required command validation generic via resource annotations for orchestrator pre-checks #11943

@davidfowl

Description

@davidfowl

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

Currently, required executable validation is implemented specifically in RequiredCommandValidator, which is closely tied to certain resources that launch processes. However, there are scenarios where a resource (not just an executable resource) may need to declare that certain software is installed and available on the local machine PATH before it can start. There is no generic way for resources to express such requirements, and for the orchestrator to enforce them before starting the resource.

Describe the solution you'd like

Generalize the required command validation logic so that any resource can declare, via annotations, the executables or software it requires to be installed and available on the PATH. The orchestrator should process these annotations in BeforeResourceStart, resolving and checking that the required software is installed before starting the resource. This would involve:

  • Defining a standard annotation format for declaring required commands/software on resources.
  • Refactoring the logic in RequiredCommandValidator to a reusable, generic component.
  • Integrating this validation into the orchestrator's lifecycle, so checks happen before resource start.
  • Ensuring that this is not limited to just executable resources, but can be used by any resource type that needs local software preconditions.

This would make resource requirements more declarative and improve startup reliability for applications with external dependencies.

Additional context

This is a common pattern for executable resources but can apply more broadly. The feature would make Aspire applications more robust and easier to configure, especially for advanced scenarios or custom resources.

https://github.com/dotnet/aspire/blob/6116fd877be6eb20c232cc4b56d925aa212fe822/src/Aspire.Hosting.DevTunnels/RequiredCommandValidator.cs

Metadata

Metadata

Assignees

Labels

area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions