Skip to content

Add support for discovery extensions #760

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

SteveL-MSFT
Copy link
Member

@SteveL-MSFT SteveL-MSFT commented Apr 24, 2025

PR Summary

  • Add new subcommand to dsc to list extensions: dsc extension list
  • Add new ExtensionManifest which is similar but differs from ResourceManifest. Only discover capability currently supported.
  • Enhance existing discovery code to handle both resources and extensions. This includes pre-discoverying extensions when discovering resources since an extension may participate. This included a new enum to handle returning either resources or extensions.
  • Write extensions as table when used interactively
  • Rename existing functions to generalize for both resource and extension use, this also required making some private functions public

The output from a discovery extension must match:

{ "resourceManifestPath": "<absolute path>" }

PR Context

Fix #681

@SteveL-MSFT SteveL-MSFT force-pushed the discovery-extension branch 3 times, most recently from 83825d3 to a9277d8 Compare April 24, 2025 20:20
@SteveL-MSFT SteveL-MSFT force-pushed the discovery-extension branch from 3dc2b4c to 87a764c Compare May 1, 2025 21:20
@SteveL-MSFT SteveL-MSFT force-pushed the discovery-extension branch from 87a764c to 27e0ae6 Compare May 1, 2025 22:26
@michaeltlombardi
Copy link
Collaborator

Currently, the implementation requires returning the absolute path to a resource manifest - but I
can already see use cases for discovering extension manifests. For example, I might have
installed an extension from WinGet, and need to discover that, too.

Right now, it expects JSON like this:

{"resourceManifestPath":"/foo/bar/baz.dsc.resource.json"}

But we could have it return this, and parse the last segment of the path to determine kind:

{"absoluteManifestPath":"/foo/bar/baz.dsc.extension.json"}

Or require it return either resourceManifestPath or extensionManifestPath.

If we support extensions discovering extensions, we would need to recursively handle extension
discovery.

const DSC_EXTENSION_EXTENSIONS: [&str; 3] = [".dsc.extension.json", ".dsc.extension.yaml", ".dsc.extension.yml"];

#[derive(Clone)]
pub enum ManifestResource {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Recommend naming this either Manifest or DscManifest to avoid adding another instance of Resource to our lexicon.

Copy link
Member Author

@SteveL-MSFT SteveL-MSFT May 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was having a hard time coming up with a name that was more general, but just Manifest is not correct, but DscManifest given the suffix indicates it's a manifest, but it actually represents the actual resource or extension.

@SteveL-MSFT
Copy link
Member Author

I think we can defer extension discovery til when we need it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Discovery extension type resource
2 participants